AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using A_IsCompiled to set #NoTrayIcon

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
scouchman



Joined: 28 Apr 2004
Posts: 45

PostPosted: Mon May 15, 2006 3:36 am    Post subject: Using A_IsCompiled to set #NoTrayIcon Reply with quote

I can't figure out what I'm doing wrong here. Seems like it should be so simple, maybe just too tired.

I build in a few troubleshooting options in my scripts before I compile them, and wanted to be able to leave them in there as I'm working on them. Right now I'm remarking them out, but occasionally forget, so wanted to make a programmer proof option.

The most basic one is the tray icon. In ahk form, I want it for testing/reloading, etc., but in compiled form I do not want the icon there. So thought this would work:
Code:
IfNotEqual, A_IsCompiled, , #NoTrayIcon

or
Code:
IfEqual, A_IsCompiled, 1, #NoTrayIcon

or
Code:
IfEqual, A_IsCompiled, 1
{
 #NoTrayIcon
}

or
Code:
IfNotEqual, A_IsCompiled,
{
 #NoTrayIcon
}

The single line options, the icon is present in both compiled and non compiled moded.

The multiline options, the icon is missing in both compiled and non compiled moded. (I've tried with and withouth the {}).

Is this a bug? Am I doing something incorrect? Did I miss reading about this somewhere?
_________________
Scott F Couchman
Back to top
View user's profile Send private message AIM Address MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 6264

PostPosted: Mon May 15, 2006 5:57 am    Post subject: Reply with quote

Dear Scott F Couchman, Smile

Code:
IfEqual, A_IsCompiled, 1
{
 #NoTrayIcon
}


You wrote:
Is this a bug? Am I doing something incorrect? Did I miss reading about this somewhere?


No! This is not a bug. You cannot put a conditional Hash Directive!

Means,

Directives like
#Persistent
#NoTrayIcon

etc

cannot be controlled with an IF condition.

Whenever AHK sees a Directive, it just effects it and does not consider the lines before are after.
AHK is designed to function that way.

The following example is a workaround:

Code:
#Persistent
#NoTrayIcon
If (!A_IsCompiled)
  Menu,Tray,Icon

Return

^#X::ExitApp
^#C::Run, Calc.exe


Regards, Smile
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group