Jump to content

Scripting Garmin Nroute


Recommended Posts

Anyone had any luck in scripting Garmin Nroute?

cross posted to mp3car forums - http://www.mp3car.com/vbulletin/showthread.php?p=824488

I have a keypad controlled carputer that mostly works with an old version of girder. I have been in the process of redoing it using autoit. Works well for most of the scripting but having troubles with Nroute using "route to address".

I'm using an AutoIt gui to prompt for an address and the call a function that is supposed to setup Nroute to route to an address. (I use Send("!RA") to route to an address)

The problem is in scripting the Street Name selection. Nroute appears to be doining something unique in manipulating the Editbox and the Listbox.

I've tried simply using Send($streetname&"{ENTER}) as well as several more complex variations with ControlSetText, Send, MoveMouse/MouseClick, etc...

None of them seem to enable nroute to actually pickup the Street Name I'm sending. The Send will popluate the Edit control, but there is something happening behind the scene with the Edit control modifiying the ListBox.

Anyone have a working example?

My latest attempt is at http://pastebin.ca/58238

S.

Link to comment
Share on other sites

Welcome to the AutoIt forums.

Sorry that no one seems to know how to help you so far. I've never seen the Nroute software and I see nothing wrong with your code.... so, I'll:

... ask some questions

... take a guess or two and at the very least

... bump this query up in the queue.

First, what version of Nroute are you using (in case it matters to others in this forum)?

What version of AutoIt are you using? Try the beta version:

http://www.autoitscript.com/autoit3/files/beta/autoit/

Total guess here: does the Nroute software attempt to resolve the street as a human types info in? If yes, then I wonder if AutoIt might be sending the info too fast. Might that cause Nroute problems?

Please post your entire script so we can see any "Opt" settings - like for SendKeyDelay...

...and/or try replacing that problem line:

Send($streetname&"{ENTER})

with several test lines like:

Send("s")

Sleep(500)

Send("t")

Sleep(500)

Send("r")

Sleep(500)

...

(Just guessing here - maybe you have already tried that.)

In case you have not tried this - a search of that other forum that you mentioned located some other AutoIt users - any luck with private mails to them? [bTW and as a warning to others in this forum, some of the avatars in that other forum might not be okay in an office setting.]

Oh, did I mention that I was guessing............

Edit: Further searches of that forum show quite a few posts that mention AutoIt. Interesting reading.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Send($streetname&"{ENTER})

with several test lines like:

Send("s")

Sleep(500)

Send("t")

Sleep(500)

Send("r")

Sleep(500)

...

Thanks for the comments.

I managed to get it working, and it did turn out to be a timing issue. The application was attempting to change a listbox control as each character was typed. As you suggested, I sent each character and then paused .5s and low and behold it started working. After testing, I determined I could send it all at once if I waited a second afterwards. I also changed the control references from the number version to the classNN and that seems easier. The working code is as follows:

Func nroute_route_address($numeric, $alpha, $city, $prov)

Send("!RA")

WinActivate("Find Places")

ControlClick("Find Places","","Button3")

Sleep(200)

ControlFocus("","","Edit1")

Send($numeric)

ControlFocus("","","Edit2")

Send($city)

Sleep(500)

Send("{TAB}")

Send($prov)

Sleep(500)

Send("{TAB}")

ControlClick("","","Button1")

WinWait("Select Street")

ControlSetText("","","Edit2","1")

ControlFocus("","","Edit1")

Send($alpha)

Sleep(1000)

Send("{ENTER}")

Sleep(200)

ControlClick("","","Button2")

For $i = 1 to 5

Sleep(500)

if(ControlCommand ("Find Places", "", "Button20", "IsEnabled", "")) Then

$selected = ControlListView ("","","SysListView321","GetText",ControlListView ("","","SysListView321","GetSelected"))

OSD($selected,2000)

ControlClick("Find Places","","Button20")

Return 1

EndIf

Next

MsgBox(48,"No Address Found!", "No Address Found!", 2)

ControlClick("","","Button21")

Return 0

EndFunc

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...