Xichael Posted February 21, 2008 Share Posted February 21, 2008 (edited) I'm desperately trying to wrap my head around AutoIt. I've learned some html/css, but never any scripting languages (if that's what you'd call this). I'm trying to write a script that will run a program upon pressing a given hotkey. I've so far been attempting to make something of this: #NoTrayIcon HotKeySet ("#z", "Run") Func Run() "C:\Program Files\Monoff4.exe" EndFunc Could someone explain how this would work? Edited February 21, 2008 by Xichael Link to comment Share on other sites More sharing options...
martin Posted February 21, 2008 Share Posted February 21, 2008 I'm desperately trying to wrap my head around AutoIt. I've learned some html/css, but never any scripting languages (if that's what you'd call this). I'm trying to write a script that will run a program upon pressing a given hotkey. I've so far been attempting to make something of this: #NoTrayIcon HotKeySet ("#z", "Run") Func Run() "C:\Program Files\Monoff4.exe" EndFunc Could someone explain how this would work?Welcome to AutoIt forums nt There is a function in AutoIt called Run so it would be best to have a different name for your function, say _Run. Look it up in the help file. #NoTrayIcon HotKeySet ("#z", "_Run") Func _Run() Run("C:\Program Files\Monoff4.exe") EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Xichael Posted February 21, 2008 Author Share Posted February 21, 2008 Thanks Martin. I thought I was close. This still isn't working however... AutoIt3.exe just won't start when I run this script (though the icon does flash briefly in the tray). What's missing? Link to comment Share on other sites More sharing options...
Wheebo Posted February 21, 2008 Share Posted February 21, 2008 Thanks Martin. I thought I was close.This still isn't working however... AutoIt3.exe just won't start when I run this script (though the icon does flash briefly in the tray).What's missing?Its flashing because the script turns on, runs through your script lines and exits the script after because you habe no While - Wend function in it =)Look it up in the Help file its pretty easy( While-Wend , lets the script repeat all the time till a certan action is performed eg. button click ) so it should not turn off instantly after running through all of your script lines =)Greetz Whee Link to comment Share on other sites More sharing options...
Azothoras Posted February 21, 2008 Share Posted February 21, 2008 Try this #NoTrayIcon HotKeySet ("#z", "Run") While 1 Sleep(50) WEnd Func Run() Run("Monoff4.exe", "C:\Program Files\") EndFunc Is that doesn't work then try this. #NoTrayIcon HotKeySet ("#z", "Run") While 1 Sleep(50) WEnd Func Run() ShellExecute("Monoff4.exe", "", "C:\Program Files\") EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now