HomeMicrosoft


Using AutoHotKey to get pushpin title in Streets & Trips
crazyst
Hi,

Well I'm caught between two worlds, LGW and AutoHotKey, so I thought I would post my question here.

I've figured out a very manual way to get the name of a pushpin in Microsoft Streets and Trips. (Ctrl+C with a regular expression to get the text. Not a good implementation since if there's other text besides the title it may not work... don't know)

Is there a way to grab the name of a pushpin by grabbing it's window title or something like that? I've tried to figure this out but I don't know the window title and using Window Spy hasn't helped me but it's because I'm inexperienced with it, not because it may not be there.

Thanks for any help,
Curt
MisterMoonlight
crazyst said:

Quote:
Is there a way to grab the name of a pushpin by grabbing it's window title or something like that
Yes i think there is a way but it will take you some programming to achieve this.

I have verified with autoit and autohotkey and it seems to be easier with autohotkey, the reason why is that the name can be more easily found with autohotkey. I don't know if you have some programming or autohotkey/autoit knowledge, but here what it looks like in autohotkey. I won't give you the code, but the idea instead (it is faster for me )

Let's say we want to grab all pushpins name.

1- You need a way to going from one pushpin to the other easily. In S&T, the <TAB> key allow to travel easily between pushpins. Just click in the map, then press the <TAB> key many times. You will notice that you will travel between pushpins one after the other and then loop around to the first pushpin once you traveled all the pushpins set.

2- You need a way to grab the information. Once you stop on one pushpin that you want to grab the pushpin name, do something like this:

a) press <F8> (or righ click show information). This will popoup the pushpin information balloon

b) Mouse right click, then <m> key (rename).

After this moment, the pushpin name is available for autohotkey script. You can verify this with autohotkey "active window info" tool. The pushpin name will be the first item in the ">>>>( TitleMatchMode=slow Visible Text )<<<<" zone.

c) you may use autohotkey function like "getwindowtext" (but make sure that "wintextmatchmode" is set to "complete") to get the pushpin name.

d) just press <ESC> key to abort pushpin rename operation


Important:
a) after looking at the receipe above, you will notice that when you travel from pushpin to pushpin, this takes into account that the pushpin text is hidden on every pushpin. If it is not the case, the <F8> key will hide it and you won't be able to attemp the rename operation on the pushpin name.

b) There is an easy way to hide all pushpins info before atempting to explore the pushpin names. Just navigate to the first pushpin with the <TAB> key then do mouse right click and press <a> key (hide all information). Then you will be sure that when you explore the pushpins with the <TAB> key, pressing <F8> will open the pushpins balloon and not closing it...

c) if you are automating this with autohotkey, you can use "mouseclick" function to simulate mouse and "send" key function to send application keys.

d) when you travel between pushpins with the <TAB> key, just take a copy of the first pushpin name, and compare the next pushpins for a match with the first pushpin name, and you will know that you travelled all pushpins when you returned to the first pushpin (with the same pushpin name).

I hope this help
crazyst
Thanks for the reply. I'm sorry that I didn't explain everything I have done to this point. I am using TAB to cycle through all the pushpins and I'm actually grabbing the name of the pushpin without opening the balloon which can be done by simply doing a Ctrl+C when I'm on the pushpin.

Now that gives some odd results if there's other information in the balloon but I'm only concerned with the name of the pushpin and nothing else. The name of the pushpin is separated from the rest of the pushpin info by whitespace or some illegal character so it's easy to use a regular expression to get just the name.

That's the manual way I've been doing it and it seems to be more reliable than popping up the info balloons which is giving me so-so results as it sometimes misses the text and then won't stop cycling through the pushpins.

I understand what you mean by getting it out of the window text so I'll take a look at that too. I was looking for a reliable quick way to do it but maybe I'm already doing that.

Thanks,
Curt
MisterMoonlight
crazyst said:

Quote:
I was looking for a reliable quick way to do it but maybe I'm already doing that.
It looks that you already found a quick way to do this. You can automate this process with autohotkey to issue a ctrl-c (using the send command) and grab the text from the clipboard. It would be a much simpler process than what i proposed above
crazyst
Ok thanks. That's what I'm currently doing but I wanted to check and see if there was an easier or more reliable way.

Thanks for chiming in and helping.

Curt
laptopgpsworld.com About