 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ArchCarrier
Joined: 03 Jun 2008 Posts: 27
|
Posted: Sat Jan 17, 2009 2:16 pm Post subject: Hotkey doesn't work when #Included |
|
|
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? |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1045
|
Posted: Sat Jan 17, 2009 4:21 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
ArchCarrier
Joined: 03 Jun 2008 Posts: 27
|
Posted: Sun Jan 18, 2009 8:21 am Post subject: |
|
|
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." |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1045
|
Posted: Sun Jan 18, 2009 9:13 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
ArchCarrier
Joined: 03 Jun 2008 Posts: 27
|
Posted: Sun Jan 18, 2009 12:32 pm Post subject: |
|
|
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! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|