AutoHotkey Community

It is currently May 27th, 2012, 10:58 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 171 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 12  Next
Author Message
 Post subject:
PostPosted: December 3rd, 2011, 6:02 pm 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
azure wrote:
Anonymous wrote:
Type a letter e.g. not a space, tab or enter (which is what \s means) before typing numbers again. This hotstrings should be changed to allow certain keys as endchar/stop char so when you move/click your mouse, or use arrow keys, alt-tab etc it will 'reset'. No idea how to do that I've haven't studied the script in detail.


interesting approach

however I though I could overcome the problem of the script calculating numbers I typed previously in general and not the numbers I typed lately, which are the numbers I want to be replaced, with this workaround:

it would be best to make the script perform a ctrl+shift+left from the point of the IBeam cursor and replace those selected numbers with the relevant calculated hotstring (I always use that calculator hotstring in numbers, so there will never be a space among them, which would make some of the numbers not to be "catched" by that ctrl+shift+left method)

or maybe the string would perform a ControlGetText and use these numbers to perform the calculation

either way would solve the problem, can anyone help implement these two ways?

thanks!


can anyone do this??


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2011, 10:08 am 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
can anyone tell me how to make these hotstrings to work in specific windows and/or controls?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2011, 7:40 pm 
Offline

Joined: July 20th, 2009, 6:01 am
Posts: 166
Location: Amsterdam
You can do it like this for different windows:
Code:
SetTitleMatchMode, 2
hotstrings("(search)", "LabelToBeExecuted")
Return

LabelToBeExecuted:
Output := $1
Ifwinactive, Firefox
Send modified %Output%
Else
Send %Output%
Return


You can use ControlGet with specific controls.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2011, 7:47 pm 
Offline

Joined: July 20th, 2009, 6:01 am
Posts: 166
Location: Amsterdam
I have another question. I can't seem to get this beautiful function to work with the character < (angled bracket). The following should work but doesn't work:

Code:
hotstrings("<", "boo")


I tried escaping the bracket with \, but that doesn't help. If I use any other character instead of <, the code works fine. What is this? Am I forgetting something obvious?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2011, 7:50 pm 
It would be more elegant (and flexible) if the hotstrings function accepted a third parameter for the IfWinActive option. As you can see there are two "Hotkey"s adding "Hotkey, IfWinActive/Exist, 3rd paramenter" above those loops might be worth exploring
Code:
Hotkey, %m%%c%, __hs
; ...
Hotkey, %m%%A_LoopField%, __hs

So your code example would become
Code:
hotstrings("(search)", "LabelToBeExecuted","Firefox")

Don't know if it would work though as I haven't tried it.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2011, 7:55 pm 
Cerberus wrote:
Code:
hotstrings("<", "boo")

Edit the line that says
Code:
If A_Index not between 33 and 58
and chance 58 to 60. The ascii value of < is 60 so it currently doesn't include that character. Tested.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 7th, 2011, 5:35 am 
Offline

Joined: July 20th, 2009, 6:01 am
Posts: 166
Location: Amsterdam
Hey Guest, thank you! I tried that, and at first it seemed to work, at least I was able to use the < character a few times. All I changed was the number from 58 to 60.

But when I tried adding to this (I was looking for something like "map<*.> test"), it stopped working.

On my other computer, it doesn't work either (exact same text tile synchronized through Dropbox), and now certain keys don't work any more: I can't type < or > or ? at all on the PC if < is in the Hotstrings function! When I remove it and reload, the keys work as normal again. This is so strange: it doesn't work on two computers, but the kind problem is different. Is there anything more I can try before giving up on this function? I already tried closing all my other AHK scripts, didn't help.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 7th, 2011, 10:46 am 
You can change 60 to 64 as well to take into account some more chars, but to fix your problem you'll have to be more explicit in your RE for example
Code:
hotstrings("<\.", "boo")
now you will have to type < followed by a . to get boo. If you type a single < nothing will happen. You can also put a condition BEFORE the < to make it even more explicit, you'll have to fiddle around with it for a bit.
One more tip: in the script(s) you use hotstrings with always add
Code:
#SingleInstance, force
at the top of your script, I find it helps while testing. You'll note that in hotstrings SendInput is used, you could replace that with a regular SEND so you can easily test various
SendMode wrote:
Makes Send synonymous with SendInput or SendPlay rather than the default (SendEvent). Also makes Click and MouseMove/Click/Drag use the specified method.
Source: http://www.autohotkey.com/docs/commands/SendMode.htm
in your script to see what works best. Note if you have Win7 and you want to use SendPlay read this http://www.autohotkey.com/wiki/index.ph ... leshooting and follow the two SendPlay links you'll see there.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 23rd, 2011, 10:00 am 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
hello!

can anyone tell me how to make this script work in a window with specific class and inside a specific control?

Code:
#SingleInstance, force
#Include Hotstrings.ahk

hotstrings("(\d+)(\d)\s","result1")
Return

result1:
SendInput, % Round($1*10**$2/1.1)
Return


thanks!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 23rd, 2011, 10:19 am 
Modify hotstrings as described above by applying the Hotkey, IfWinActive/Exist option, http://www.autohotkey.com/docs/commands/Hotkey.htm


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 27th, 2011, 10:34 am 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
I made it:

Code:
#SingleInstance, force
#Include Hotstrings.ahk

hotstrings("(\d+)(\d)\s","result1", "Wintitle ahk_class class")
Return

result1:
SendInput, % Round($1*10**$2/1.1)
Return


and it says "too many parameters"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 27th, 2011, 10:43 am 
You need to modify hotstrings.ahk first.
Read http://www.autohotkey.com/docs/commands/Hotkey.htm and look at the last example on the page (earlier on the page are similar examples) For both Hotkey commands in hotstrings.ahk you need to insert a line above and below using the third parameter.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 27th, 2011, 1:30 pm 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
Anonymous wrote:
You need to modify hotstrings.ahk first.
Read http://www.autohotkey.com/docs/commands/Hotkey.htm and look at the last example on the page (earlier on the page are similar examples) For both Hotkey commands in hotstrings.ahk you need to insert a line above and below using the third parameter.


all I have to do is to insert these lines:
Hotkey, %m%%c%, __hs
Hotkey, %m%%A_LoopField%, __hs
in the begining and the end of the Hotstring.ahk, but where exactly?

however, with this method, I will have to use multiple Hostring.ahk files, to use multiple hotstrings per window, right?

I used Cerberus' method and I wrote this:
Code:
hotstrings("(\d+)(\d)\s","result1")
Return

result1:
Ifwinactive, WinTitle ahk_class WinClass
SendInput, % Round($1*10**$2/1.1)
Else
Return

it works well, but the problem is that in other that the wanted window, I dont want the script to replace the typed text with the typed text, I just want it not to work at all


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 27th, 2011, 1:54 pm 
Reading isn't one of your qualities, so I quote myself:
Anonymous wrote:
It would be more elegant (and flexible) if the hotstrings function accepted a third parameter for the IfWinActive option. As you can see there are two "Hotkey"s adding "Hotkey, IfWinActive/Exist, 3rd paramenter" above those loops might be worth exploring
Code:
Hotkey, %m%%c%, __hs
; ...
Hotkey, %m%%A_LoopField%, __hs

So your code example would become
Code:
hotstrings("(search)", "LabelToBeExecuted","Firefox")

Don't know if it would work though as I haven't tried it.

of course be sure to put something below the these hotkeys as well to turn of the "context sensitive" part.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 27th, 2011, 4:11 pm 
Offline

Joined: August 7th, 2011, 1:23 pm
Posts: 754
I have just downloaded the hostrings.ahk and I've found an Issue. I've read all the seven pages of this thread but I've found nobody else reporting this.
Seems that backtick and tilde ( since they're not present in my italian keyboard ) generate an error in the first loop
Quote:
line : 29
instruction : Hotkey, %m%%c%, __hs
error : "`" is not a valid key name
error : "~" is not a valid key name

As a workaround I've prepended this line with the try command which avoid the error blocking the load of the code and all worked as supposed to. I just would know if there's a better way to get rid of this problem without modifiyng the original script.

Thanks in advance.
P.S: the hostrings.ahk version is 2.56

_________________
Win7 - Firefox 10.0.2 - AHK_L 1.1.07.00
Please bear with me and my English which is so bad at times that even I don't understand myself


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 171 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 12  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 54 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