sedgett Posted May 23, 2006 Posted May 23, 2006 Anyone had any luck in scripting Garmin Nroute?cross posted to mp3car forums - http://www.mp3car.com/vbulletin/showthread.php?p=824488I 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/58238S.
herewasplato Posted May 25, 2006 Posted May 25, 2006 (edited) 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 May 25, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
sedgett Posted May 25, 2006 Author Posted May 25, 2006 herewasplato said: 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 0EndFunc
herewasplato Posted May 25, 2006 Posted May 25, 2006 sedgett said: Thanks for the comments.I managed to get it working,...Great!Enjoy AutoIt and the forums... [size="1"][font="Arial"].[u].[/u][/font][/size]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now