Sign in to follow this  
Followers 0
IdrAne

Need help tweaking my VERY simple script

5 posts in this topic

Hi all

I managed to successfully change an example script and make almost do exactly what i need

All i need is a script that will:

whenever i press v, wait 4 seconds then play a .wav file

the script that i have at the moment can do that, however the actual letter v is no longer sent when i press v with this script open

i tried throwing in a send("v") command but for some reason it stops the script from working

HotKeySet("{ESC}", "_Exit") 
HotKeySet("{v}", "MyFunc")

While 1 
    Sleep(1000) 
WEnd    

Func _Exit()
    Exit
EndFunc

Func MyFunc()   
    sleep(4000)
    SoundPlay("C:\Ventrilo\Binds.wav")
EndFunc

im sure im just forgetting some arbitrary syntax or something, any help would be appreciated

Share this post


Link to post
Share on other sites



The Send() command is what you need but you also need to disable the HotKey first, send the letter and then set the hotkey again.

Just wondering: what kind of need do you have for this?


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If you add Send("v") in your function that will get picked up by the hotkey and the function will start again, before it gets a chance to run. To solve this you can:

1. Unset hotkey V at the start of your function, then Send("v") and then set the hotkey again.

2. Use _ispressed in your while loop to detect if "v" is pressed.

edit: Too slow :<

Edited by Tvern

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I'm not very experienced with Autoit so I have no real clue of what your problem is.

By the way, you might try Send("v",1), which send raw keys. See help.

Other thing I notice, is a very long sleep time in that While loop (1000ms). Try to shorten it to 10 or 50.

Tell me if helped. Sorry, can't do more than this.

Edit: lol i would have never figured out.

To Jos. I think he's trying to code an automatic sound player for ventrilo (voip program like teamspeak) so you can play sounds over it with a simple hotkey. Just guessing though.

Edited by niubbone

Share this post


Link to post
Share on other sites

I would reccomend changing your hotkey to a combination of keys, such as ALT+v:

HotKeySet("!v", "MyFunc")

[center][/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0