Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 03, 2016, 03:50:52 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: AutoHotkey scripts - what to do?!  (Read 1956 times)

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 10,315
    • View Profile
    • Donate to Member
AutoHotkey scripts - what to do?!
« on: April 17, 2007, 03:05:21 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

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: AutoHotkey scripts - what to do?!
« Reply #1 on: April 17, 2007, 05:19:25 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,258
    • View Profile
    • Coding Snacks by Lanux128
    • Read more about this member.
    • Donate to Member
Re: AutoHotkey scripts - what to do?!
« Reply #2 on: April 17, 2007, 10:25:56 PM »
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.