Jump to content

Run script by HotKey : How to?


riqrat
 Share

Recommended Posts

I tried using one of the example scripts and it only works the first time I use it.

Subsequent pressing of the Hotkey combination does nothing.

Here is my script as is:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

HotKeySet("{ESC}", "Terminate")
HotKeySet("+z", "RunHurst") ;Shift-z



While 1
   Sleep(100)
WEnd

Func Terminate()
   Exit 0
EndFunc

Func RunHurst()
   ShellExecute("G:\HURST\HURST.xltm","","","")
EndFunc

After I run this script, I can press Shift-Z and it will run my Excel file.

After I'm done with the file and close it, but later press Shift-Z, nothing happens.

Now, I'd rather just assign a Hotkey to run the script with just one line, the ShellExecute.  But going into properties of the file does not have a Hotkey option so that is why I wrote the above.

 

Any ideas?

TIA

Link to comment
Share on other sites

Now, I'd rather just assign a Hotkey to run the script with just one line, the ShellExecute.  But going into properties of the file does not have a Hotkey option so that is why I wrote the above.

Were you actually looking at a shortcut? Those are the only files that have that.

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...