By the way, any wput replacement natively?
Need help, I am coming on another glitch. I have a simple ahk that works, using your code, but embedded in a larger ahk-a dyndnsupdateclient-, the html variable (the html telling me that the ip was updated or not) is returning blank. Is this because variable used previously on another case, in the ahk?
Code:
dynquery:
;replace wget
#noenv
html := ""
URL := "http://me:mypassword@members.dyndns.org/nic/update?"
POSTData := "hostname=hyhost.homeip.net&myip=173.89.183.11"
length := httpQuery(html,URL,POSTdata)
varSetCapacity(html,-1)
fileappend,..%html%`n,log.txt
msgbox,, %html%,%html%,1
;end of dynquery
filedelete,dyndnserrorlog.txt
sleep, 1000
fileappend, %html%,dyndnserrorlog.txt
IfInString, html, bad, msgbox, Your ini has errors!
IfInString, html, nochg, msgbox,,Warning!,May be updating too often!,1
ExitApp
#include httpQuery.ahk
This is working fine. But in the huge file, the html variable is returning blank. Listing other variables looks like working fine.
Code:
;this code is the main ahk to dyndns.com updating client, only missing help and httpquery.ahk
;todo reinstall jump.htm homehost.html
;done:eliminate wget with http://www.autohotkey.com/forum/viewtopic.php?p=235283#235283
;done:http://www.autohotkey.com/forum/viewtopic.php?t=33506
;
;FileInstall, wget\wget.exe, wget\wget.exe
FileInstall, helpme.txt, helpme.txt
FileInstall, source-code.ahk, source-code.ahk
FileInstall, httpQuery.ahk, httpQuery.ahk
#singleinstance
DetectHiddenWindows, On
settitlematchmode,2
iniread,hostname, dyn.ini,Prefs,hostname
trays:
Menu, Tray, Tip, Dyna-Dingle! Another Dyndns.com updater 4 free! %hostname%
menu:
menu, tray, Nostandard
;Menu, Tray, Click, 1
;menu, tray, add,Dial/Hang,dialhang
;menu, tr5y, Default,Dial/Hang
menu, tray, add,Check and update dyndns.com, firstcheck
Menu, MySubmenu, add, List_Recent_Executed_Code
Menu, MySubmenu, add, List_Variables
Menu, MySubmenu, add, Update-Log_View
Menu, tray, add, Tools,:MySubmenu
;menu, tray, add,ListLines,ListLines
;menu, tray, add,ListVars,ListVars
;menu, tray, add,View Update Logs,Logview
menu, tray, add,Help and Configure,help
Menu, tray, add ; Creates a separator line.
menu, tray, add,Pause, Pause
menu, tray, add,Exit , exit
firstcheck:
fileread, String3, ip.txt
StringReplace, String4, String3, `n,
StringReplace, String5, String4, %a_space%,
StringReplace, oldip, String5,
,
;sleep 360000
FileDelete, ipstring.txt
;;;run wget\wget -O ipstring.txt "http://checkip.dyndns.org" ,,hide
ipquery1:
;replaces wget
#noenv
html := ""
URL := "http://checkip.dyndns.org"
POSTData := ""
length := httpQuery(html,URL,POSTdata)
varSetCapacity(html,-1)
fileappend,%html%,ipstring.txt
;msgbox,, %html%,ip is %html%,10
;end of ipquery
sleep, 3000
FileRead, String, ipstring.txt
StringReplace, String2, String, <html><head><title>Current IP Check</title></head><body>Current IP Address: ,
StringReplace, String3, String2, </body></html>,
StringReplace, String4, String3, `n,
StringReplace, String5, String4, %a_space%,
StringReplace, String5a, String5, |,
StringReplace, currentip, String5a,
,
;msgbox, %currentip% = %oldip%
ifequal, currentip, %oldip%, goto, sleeping
inicheck:
ifnotexist,%A_WorkingDir%\dyn.ini
{
iniwrite,me, dyn.ini,Prefs,UserName
iniwrite,hostname.homeip.net, dyn.ini,Prefs,hostname
iniwrite,password, dyn.ini,Prefs,Password
runwait, notepad.exe dyn.ini
runwait, notepad.exe helpme.txt
}
iniread,username, dyn.ini,Prefs,UserName
iniread,hostname, dyn.ini,Prefs,hostname
iniread,password, dyn.ini,Prefs,Password
sleep, 1800
; increase above value to 180000 so running at startup works on all machines
run, %A_WinDir%\system32\ipconfig.exe >> d:\ipnow.txt
dnyservice:
FileDelete, ipstring.txt
;;;run wget\wget -O ipstring.txt "http://checkip.dyndns.org" ,,hide
ipquery2:
;replaces wget
#noenv
html := ""
URL := "http://checkip.dyndns.org"
POSTData := ""
length := httpQuery(html,URL,POSTdata)
varSetCapacity(html,-1)
fileappend,%html%,ipstring.txt
;msgbox,, %html%,%html%,10
;end of ipquery
sleep, 3000
FileRead, String, ipstring.txt
StringReplace, String2, String, <html><head><title>Current IP Check</title></head><body>Current IP Address: ,
StringReplace, String3, String2, </body></html>,
StringReplace, String4, String3, `n,
StringReplace, String5, String4, %a_space%,
StringReplace, String5a, String5, |,
StringReplace, currentip, String5a,
,
goto, writejumppage
ipconfig:
controlsend,, ipconfig > d:\ip4now.txt{enter}, ahk_id %ControlHwnd%
sleep, 2500
controlsend,, exit{enter}, ahk_id %ControlHwnd%
FileRead, String3, d:\ip4now.txt
StringReplace, String4, String3, `n,
StringReplace, String5, String4, %a_space%,
StringReplace, String5a, String5, |,
StringReplace, currentip, String5a,
,
FileDelete, d:\ip4now.txt
StringMid, currentip, currentip, 460,14
writejumppage:
msgbox, ,Updating ip!,Updating ip %currentip%! (writejumpage),1
;3 lines below is test code to see in sendkeys working on second cmd.
FileDelete, homehost.htm
fileappend, <HEAD> `n<meta HTTP-EQUIV="REFRESH" content="0; url=http://%currentip%">`n </HEAD>,homehost.htm
sleep, 2500
;;;runwait wget\wget.exe -O wget\dyndnsupdate.txt "http://%username%:%password%@members.dyndns.org/nic/update?hostname=%hostname%&myip=%currentip%{enter}",%a_working_Dir%/wget,hide
dynquery:
;replace wget
#noenv
html =
html := ""
URL := "http://%username%:%password%@members.dyndns.org/nic/update?"
POSTData := "hostname=%hostname%&myip=%currentip%"
;length := httpQuery(html,URL,POSTdata)
;varSetCapacity(html,-1)
fileappend,..%html%`n,log.txt
sleep, 1000
msgbox,, %html%,%html%`nhttp://%username%:%password%@members.dyndns.org/nic/update?hostname=%hostname%&myip=%currentip% ,11
;end of dynquery
filedelete,dyndnserrorlog.txt
sleep, 1000
fileappend, %html%,dyndnserrorlog.txt
IfInString, html, bad, msgbox, Your ini has errors!
IfInString, html, nochg, msgbox,,Warning!,May be updating too often!,1
sleep, 4500
log:
fileappend, New ip is %currentip% Found at %A_MM%-%A_DD% %A_Hour%:%A_Min%..`n, log.txt
;:UrlDownloadToFile, http://%username%:%password%@members.dyndns.org/nic/update?hostname=%hostname%&myip=%currentip%, Filename.txt
;:run, http://%username%:%password%@members.dyndns.org/nic/update?hostname=%hostname%&myip=%currentip%
;MsgBox, Your IP is: %currentip%
filedelete, ip.txt
;msgbox, ,writeing ip,%currentip%,3
fileappend, %currentip%, ip.txt
fileread, String3, ip.txt
StringReplace, String4, String3, `n,
StringReplace, String5, String4, %a_space%,
StringReplace, String5a, String5, |,
StringReplace, oldip, String5a,
,
sleeping:
;msgbox,, Sleeping!, Sleeping!,1
sleep 720000
FileDelete, ipstring.txt
;;;run wget\wget -O ipstring.txt "http://checkip.dyndns.org" ,,hide
ipquery3:
;replaces wget
#noenv
html := ""
URL := "http://checkip.dyndns.org"
POSTData := ""
length := httpQuery(html,URL,POSTdata)
varSetCapacity(html,-1)
fileappend,%html%,ipstring.txt
;msgbox,, %html%,%html%,10
;end of ipquery
sleep, 3000
FileRead, String, ipstring.txt
StringReplace, String2, String, <html><head><title>Current IP Check</title></head><body>Current IP Address: ,
StringReplace, String3, String2, </body></html>,
StringReplace, String4, String3, `n,
StringReplace, String5, String4, %a_space%,
StringReplace, String5a, String5, |,
StringReplace, currentip, String5a,
,
fileread, String3, ip.txt
StringReplace, String4, String3, `n,
StringReplace, String5, String4, %a_space%,
StringReplace, String5a, String5, |,
StringReplace, oldip, String5a,
,
ifnotequal, currentip, %oldip%,msgbox, ,Updating ip!,Updating ip!,3
ifnotequal, currentip, %oldip%, goto, writejumppage
goto, sleeping
exit:
exitapp
List_Recent_Executed_Code:
ListLines
goto, sleeping
Return
List_Variables:
ListVars
goto, sleeping
Return
help:
runwait, notepad.exe dyn.ini
runwait, notepad.exe helpme.txt
goto, sleeping
Return
Update-Log_View:
runwait, notepad.exe log.txt
goto, sleeping
Return
Pause:
pause
return
#include httpQuery.ahk