I'm sure AHK could help with atleast part of my job
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Thanks in advance
Code: Select all
f1::
gui add, text,,please enter the webaddress of the page you would like to get the info for
gui add, edit, vwebsite,
gui add, button, ,ok
gui show
return
buttonok:
gui submit
wb := ComObjCreate("InternetExplorer.Application")
wb.visible := 1
wb.navigate(website)
while wb.busy
sleep 10
stores := wb.document.getElementsByclassname("street-address").length
addr := array() ; array with the address of the store for the page your on
while a_index <= stores
addr.push(wb.document.getElementsByclassname("street-address")[a_index-1].innertext)
city := array()
while a_index <= stores
city.push(wb.document.getElementsByclassname("locality")[a_index-1].innertext)
state := array()
while a_index <= stores
state.push(wb.document.getElementsByclassname("region")[a_index-1].innertext)
zip := array()
while a_index <= stores
zip.push(wb.document.getElementsByclassname("postal-code")[a_index-1].innertext)
phone := array()
while a_index <= stores
phone.push(wb.document.getElementsByclassname("location-phone")[a_index-1].href)
while a_index <= stores
{
phone1 := % phone[a_index]
stringtrimleft,phone1,phone1,4
msgbox % "address ="addr[a_index]"`n"city[a_index]", "state[a_index]", "zip[a_index]"`n phone number= "phone1
}
return
Code: Select all
getaddress()
{
sleep, 50 ;gives a 50ms pause for the pc to let things happen, it might need to be faster or slower and will depend on your system and the application that you are working on
mousemove, 200, 100 ;moves the mouse
sleep, 50
send, {click down} ;sends a left cluck down
sleep, 50
mousemove, 100, 100 ;moves the mouse, this with the previosu click down and the next click up give the select action bus is actually 3 separate actions
sleep, 50
send, {click up}
sleep, 50
clipboard := "" ;sets your clipboard to be blank
send, {ctrl down}c{ctrl up} ;again 3 actions but effectivly a windows copy command
if (clipboard == "") ;this does some checking on if you coppied something and if nothing, it will exit
{
msgbox, there is an error with getaddress function, program will exit...
exitapp ;exits your program and you will have to restart it
}
return, %clipboard%
}
Code: Select all
f1::
MyResult := getaddress() ;MyResult variable is set to be whatever the function "getaddress" gives as an answer
msgbox, %MyResult% ;uses message box to tell you what MyResult's value is
return ;ends your program and will let you run it again if needed
}
Code: Select all
f1::
MyResuly := getaddress(300, 200, 200, 200) ;We send the parameters of the start and ending of the text we want. Change these to something else and see what happens
msgbox, %MyResult%
return
getaddress(x1, y1, x2,y2) ;note the 4 parameters sent to the function. The getaddress function is going to use these as the locations from where to get the text
{
sleep, 50 ;gives a 50ms pause for the pc to let things happen, it might need to be faster or slower and will depend on your system and the application that you
are working on
mousemove, %x1%, %y1% ;moves the mouse, note you are using the parameters received
sleep, 50
send, {click down} ;sends a left cluck down
sleep, 50
mousemove, %x2%, %y2% ;moves the mouse, again we use the received parameters, this with the previous click down and the next click up give the select action bus is actually 3 separate actions
sleep, 50
send, {click up}
sleep, 50
clipboard := "" ;sets your clipboard to be blank
send, {ctrl down}c{ctrl up} ;again 3 actions but effectively a windows copy command
if (clipboard == "") ;this does some checking on if you copied something and if nothing, it will exit
{
msgbox, there is an error with getaddress function, program will exit...
exitapp
}
return, %clipboard%
}
Code: Select all
global addrrow := "b"
global cityrow := "c"
global staterow := "d"
global ziprow := "e"
global phonerow := "f"
global col := 2
f1::
gui add, text,,please enter the webaddress of the page you would like to get the info for
gui add, edit, vwebsite,
gui add, button, ,ok
gui show
return
buttonok:
gui submit
global wb := ComObjCreate("InternetExplorer.Application")
wb.visible := 1
wb.navigate(website)
while wb.busy
sleep 10
stores := wb.document.getElementsByclassname("street-address").length
addr := array() ; array with the address of the store for the page your on
while a_index <= stores
addr.push(wb.document.getElementsByclassname("street-address")[a_index-1].innertext)
city := array()
while a_index <= stores
city.push(wb.document.getElementsByclassname("locality")[a_index-1].innertext)
state := array()
while a_index <= stores
state.push(wb.document.getElementsByclassname("region")[a_index-1].innertext)
zip := array()
while a_index <= stores
zip.push(wb.document.getElementsByclassname("postal-code")[a_index-1].innertext)
phone := array()
while a_index <= stores
phone.push(wb.document.getElementsByclassname("location-phone")[a_index-1].href)
while a_index <= stores
{
phone1 := % phone[a_index] ; %
addr1 := % addr[a_index] ;%
city1 := % city[a_index] ;%
state1 := % state[a_index] ;%
zip1 := % zip[a_index] ;%
stringtrimleft,phone1,phone1,4
sendaddr(addr1)
sendcity(city1)
sendstate(state1)
sendzip(zip1)
sendphone(phone1)
col++
}
return
sendaddr(addr)
{
website := % "https://docs.google.com/spreadsheets/d/16M83S-S1XJde5aUGsvljE4FWtfmAmwWcWjwQhngvf-U/edit#gid=0&range=" addrrow col ;% change all of these to be the webaddress of your spreadsheet
wb.navigate(website)
sleep 5000
while wb.busy
sleep 10
send, %addr%
send, {enter}
return
}
sendcity(addr)
{
website := % "https://docs.google.com/spreadsheets/d/16M83S-S1XJde5aUGsvljE4FWtfmAmwWcWjwQhngvf-U/edit#gid=0&range=" cityrow col ;% change all of these to be the webaddress of your spreadsheet
wb.navigate(website)
sleep 1000
while wb.busy
sleep 10
send, %addr%
send, {enter}
return
}
sendstate(addr)
{
website := % "https://docs.google.com/spreadsheets/d/16M83S-S1XJde5aUGsvljE4FWtfmAmwWcWjwQhngvf-U/edit#gid=0&range=" staterow col ;% change all of these to be the webaddress of your spreadsheet
wb.navigate(website)
sleep 1000
while wb.busy
sleep 10
send, %addr%
send, {enter}
return
}
sendzip(addr)
{
website := % "https://docs.google.com/spreadsheets/d/16M83S-S1XJde5aUGsvljE4FWtfmAmwWcWjwQhngvf-U/edit#gid=0&range=" ziprow col ;% change all of these to be the webaddress of your spreadsheet
wb.navigate(website)
sleep 1000
while wb.busy
sleep 10
send, %addr%
send, {enter}
return
}
sendphone(addr)
{
website := % "https://docs.google.com/spreadsheets/d/16M83S-S1XJde5aUGsvljE4FWtfmAmwWcWjwQhngvf-U/edit#gid=0&range=" phonerow col ;% change all of these to be the webaddress of your spreadsheet
wb.navigate(website)
sleep 1000
while wb.busy
sleep 10
send, %addr%
send, {enter}
return
}