Jump to content

Need help tweaking my VERY simple script


Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...