Jump to content

Maps.google.com Help


Recommended Posts

Im making a script to make life easier searching for address , which i have to do quite often.

Here is my code

whats going on is you put in an address and hit submit but when the website loads all it puts in the search box is the number 5 no matter what you put in the textfield.

if i take out the $addr and replace with "addresshere" it works fine.

also one more problem. if you search for an address then close the browser and then search for another one it crashes.

any idea?

#include <ie.au3>
#include <GUIConstants.au3>

;User var's
Dim $oIE
$URL = "maps.google.com"

; == GUI generated with Koda ==
$Form1 = GUICreate("Google Maps Lookup", 510, 126, 192, 125)
GUICtrlCreateLabel("Google Maps Lookup", 144, 8, 182, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
GUICtrlCreateLabel("Address:", 192, 48, 53, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$addr = GUICtrlCreateInput("Enter Address and Zip Code", 64, 69, 377, 21)
$submit = GUICtrlCreateButton("Submit", 184, 96, 75, 25, 0)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $submit
;Browse to website in $url
        _IEAttach ($oIE)
        If Not IsObj($oIE) Then
            $oIE = _IECreate ()
            _IENavigate ($oIE, $URL)
        EndIf

        $oForm = _IEFormGetObjByIndex($oIE, 0)
        $oAddr = _IEFormElementGetObjByIndex($oForm, 5)
        $oButton = _IEFormElementGetObjByIndex($oForm, 6)
        _IEFormElementSetValue($oAddr, $addr)
        $oButton.Click
    Case Else
;;;;;;;
    EndSelect
WEnd
Exit
Edited by anyday
Link to comment
Share on other sites

While this doesnt solve your IE.au3 problem... I thought of a much simpler way to accomplish this:

$start = InputBox("Starting Address","Enter your starting address:")
$end = InputBox("Ending Address","Enter your ending address:")
$url = "http://maps.google.com/maps?f=d&hl=en&saddr="&StringReplace($start," ","+")&"&daddr="&StringReplace($end," ","+")
RunWait("rundll32.exe url.dll,FileProtocolHandler " & $url, @WorkingDir)

5 lines of code (could be 4 if I calculated the URL inside the RunWait) :think:

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

  • Moderators

Try this:

#include <IE.au3>
#include <GUIConstants.au3>

Opt("GuiOnEventMode", 1)

;User var's
$sUrl = "maps.google.com"

; == GUI generated with Koda ==
$Form1 = GUICreate("Google Maps Lookup", 510, 126, 192, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Close")

GUICtrlCreateLabel("Google Maps Lookup", 144, 8, 182, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
GUICtrlCreateLabel("Address:", 192, 48, 53, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$addr = GUICtrlCreateInput("Enter Address and Zip Code", 64, 69, 377, 21)
$submit = GUICtrlCreateButton("Submit", 184, 96, 75, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent(-1, "Submit")
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
GUISetState(@SW_SHOW)


While 1
    Sleep(100)
WEnd

Func Submit()
;Browse to website in $url
    $oIE = _IEAttach ($sUrl, "url")
    If Not IsObj($oIE) Then
        $oIE = _IECreate ()
        _IENavigate ($oIE, $sUrl)
    EndIf
    $oForm = _IEFormGetObjByIndex ($oIE, 0)
    $oAddr = _IEFormElementGetObjByIndex ($oForm, 5)
    $oButton = _IEFormElementGetObjByIndex ($oForm, 6)
    _IEFormElementSetValue ($oAddr, GUICtrlRead($addr))
    $oButton.Click
EndFunc ;==>Submit

Func GUI_Close()
    Exit
EndFunc ;==>GUI_Close
Edited by big_daddy
Link to comment
Share on other sites

While this doesnt solve your IE.au3 problem... I thought of a much simpler way to accomplish this:

$start = InputBox("Starting Address","Enter your starting address:")
$end = InputBox("Ending Address","Enter your ending address:")
$url = "http://maps.google.com/maps?f=d&hl=en&saddr="&StringReplace($start," ","+")&"&daddr="&StringReplace($end," ","+")
RunWait("rundll32.exe url.dll,FileProtocolHandler " & $url, @WorkingDir)
I apologize for the n00b question, but can you explain the RunWait line in the code above? I'm new to scripting at all and just trying to understand what everything does. Thanks for any and all help!

EDIT: Not acutally what the RunWait command does, but what your specfic example does. Thanks.

Justin

Edited by J_Kay
Link to comment
Share on other sites

Well, there are a lot of ways to open the default browser to a webaddress... but I chose the:

RunWait("rundll32.exe url.dll,FileProtocolHandler " & $url, @WorkingDir)

Method because it can allow '&' symbols in its url, which is what we need.

It could of also been,

RunWait("C:\Program Files\Internet Explorer\ie.exe " & $url)

But that would of been browser specific.

You see what the script does, right? Takes both addresses, replaces all spaces with + symbols and puts them in the format of the URL for a map search.

Edited by Simucal
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

works great big daddy, thanks for the help, also thanks simucal for the help also , i dont need the script to give me directions just display a map of it.

one question i had, wonder if its possible to make the gui bigger and have the map displayed right in the gui? kinda like with ie-builder script have IE window in the gui?

Link to comment
Share on other sites

If you just want to go to a single address then:

$address = InputBox("Address","Enter your address you wish to map:")
$url = "http://maps.google.com/maps?q="&StringReplace($address," ","+")&"&om=1"
RunWait("rundll32.exe url.dll,FileProtocolHandler " & $url, @WorkingDir)

Honestly, Unless you are doing any further manipulation with the google maps website, IE.au3 is overkill for this.

As far as embedding the actual javascript map object that google uses in a AutoIt script.. I would look at the project:

http://stuff.rancidbacon.com/gmaps-standalone/

Or, you could embed IE into a GUI form, although it would have the entire search website, not just the map.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

Ok, here it is:

$address = InputBox("Address","Enter your street address you wish to map:","2142 farnsworth dr")
$city = InputBox("City","Enter your city:","o fallon")
$state = InputBox("State", "Enter your two-letter state code:","mo")
$zip = InputBox("Zip", "Enter your zip-code","63368-7152")

$url = "http://www.mapquest.com/maps/map.adp?cat=fire&formtype=address&addtohistory=&address="&StringReplace($address," ","%20")&"&city="&StringReplace($city," ","%20")&"&state="&$state&"&zipcode="&StringReplace($zip,"-","%2d")&"&country=US&geodiff=1"
RunWait("rundll32.exe url.dll,FileProtocolHandler " & $url, @WorkingDir)

The default values I have listed there will take you to a map of my old house :think:.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

thanks,

one of my value for state is a Combo box, how would i put guiCtrlRead into that sytax for state value?

n/m i figured it out thanks :think:

$url = "http://www.mapquest.com/maps/map.adp?cat=fire&formtype=address&addtohistory=&address="&StringReplace(GUICtrlRead($addr)," ", "%20")&"&city="&StringReplace(GUICtrlRead($city), " ", "%20")&"&state="&(GUICtrlRead($state))&"&zipcode="&StringReplace(GUICtrlRead($zip),"-","%2d")&"&country=US&geodiff=1"
Edited by anyday
Link to comment
Share on other sites

is there anyway to split the address up. lets say the $addr variable is set to 3333 Main St

is there a way i can split that into 2 var's

like $box = 3333

and $street = main st

?

and sometimes the box could be 5 char's long

Edit:

Lol n/m i figured this out also

$addr2 = StringSplit(GUICtrlRead($addr), " ")
Edited by anyday
Link to comment
Share on other sites

Feels good to figure stuff out on your own, eh?

Let me know how your map stuff works out for you.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

im using the following to add IE to my gui

$AObj1 = ObjCreate("Shell.Explorer.2")
$AObj1_ctrl = GUICtrlCreateObj($AObj1, 16, 312, 1074, 556)

then im using the following to browse to a website

Func Submit()
    $url3 = "http://maps.google.com/maps?q="&StringReplace(GUICtrlRead($addr), " ", "+")&" "&StringReplace(GUICtrlRead($zip), " ", "+")&"&om=1"
    $Aobj1.navigate ($url3)
EndFunc;==>Submit

but this code doesnt do anything.

any ideas?

Edited by anyday
Link to comment
Share on other sites

on my

$addr2 = StringSplit(GUICtrlRead($addr), " ")

it comes to a problem if there are more spaces in the address

like 60 center oak dr

returns 60 center with $addr2[1] $addr2[2]

any ideas of a better way

Link to comment
Share on other sites

on my

$addr2 = StringSplit(GUICtrlRead($addr), " ")

it comes to a problem if there are more spaces in the address

like 60 center oak dr

returns 60 center with $addr2[1] $addr2[2]

any ideas of a better way

Have the user seperate each part of the address by a comma. Then Stringsplit with "," set as the delimiter.

(e.g., 2142 farnsworth dr, ofallon, mo, 63366)

EDIT: But if you are doing this for google maps then you dont need to do any of this. Google Maps will accept the whole address commas and all, with the example I gave you earlier:

$address = InputBox("Address","Enter your whole address here:","2142 farnsworth dr, ofallon mo, 63366")
$url = "http://maps.google.com/maps?q="&StringReplace($address," ","+")&"&om=1"

If you told me exactly what you were trying to do, I could whip something up as an example for you.

Edited by Simucal
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

well its a script to help some agents with there job here is what i have so far

#include <GUIConstants.au3>
#include <Array.au3>
#include <ie.au3>
Opt("GuiOnEventMode", 1)

; User Var's
$gURL = "maps.google.com"                               ; Google Maps URL
$tURL = "www.assessor.shelby.tn.us/content.aspx"        ; Shelby Country Tax Assessor
Dim $label

; == GUI generated with Koda ==
$shelby = GUICreate("TN Home Helper", 1104, 883, 85, 40)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Close")

GUICtrlCreateLabel("Shelby County Address Help", 176, 8, 236, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
GUICtrlCreateLabel("Box:", 16, 40, 29, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$box = GUICtrlCreateInput("", 168, 38, 65, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Street:", 16, 64, 53, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$addr = GUICtrlCreateInput("", 168, 61, 137, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("City:", 16, 88, 31, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$city = GUICtrlCreateInput("", 168, 84, 121, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Zip:", 17, 112, 26, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$zip = GUICtrlCreateInput("", 168, 107, 81, 21, -1, $WS_EX_CLIENTEDGE)
$state = GUICtrlCreateCombo("", 168, 129, 145, 21)
GUICtrlSetData(-1, "TN|MS")
GUICtrlCreateLabel("State:", 17, 136, 36, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
GUICtrlCreateLabel("County:", 16, 160, 47, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$county = GUICtrlCreateCombo("", 168, 152, 145, 21)
GUICtrlSetData(-1, "Shelby|Fayette|Desoto|Marshall")
GUICtrlCreateLabel("Search Google Maps:", 48, 208, 120, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$googlesubmit = GUICtrlCreateButton("Submit", 248, 202, 75, 25)
GUICtrlSetOnEvent(-1, "Submit")
GUICtrlCreateLabel("Search Closest Fire Dept:", 48, 240, 145, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$firesubmit = GUICtrlCreateButton("Submit", 248, 235, 75, 25)
GUICtrlSetOnEvent(-1, "SubmitFire")
GUICtrlCreateLabel("Search Tax Assessor:", 48, 272, 124, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
$taxsubmit = GUICtrlCreateButton("Submit", 248, 265, 75, 25)
GUICtrlSetOnEvent(-1, "TaxSubmit")
$AObj1 = ObjCreate("Shell.Explorer.2")
$AObj1_ctrl = GUICtrlCreateObj($AObj1, 16, 312, 1074, 556)
GUICtrlCreateLabel("TN Territorial Zone:", 408, 64, 118, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
$Aobj1.navigate('www.google.com')

While 1
    Sleep (1001)
Select
    Case (GUICtrlRead($zip)) = 38103 
        $label = "34"
    Case (GUICtrlRead($zip)) = 38105
        $label = "34"
    Case (GUICtrlRead($zip)) = 38106
        $label = "34"
    Case (GUICtrlRead($zip)) = 38107
        $label = "34"
    Case (GUICtrlRead($zip)) = 38108
        $label = "34"
    Case (GUICtrlRead($zip)) = 38109
        $label = "34"
    Case (GUICtrlRead($zip)) = 38111
        $label = "34"
    Case (GUICtrlRead($zip)) = 38113
        $label = "34"
    Case (GUICtrlRead($zip)) = 38114
        $label = "34"
    Case (GUICtrlRead($zip)) = 38116
        $label = "34"
    Case (GUICtrlRead($zip)) = 38118
        $label = "34"
    Case (GUICtrlRead($zip)) = 38127
        $label = "34"
    Case (GUICtrlRead($zip)) = 38128
        $label = "34"
    Case (GUICtrlRead($zip)) = 38131
        $label = "34"
    Case (GUICtrlRead($zip)) = 38132
        $label = "34"
    Case (GUICtrlRead($zip)) = 38104
        $label = "31"
    Case (GUICtrlRead($zip)) = 38112
        $label = "31"
    Case (GUICtrlRead($zip)) = 38122
        $label = "31"
    Case (GUICtrlRead($zip)) = 38126
        $label = "31"
    Case (GUICtrlRead($zip)) = 38117
        $label = "29"
    Case (GUICtrlRead($zip)) = 38115
        $label = "29"
    Case (GUICtrlRead($zip)) = 38119
        $label = "29"
    Case (GUICtrlRead($zip)) = 38120
        $label = "29"
    Case (GUICtrlRead($zip)) = 38125
        $label = "29"
    Case (GUICtrlRead($zip)) = 38133
        $label = "29"
    Case (GUICtrlRead($zip)) = 38134
        $label = "29"
    Case (GUICtrlRead($zip)) = 38135
        $label = "29"
    Case (GUICtrlRead($zip)) = 38137
        $label = "29"
    Case (GUICtrlRead($zip)) = 38138
        $label = "29"
    Case (GUICtrlRead($zip)) = 38139
        $label = "29"
    Case (GUICtrlRead($zip)) = 38141
        $label = "29"
    Case (GUICtrlRead($zip)) = 38157
        $label = "29"
EndSelect
    
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
GUICtrlCreateLabel($label, 544, 64, 15, 15)
WEnd



Func Submit()
    $url3 = "http://maps.google.com/maps?q="&StringReplace(GUICtrlRead($addr), " ", "+")&" "&StringReplace(GUICtrlRead($zip), " ", "+")&"&om=1"
;RunWait("rundll32.exe url.dll,FileProtocolHandler " & $url3, @WorkingDir)
    $Aobj1.navigate ($url3)
    
EndFunc;==>Submit

Func SubmitFire()
    $url = "http://www.mapquest.com/maps/map.adp?cat=fire&formtype=address&addtohistory=&address="&StringReplace(GUICtrlRead($addr)," ", "%20")&"&city="&StringReplace(GUICtrlRead($city), " ", "%20")&"&state="&(GUICtrlRead($state))&"&zipcode="&StringReplace(GUICtrlRead($zip),"-","%2d")&"&country=US&geodiff=1"
    $aobj1.navigate ($url)
;RunWait("rundll32.exe url.dll,FileProtocolHandler " & $url, @WorkingDir)
EndFunc

Func TaxSubmit()
    $addr2 = StringSplit(GUICtrlRead($addr), " ")
    Select
        Case (GUICtrlRead($county)) = "Shelby"
            $url2 = "http://www.assessor.shelby.tn.us/PropertySearch.aspx?StreetNumber="&(GUICtrlRead($box))&"&StreetName="&(GUICtrlRead($addr))&"&FirstName=&LastName=&ParcelID=&Business="
            $Aobj1.navigate ($url2)
        Case (GUICtrlRead($county)) = "Fayette"
            $Aobj1.navigate ("http://170.142.31.248/SelectCounty.asp?map=true&SelectCounty=024")
            _IELoadWait($Aobj1)
            $oform = $Aobj1.document.forms.item (0)
            $oaddress = $oform.elements (2)
            $oselect = $oform.elements (11)
            $osubmit = $oform.elements (16)
            $oaddress.value = (GUICtrlRead($addr)) &" " & (GUICtrlRead($box))
            $oselect.checked = True
            $osubmit.click
        Case (GUICtrlRead($county)) = "Desoto"
            $Aobj1.navigate ("http://www.desotoms.info/Webpgms/APBYADDRES.pgm?&smurfid=0020f0f4f8f8f8f5f1f6f3f7f2f1f2f0f0f6f0f4f2f6f0f7f4f9f2f6f9f9f6f4")
            _IELoadWait($Aobj1)
            $oform = $Aobj1.document.forms.item (0)
            $oaddress = $oform.elements (0)
            $ostreet = $oform.elements (1)
            $osubmit = $oform.elements (3)
            $oaddress.value = (GUICtrlRead($box))
            $ostreet.value = (GUICtrlRead($addr))
            $osubmit.click
        Case (GUICtrlRead($county)) = "Marshall"
            $Aobj1.navigate ("http://www.deltacomputersystems.com/MS/MS47/pappraisalm.html")
            _IELoadWait($Aobj1)
            $oform = $Aobj1.document.forms.item (0)
            $oaddress = $oform.elements (4)
            $ostreet = $oform.elements (5)
            $osubmit = $oform.elements (8)
            $oaddress.value = (GUICtrlRead($box))
            $ostreet.value = (GUICtrlRead($addr))
            $osubmit.click
    EndSelect
            

;RunWait("rundll32.exe url.dll,FileProtocolHandler " & $url2, @WorkingDir)
EndFunc

Func GUI_Close()
    Exit
EndFunc;==>GUI_Close

Exit
Link to comment
Share on other sites

ok i got a new question.

i browse to a website and do some formelement stuff. i do a $obutton.click and it bring up a popup.

how do i set that popup to $oIE or another words when i try to do a _IEFormGetObjByIndex( ) what do i put as the object since it is a popup, i tried $oIE but i get an error

i did an _IEAttach on the popup window title does this set it to my $oIE?

Edited by anyday
Link to comment
Share on other sites

As much as I like AutoIt, I think you would be better served with the bookmark keyword feature of Firefox. (Well, you can get almost the same feature on IE on Windows XP using TweakUI TweakUI > Internet Explorer > Search. I believe IE requires at least a three letter search term unlike Firefox)

The corresponding URL is http://maps.google.com/maps?f=q&hl=en&q=%s&om=1

You could assign a keyword of map for example.

Then type map 1600 Pennsylvania Avenue 20006 into the address bar of your web browser.

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...