Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Run script without AutoHotKey installed


  • Please log in to reply
7 replies to this topic
surfbum3000
  • Members
  • 53 posts
  • Last active: Jun 06 2011 07:31 PM
  • Joined: 05 Oct 2005
I have created a simple script I would like to distribute to the field. Is there a way to run .ahk scripts without installing AutoHotKey on each machine?

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

I have created a simple script I would like to distribute to the field. Is there a way to run .ahk scripts without installing AutoHotKey on each machine?


Yes!

You have to put Autohotkey.exe along with YourScript.ahk and create a Shortcut to Autohotkey.exe with YourScript.ahk passed as a parameter.

Regards, :)
kWo4Lk1.png

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Or, to have a single file, just compile the script.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

surfbum3000
  • Members
  • 53 posts
  • Last active: Jun 06 2011 07:31 PM
  • Joined: 05 Oct 2005
First, I used WinZip to include 3 files: AutoHotKey.exe & Test2SchedulerSWMH.ahk & Test2SchedulerSW.bat. These 3 files unzip to the folder C:\AutoHotKey

Second, I created a .bat file to send to the user.

C:\
CD C:\AutoHotKey
AutoHotKey.exe "Test2SchedulerSWMH.ahk"

So now all they have to do is initiate the .bat file. Is there an easier way to do this?

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005

Is there an easier way to do this?

Yes, compile the script... Unless you need to auto-alter the script or create dynamically a new script to run (like Laszlo's calculator).
Another advantage of compiled scripts is that you don't really need to Zip them, as they are already compressed.
Run Ahk2Exe.exe in the Compiler sub-directory, or choose Compile Script in the context menu of the script (if you installed AutoHotkey).
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

surfbum3000
  • Members
  • 53 posts
  • Last active: Jun 06 2011 07:31 PM
  • Joined: 05 Oct 2005
I right clicked the .ahk file and selected Compile Script. I then took the .exe file and ran it on a PC without AutoHotKey installed. Worked great. Thanks.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Dear surfbum3000,

I right clicked the .ahk file and selected Compile Script. I then took the .exe file and ran it on a PC without AutoHotKey installed. Worked great. Thanks.


Its NOT my Day! :(

I wrote an Installer for your script. I have sent it as a Personal Message & so please check your Inbox.

Please give me feedback after testing it.

Regards, :)
kWo4Lk1.png

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
If your computers are networked you could add a registry value for .ahk files files all computers that makes them run with AutoHotkey on the main server. This way you can distribute your tiny text-scripts instead of the more bulky 180kb executables.

Save this to a file like install.reg and run on all computers (note: untested)
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.ahk]
@="AutoHotkeyScript"

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Open\Command]
@="\"\\workstation01\C:\\Program Files\\AutoHotkey\\AutoHotkey.exe\" \"%1\" %*"

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit