AutoHotkey Community

It is currently May 27th, 2012, 1:42 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: September 13th, 2005, 11:27 am 
Offline

Joined: May 26th, 2004, 12:20 pm
Posts: 61
Hi,

I get a "Error: HotKeys/Hotstrings are not allowed inside functions" from both of the following cases:

Code:
testFunction1()
{
  // test::for hotkey detection
}

testFunction2()
{
  localstring := "test::for hotkey detection"
}


This works fine, however:

Code:
testFunction3()
{
  /*
    test::for hotkey detection
  */
}


Ant.

EDIT: actually it looks like its not possible to set a variable to a value that contains :: anywhere in a script.

EDIT 2: though this, and testFunction2 above, can be worked around, eg:

Code:
  c = use Win32:
  c = %c%:OLE;`n


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 13th, 2005, 1:47 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
antonyb wrote:
// test::for hotkey detection
The above line is a syntax error unless you've changed #CommentFlag to be // rather than semicolon.

Quote:
localstring := "test::for hotkey detection"
A double colon is one of the few things you have to escape inside a quoted string. Generally, you don't have to escape commas or percent signs when they're in quotes. I'll check if there's a way to avoid the need for `:: in future versions.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2005, 3:55 pm 
Offline

Joined: May 26th, 2004, 12:20 pm
Posts: 61
Oh dear :cry: yes, serves me right for posting in a hurry.
Code:
; test::for hotkey

works fine. I tend to use ;// for comments as my editor has a C syntax hilighting mode which works fine for AHK except for comments. I've been flicking between C, AHK, Perl, Java & C# today, and must have got confused!

Sorry!

Ant.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 5 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