AutoHotkey Community

It is currently May 27th, 2012, 11:48 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: July 20th, 2010, 2:33 am 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
I have a very annoying, yet interesting problem:

I have two scripts: one, the main, with general commands to deal with Windows, launch programs and some macros, and other, the hotstrings-list script. I have many many hotstrings, something near 12000, added along the last three years. They both run at the same time.

Whenever I assign a context-sensitive hotkey in the main script, using Ctrl, such as:

Code:
#IfWinActive, ahk_class Notepad
^k::
send Hi everybody!
return

#IfWinActive


...it will mysteriously impact in the functionality of the second, particularly in a group of 9 hotstrings:

Code:
::a1::art. 1º
::a2::art. 2º
::a3::art. 3º
::a4::art. 4º
::a5::art. 5º
::a6::art. 6º
::a7::art. 7º
::a8::art. 8º
::a9::art. 9º


What happens is that, when I trigger one of the nine hotstrings above, they appear to press and keep pressed the CTRL key down (sending a "hidden" {ctrldown} command), and then wait for the letter assiged to the first hotkey, in the main script (Ctrl+K in case) to be pressed. So, when I type "a6" to have it expand to "art. 6º", the next time I press "K" it will send "Hi everybody!"

Example: if I type in the keyboard "a6 is meant for Anakin to read", the output will be "art. 6º is meant for AnaHi Everybody!in to read"

You can test, putting the two following pieces of code in separate .ahk files to see for yourself:

Code:
::a1::art. 1º
::a2::art. 2º
::a3::art. 3º
::a4::art. 4º
::a5::art. 5º
::a6::art. 6º
::a7::art. 7º
::a8::art. 8º
::a9::art. 9º


and

Code:
#IfWinActive, ahk_class Notepad
^k::
send Hi everybody!
return

#IfWinActive


...and please not that you don't even need to type the hotstrings (a7 to expand to art. 7º, for example, on the same window of the delimited context).

I'm suspicious about the º character, the degree mark.

Thanks in advance.

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2010, 2:49 am 
Offline

Joined: February 27th, 2009, 9:11 am
Posts: 693
Location: Burbank, California
No errors here. Vista 32.

_________________
"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom" but let's start to get the data...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2010, 6:47 am 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
I thought this could be a conflict with another part in my scripts, but I isolated these to pieces of code and ran only them. Still got the error..

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2010, 6:56 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
What if you send Chr(whateveritis) for the degree sign or sendraw/blind
Code:
::a1::SendRaw, art. 1º

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2010, 7:09 am 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
hugov wrote:
What if you send Chr(whateveritis) for the degree sign or sendraw/blind
Code:
::a1::SendRaw, art. 1º



Well, it worked, thanks! Although I had to use the form
Code:
::a1::
SendRaw, art. 1º
return


instead of making it singleline, like I like. The problem is that this didn't use to happen, but now it "magically" returned. I won't go much further, but can you imagine what is the 'underlying' cause?

And thanks for the tip!

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2010, 7:23 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Perhaps when it sends the Degree char it also uses shift/ctrl to send it firing of the ^k hotkey? You do realise the example code includes the ! char e.g. alt might that not be the problem? (keeps alt down for one reason or another)? I dunno but if the problem is solved.... perhaps replacing Deg with a variable will do the trick as well?

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2010, 7:30 am 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
Replacing deg with a var? I don't know exactly what you mean in this case.

About the Alt key being the problem, you reminded me of an issue that happens since I use ahk, which is: when I use some commands with hotkeys using modifiers such as ^, ! and +, sometimes ahk acts like they (Alt, Ctrl and Shift keys) were still pressed. There may be something in common.

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2010, 7:47 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Did you try with the R option
Code:
:R:a1:: art. º

Quote:
R: Send the replacement text raw;

see http://www.autohotkey.com/docs/Hotstrings.htm#Options

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2010, 5:35 am 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
That's what I was missing. There have been two years since I don't touch the RAW option for hotstrings. Thanks for recalling to me.

But look, there is that "quick add hotstrings script for heavy hotstrings users" suggested inside ahk's official documentation, that, when you press Win+H in a selected text, it will prompt to add a new hotstring. By default, there is the R option. Just curious: why did that script's author choose to add the R option?

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2010, 7:55 pm 
Offline

Joined: February 19th, 2010, 8:07 pm
Posts: 615
probably to avoid sending hotkeys already setup by the user that he might not be aware of...

it is an interesting case nonetheless.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 24th, 2010, 12:03 am 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
"user that might be not ware of"? But the user of both codes is me! :D

_________________
AHK is perfect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 24th, 2010, 12:12 am 
Offline

Joined: February 19th, 2010, 8:07 pm
Posts: 615
what I meant is that the Author of that script is not aware of which hotkeys the user (in this case you) set up, so he uses the option :R: to prevent firing any of your hotkeys by mistake...

Unless the author is you I think that is the reason why he chose that option.
:D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 24th, 2010, 3:46 am 
Offline

Joined: December 6th, 2007, 12:48 pm
Posts: 364
Lol thanks! Yeah, living and learning: this is what this is all about. :D

_________________
AHK is perfect.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, MSN [Bot] and 16 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