DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: AutoHotkey scripts - what to do?!  (Read 5,276 times)

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,970
    • Gathering Badge
    • Participated in NANY Challenge Once
AutoHotkey scripts - what to do?!
« on: April 17, 2007, 08:05 AM »
Basic Autohotkey question:
I know I could go to Autohotkey forums, maybe should even.

But,
there's so many helpful Autohotkey scripts here that I thought I'd ask here  :)

If you have an *.ahk file -
I believe if you simply open it, (with Autohotkey running) it will work/run/do whatever it's supposed to do.
Or often theres *.exe versions of the scripts. But if one can run various scripts through AHK it would naturally be a lot neater.

What I want to know is if you can simply add contents of the .ahk file to the default .ini file that loads with AHK
or would it be better or
can you make it load with AHK as well as the default script
Tom

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: AutoHotkey scripts - what to do?!
« Reply #1 on: April 17, 2007, 10:19 AM »
I see what you mean.
Each script you launch (either by double-clicking the exe or the .ahk file) is launched with a new instance of autohotkey.
The reason for this is because each script needs its set of variables, functions, labels and such (called the context). If you had 2 scripts launching with the same context, they'd be using each other's variables, thus, interefeering with each other (with a 99.99% of probably that it'd be a bad interaction).

You can copy 2 scripts into only one .ahk file, but most probably it simply won't work. It takes some ahk knowledge to be able to change the 2 scripts so that they don't interfeer with each other.
I believe BrotherS does this frequently, though.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: AutoHotkey scripts - what to do?!
« Reply #2 on: April 18, 2007, 03:25 AM »
yes as jgpaiva said if your scripts contain unique set of variables and hotkeys then you can also use the #Include command. e.g.

Quote
#Include / #IncludeAgain
Causes the script to behave as though the specified file's contents are present at this exact position.

Example
#Include C:\My Documents\Scripts\Utility Subroutines.ahk
#Include %A_ScriptDir%  ; Changes the working directory for #Includes and FileInstalls physically beneath this point.
#Include C:\My Scripts  ; Same as above but for an explicitly named directory.

Original address: https://www.donationcoder.com/forum/index.php?topic=8145.0