AutoHotkey Community

It is currently May 27th, 2012, 12:40 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: September 21st, 2005, 9:35 pm 
Offline

Joined: July 29th, 2005, 5:32 pm
Posts: 179
If I put this in this in 1.ahk
Code:
msgbox, starting script..
#Include 2.ahk
msgbox, back to original file..
and this in 2.ahk
Code:
#Persistent
msgbox, included script..
it runs 2.ahk.. & successfully returns to 1 where it left off.

If I change 2.ahk to this:
Code:
#Persistent
msgbox, included script..
!s::msgbox, you pressed alt s..
it never returns to original file..

If I put the hotkey on 1.ahk instead of 2..
Code:
msgbox, starting script..
#Include 2.ahk
msgbox, back to original file..
!s::msgbox, you pressed alt s..
..the entire script works fine..

Do hotkeys always have to be either on the 1st script file.. (or on the last 'include' of the script)... or is this a bug?

ps.I also tried different variations w/ return or exit on 2.. but didn't have any luck..

_________________
.o0[ corey ]0o.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2005, 12:57 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
This is caused by the fact that the auto-execute section ends automatically when the first double-colon label (hotkey or hotstring) is encountered. To work around it, you might need two include-files:

The first contains anything for your autoexecute section -- it gets included near the top of the main script.

The second contains hotkeys, hotstrings, and subroutines -- it gets included somewhere after the end of the main script's auto-execute section (perhaps even at the bottom of the main script).


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group