AutoHotkey Community

It is currently May 26th, 2012, 2:19 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: January 17th, 2009, 3:16 pm 
Offline

Joined: June 3rd, 2008, 6:44 pm
Posts: 27
I've made a quick popup menu that I like to access using Win+A. I #Include the menu code in the top of my autohotkey.ini
Now, the weird thing is that the hotkey doesn't work when using #Include. Only when I run the menu script by itself the hotkey becomes active.

I have tried all combinations: including all the menu code directly in the .ini file, keeping the menu code apart but only including the hotkey in the .ini file, etc.
I'm out of options; what can be the problem?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 17th, 2009, 5:21 pm 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
Can you post the code?

_________________
As always, if you have any further questions, don't hesitate to ask.

Add OOP to your scripts via the Class Library. Check out my scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 18th, 2009, 9:21 am 
Offline

Joined: June 3rd, 2008, 6:44 pm
Posts: 27
Of course. Here are the very first two lines of my Autohotkey.ini:
Code:
#Include c:\Program Files\AutoHotkey\Scripts\Functions.ahk
#Include c:\Program Files\AutoHotkey\Scripts\StartMenu.ahk

A couple of lines down I have this:
Code:
#a::Menu, MyMenu, Show, 0, 1024


Here is the code in StartMenu.ahk:
Code:
CoordMode, Menu, Screen

; Create submenu
Menu, Submenu1, Add, &AutoHotkey.ini, AutoHotkey
Menu, Submenu1, Add, &Start Menu, StartMenu
Menu, Submenu1, Add, U&RL Filter, URLfilter
Menu, Submenu1, Add, &Telefoonnummers, EditTelefoonnummers

; Display submenu
Menu, MyMenu, Add, &Edit files, :Submenu1

; Add separator
Menu, MyMenu, Add

Menu, MyMenu, Add, Play &DVD, PlayDVD
Menu, MyMenu, Add, &Photoshop, Photoshop
Menu, MyMenu, Add, &Illustrator, Illustrator
Menu, MyMenu, Add, &Lightroom, Lightroom
Menu, MyMenu, Add, &Writer, Writer
Menu, MyMenu, Add, &Calc, Calc
Menu, MyMenu, Add, Mnemos&yne, Mnemosyne
Menu, MyMenu, Add, Super&Memo, SuperMemo
Menu, MyMenu, Add, &Skype, Skype
Menu, MyMenu, Add, Tas&k Scheduler, TaskScheduler
Menu, MyMenu, Add, &XAMPP, StartXampp

return

Followed by all the menu handlers and nothing else.

As I said, I have tried putting the hotkey line everywhere I could think of, but I always get the same error: "Error in #Include file c:\Program Files\AutoHotkey\Scripts\StartMenu.ahk: Menu does not exist."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 18th, 2009, 10:13 am 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
I added the hotkey after the menu creation (after the return statement in StartMenu.ahk) and had no problem. If I remember correctly, if you put in a hotkey, it ends the auto-exec section. This means, if you put your hotkey anywhere but after the entire auto-exec section is done, you won't have what follows evaluated. Below is a simple script to illustrate this point.

Code:
#a::MsgBox, Test
MsgBox, This is NEVER seen!!
return


Code:
MsgBox, But this is :)
return
#a::MsgBox, Test

_________________
As always, if you have any further questions, don't hesitate to ask.

Add OOP to your scripts via the Class Library. Check out my scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 18th, 2009, 1:32 pm 
Offline

Joined: June 3rd, 2008, 6:44 pm
Posts: 27
That was indeed the solution, but not in the pieces of code I posted: in the Functions.ahk that's included in the first line of my .ini file, I had put a hotkey. I was working on both files at the same time, so I didn't realise it was the Functions part that caused the problem.

Thanks anyway!


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: G. Sperotto, Google Feedfetcher, LazyMan, poserpro and 14 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