Google
  Web www.gpspassion.com


GpsPasSion LIVE!
www.flickr.com
This is a Flickr badge showing public photos from GpsPasSion Live !. Make your own badge here.

www.NaviBlog.com



Versions

Links/Liens




Portal/Portail
Rechercher

- -

Polls/Sondages
Sondage
Pour vous guider sur la Route :
GPS Mobile (SEM)
GPS Intégré
Smartphone
Autre
Voter  -  Résultat des votes
Votes : 2317




Club GpsPasSion
Soutenez le site!

USA: (US$)
EUROPE: (€)
Guide Paypal


GpsPasSion Forums
Home | Profile | Register/Enregist. | Active Topics | Search/Recherche | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 English Forums - Software
 MS Streets and Trips, AutoRoute, and MapPoint
 Tips & Tricks for MS Streets & Trips / AutoRoute
 New Topic  Reply/Répondre
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 10

TheBard

11 Posts

Posted - 24 févr. 2005 :  08:15:45  Show Profile  Reply with Quote
quote:
Originally posted by Marvin Hlavac

;-) I suspected “Lou” was either you or someone who read your message here.


No secrets here (Grin).


quote:

Since we have limited number of F-keys, do you know if it is possible to assign one F-key to do something e.g. within S&T, and then "re-use" the same F-key to do something else in another program?



Yes, it is possible. AutoHotKey can apparently detect what other programs are running, and what programs are in the foreground, and apply same or different hotkeys to the foreground program. My example below does not show that line of code, however.

I have both S&T5 and AutoHotKey listed in my Autostart menu, so they are activated when the laptop powers up. I could have coded AutoHotKey to send the GPS commands automatically, thus making the entire boot operation "hands-off", but remapping the F-keys is a good test to see if the GPS unit is talking to the computer.


======================================================================

; this is a very simple example of using AutoHotKey to remap some Streets & Trips 5
; keypresses to single Function key presses.
; =====================================================================

; don't allow any other instances of AutoHotKey to start
#SingleInstance ignore

; Display a message box, containing a reminder of all the remapped keys, for 10 seconds
MsgBox, 0,KeyPress Macros Loading,The following keys are remapped: `n F6 = Zoom Out `n F7 = Zoom In `n F8 = Keep Position Centered `n F9 = Track Position `n F10 = Toggle GPS Task Pane `n Alt-F11 = Shut Down `n`nF11 loads typical GPS usage: F8 F9 F10, 10

; Toggle GPS Task Pane with F10
*F10::
Send, {Control down}
Send,a
KeyWait, F10 ; Wait for the key to be released.
Send, {Control up}
return

;Track position - Alt TGT - remapped to F9
*F9::
Send, {Alt down}
Send,tgt
Send, {Alt up}
return

;Keep Position Centered = Alt TGK remapped to F8
*F8::
Send, {Alt down}
Send,tgk
Send, {Alt up}
return

;send all of above with single F11 keypress
*F11::
Send, {Control down}
Send,a
KeyWait, F11 ; Wait for the key to be released.
sleep,500 ; milliseconds
Send,{Control up}
Send,{Alt down}
Send,tgt; track position
Send,{Alt up}
sleep,500 ; milliseconds
Send,{Alt down}
Send,tgk; keep centered
Send,{Alt up}
return

;send numpad + zoom in, with F7
*F7::
Send, {NumpadAdd}
return

;send numpad - zoom out, with F6
*F6::
Send, {NumpadSub}
return

;send shutdown / poweroff to computer with Alt F11
*!F11::
Shutdown,9
return
Go to Top of Page

Marvin Hlavac

Canada
6904 Posts

Posted - 25 févr. 2005 :  02:54:27  Show Profile  Visit Marvin Hlavac's Homepage  Reply with Quote
TheBard,

Thanks, I'll give it a try. It likely is not as complicated as it appears at the first sight.

Just a slight improvement I'd suggest. I just noticed how you handle zooming. Perhaps instead of (+) or (-) you could use Alt VZI to zoom in, and ALT VZO to zoom out. That way the zoom function will not be dependant on the map being in focus.



Marvin Hlavac - Toronto, Canada
Go to Top of Page

TheBard

11 Posts

Posted - 25 févr. 2005 :  05:19:18  Show Profile  Reply with Quote
Good point, thanks!
Go to Top of Page

Marvin Hlavac

Canada
6904 Posts

Posted - 25 févr. 2005 :  11:54:11  Show Profile  Visit Marvin Hlavac's Homepage  Reply with Quote
TheBard,

I think I'm starting to change my mind about this AutoHotkey program ;-)

At first I didn't like it for the reason that an average user of Streets & Trips will likely not want to go thru the process of learning how to create scripts. But I just realized they don't have to, we can all do it right here for them! And when it is all done and tested, and when (if) it works to our satisfaction, we can let others download our script file. So, if all goes well it would be a simple process:

1. Click here to download (free) AutoHotkeys,
2. Click here to download our script,
3. Click here to print your new S&T keyboard shortcuts (keep it in your car),
4. Enjoy ;-)

I'm just reading the manual... Let's find out if it is possible to really make S&T shortcuts not affect other applications.

Marvin Hlavac - Toronto, Canada
Go to Top of Page

Marvin Hlavac

Canada
6904 Posts

Posted - 25 févr. 2005 :  17:59:28  Show Profile  Visit Marvin Hlavac's Homepage  Reply with Quote
SetTitleMatchMode, 2

*F7::
IfWinActive, Microsoft Streets & Trips
{
Send,{Alt}
Send,vzi
return
}


IfWinActive, iGuidance
{
Send,{Alt}
Send,vz
return
}


It does look like it is possible to use the same F-key to do different things with different applications. We cannot really specify a "Program", but we can specify window(s) properties by which AutoHotkeys knows which of our applications to control.

In the above example F7 will ZOOM-IN either MS Streets & Trips, or my other favourite navigation program iGuidance, depending on which one is active. It's just an example to illustrate one possible way to achieve it.

Marvin Hlavac - Toronto, Canada

Edited by - Marvin Hlavac on 25 févr. 2005 18:46:13
Go to Top of Page

TheBard

11 Posts

Posted - 25 févr. 2005 :  18:53:38  Show Profile  Reply with Quote
Marvin -

Yes - you got it!
(and you used more elegant coding syntax than did I)

Since there is a finite (and fairly small) number of keyboard shortcuts for S&T (or any other program), building a script employing the most useful macros shouldn't be too difficult.
Go to Top of Page

Marvin Hlavac

Canada
6904 Posts

Posted - 25 févr. 2005 :  21:16:05  Show Profile  Visit Marvin Hlavac's Homepage  Reply with Quote
Okay, here it is...
Free Single-Key Shortcuts configured for S&T


F2 - Start (or activate) S&T
F3 - Track position
F4 - Keep position Centred
F5 - Rotate Map
F6 - Recalculate Route
F7 - Route Planner (on/off)
F8 - Find Nearby Places
F9 - Clear Route
F10 - Zoom-out
F11 - Zoom-in

1. Download free AutoHotkey >>here<< and install it,

2. Save pre-configured >>AutoHotkey.ini<< file in C:\Program Files\AutoHotkey

3. Restart AutoHotkeys and enjoy your new single-key shortcuts.

Optional:

4. You may want to print >>this<< to keep in your car.

5. Place a shortcut to AutoHotkeys to the Windows startup folder.


See page 1 of this thread (tip #3) for the most recent and improved solution.

Marvin Hlavac - Toronto, Canada

Edited by - Marvin Hlavac on 28 févr. 2005 23:01:50
Go to Top of Page

TheBard

11 Posts

Posted - 25 févr. 2005 :  23:12:46  Show Profile  Reply with Quote
Marvin -

Works well on my desktop (I haven't tried it with the laptop on the road yet, but expect no problems).

Suggestions:

1. Place the IfWinActive, Microsoft Streets & Trips statement just under SetTitleMatchMode, 2, and place the closing bracket at the bottom of the script. That will make the script smaller by eliminating the redundant IF statements.
(You can still run your alternate GPS software by placing another IF statement in the same script)

2. If you want to display a quick reminder of the active hot keys, use the MsgBox statement, with the text string on one line (the example I gave above wordwrapped, and will render the statement invalid)
Go to Top of Page

Marvin Hlavac

Canada
6904 Posts

Posted - 26 févr. 2005 :  13:04:13  Show Profile  Visit Marvin Hlavac's Homepage  Reply with Quote
When I tried to move the IfWinActive, Microsoft Streets & Trips statement up there, it stops working as intended. I may be doing something wrong. If it works for you that way, could you please either e-mail the whole .ini or post a sample with one or two hotkeys here.

Marvin Hlavac - Toronto, Canada
Go to Top of Page

Marvin Hlavac

Canada
6904 Posts

Posted - 26 févr. 2005 :  23:22:47  Show Profile  Visit Marvin Hlavac's Homepage  Reply with Quote
;-) I just discovered a better way of doing things!!! Check this out!!!

SetTitleMatchMode, 2

$F5::
IfWinNotActive, Microsoft Streets & Trips
{
Send, {F5}
return
}
Send,{Alt}
Send,vzo
return


This is cool. What it does is this: If S&T is active, our custom shortcuts work the way we design them. If however S&T is not active the F-keys (or other shortcuts) have their function unchanged! So, for example in the above example, if you hit F5 when S&T is active on your desktop, it will zoom-out. However, when S&T is not active, F5 function will do what it is supposed to do, which is "Refresh". I don't think I was able to do this in QuicKeys. I would have to exit QuicKeys (as far as I know) to regain the original function of keys that I remapped. Long live (free) AutoHotkeys ;-)

Tomorrow I will redo the whole .ini file and post it to the same link provided earlier.

Marvin Hlavac - Toronto, Canada
Go to Top of Page

TheBard

11 Posts

Posted - 27 févr. 2005 :  03:44:26  Show Profile  Reply with Quote
AHA!

It seems AutoHotKeys does not have an explicit ELSE statement, but you found a workaround! Using the NOT is interesting!

Very good!

(Ignore my earlier email ... it contains some partial fixes, but not as complete as your solution, above)



Go to Top of Page

Marvin Hlavac

Canada
6904 Posts

Posted - 27 févr. 2005 :  04:13:38  Show Profile  Visit Marvin Hlavac's Homepage  Reply with Quote
TheBard, I just posted the newest creation of the configuration file... Have a look and let me know if something could be improved. Now I eliminated QuicKeys from Tips & Tricks... Look at tip #3...

Marvin Hlavac - Toronto, Canada
Go to Top of Page

Marvin Hlavac

Canada
6904 Posts

Posted - 27 févr. 2005 :  21:44:12  Show Profile  Visit Marvin Hlavac's Homepage  Reply with Quote
One last piece of script added:

; Start or activate Streets & Trips
$F2::
IfWinExist, Microsoft Streets & Trips
{
WinActivate
return
}
Run, %ProgramFiles%\Microsoft Streets and Trips\Streets.exe
Return


It does this:

• it will start S&T,
• or S&T will be activated if it is running in the background.

If more than one instance of S&T is running in the background, the one which was active the last will now show up on your desktop.


Marvin Hlavac - Toronto, Canada
Go to Top of Page

TheBard

11 Posts

Posted - 28 févr. 2005 :  00:44:13  Show Profile  Reply with Quote
Looks good!

I'm still searching for a workaround to reduce or eliminate the apparently redundant lines, but to no avail.

Oh ... don't forget, you can compile the script if the file extension is ".ahk". The compiled script does NOT require AutoHotKey to be present on the computer, and usually requires less memory to run than does AutoHotKey. The compiled script has <filename>.exe, where <filename> is the name of the .ahk text script.
(This is useful for low-memory, low-power laptops)
Go to Top of Page

Marvin Hlavac

Canada
6904 Posts

Posted - 28 févr. 2005 :  01:34:52  Show Profile  Visit Marvin Hlavac's Homepage  Reply with Quote
Thanks, TheBard. I should look into the ".ahk" idea. It would definitely simplify redistribution of this ;-) will the performance remain pretty much the same?

Marvin Hlavac - Toronto, Canada
Go to Top of Page
Page: of 10 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Reply/Répondre
 Printer Friendly
Jump To:
GpsPasSion Forums © 2002-2014_GpsPasSion/Manzanite Go To Top Of Page
This page was generated in 1,09 seconds. Powered By: Snitz Forums 2000 Version 3.4.05