AutoHotkey Community

It is currently May 27th, 2012, 4:09 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: June 23rd, 2011, 9:56 pm 
Offline

Joined: March 16th, 2011, 6:12 pm
Posts: 172
Location: Worcester, Massachusetts
Code:
;typing "a" does nothing (it sends an "a" as if there were no hotstring). typing "b" also does nothing
:*:a::
(
:*:b::
more text
)
;this works (typing "a" sends "hello{enter}more text")
:*:a::
(
hello
more text
)
;even when the "b" hotstring has a definition nothing happens
:*:a::
(
:*:b::this doesn't happen
more text
)
:?:

_________________
★★★ Email me at berban at aim full stop com ★★★


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2011, 10:09 pm 
also wouldnt work with r (raw) option

:*R:test::
(
*R:testing::
)
return


Report this post
Top
  
Reply with quote  
PostPosted: June 23rd, 2011, 11:38 pm 
I wrote this part of my reply, before testing your code...
    Hotstrings are only Hotstrings when the replacement text is on the same line. Once you move the Replacement text to the next line, it's no longer an Auto-Replace Hotstring, you then need to use Send, if you wanna send text & use Send's options if you want to Send Raw.
...I see now, that you CAN, in fact, use Continuation Sections, with Auto-Replace Hotstrings. It just has this one bug.

OK, I see the problem, it can be worked-around with either...

Code:
:*:a::
(LTrim
   :*:b`::
   more text
)

...or...

Code:
:*:a::
(LTrim
   :*:b:`:
   more text
)

...or...

Code:
:*:a::
SendInput,
(LTrim
   :*:b::
   more text
)
return

...it seems with the Auto-Replace syntax any line containing "::" causes it to fail. For example, this also FAILS...

Code:
:*:a::
(LTrim
   some::text
)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 24th, 2011, 4:16 am 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
Causes it to fail isn't quite true. The hotstring is created, but not the one you expected. A hotstring is defined by the first and last occurrences of double colons, rather than the first and second. The Help file alludes to this.
AHK Help File wrote:
...single-colons within hotstring definitions do not need to be escaped,
The inference is that double-colons do need to be escaped. The documentation of escape characters is a bit misleading on this point, and should be updated.

It's also important to remember that continuation sections are merged immediately, before a script is parsed. Rewriting the hotstring on a single line provides a better visual indication of what happens. The hotstring is defined between the characters in red.
Code:
:*:a::some::text


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 24th, 2011, 8:19 am 
Offline

Joined: March 16th, 2011, 6:12 pm
Posts: 172
Location: Worcester, Massachusetts
Thank you for helping to clear that up! :)

_________________
★★★ Email me at berban at aim full stop com ★★★


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: No registered users and 3 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