faustf Posted April 19, 2013 Share Posted April 19, 2013 hi guy i have a little problem i want reset my router in remote mode , usally use web but is so long , i want do a simple gui with one button over my desktop clik and reset immidiatly i analyze the http header and i finded a string for reset http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm if insert this string in browser address atomatically router reset without press button i think reuse this string and i created this little script , but not go where is mistake ? ? ? expandcollapse popup#include $Form1 = GUICreate("R&R", 137, 62, 1075, 503) $Button1 = GUICtrlCreateButton("Reset Rutter", 24, 16, 91, 33, 0) GUISetState(@SW_SHOW) $szData=('http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm') $szIPADDRESS="192.168.1.1" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 TCPStartup() If @error Then MsgBox(16+262144, " Error", "Non posso aprire il socket!") Exit -1 Else $ConnectedSocket = TCPConnect($szIPADDRESS, 80) If @error Then MsgBox(16+262144, " Error", "Non posso Connettermi!") ;Exit -1 Else $v=TCPSend($ConnectedSocket, $szData) If @error Then MsgBox(16+262144, " Error", "Non posso inviare i dati!") Else MsgBox(0+262144, " Info", "Reset inviato con successo attendi 30 sec!") EndIf EndIf EndIf EndSwitch WEnd thanks Link to comment Share on other sites More sharing options...
FireFox Posted April 19, 2013 Share Posted April 19, 2013 Hi, Well I would be surprised if this worked, hopefully there are some security measures meaning that you need to login (so you need to send this request) before sending any request like this one. Br, FireFox. Link to comment Share on other sites More sharing options...
faustf Posted April 19, 2013 Author Share Posted April 19, 2013 but why if open browser at 192.168.1.1 dont request login ?? Link to comment Share on other sites More sharing options...
faustf Posted April 19, 2013 Author Share Posted April 19, 2013 and the script dont give me nothing error if router block me for login i must have error in this part of code $ConnectedSocket = TCPConnect($szIPADDRESS, 80) If @error Then MsgBox(16+262144, " Error", "Non posso Connettermi!") ;Exit -1 Else Link to comment Share on other sites More sharing options...
BrewManNH Posted April 19, 2013 Share Posted April 19, 2013 $szData=ShellExecute('http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm') Done If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
faustf Posted April 19, 2013 Author Share Posted April 19, 2013 but in this mode ope also a browser??? i dont wanna open a browser Link to comment Share on other sites More sharing options...
BrewManNH Posted April 19, 2013 Share Posted April 19, 2013 Look at the help file for ShellExecute, you can set the process to be hidden using @SW_HIDE in the proper parameter in the command, then you can wait for a period of time, and then close the process. You might have to play around with the delay time a bit to figure out how long it takes. You can also use the _IE* functions to do this hidden as well, which would be a better method, but not so easy. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
trancexx Posted April 19, 2013 Share Posted April 19, 2013 Find UDF called WinHttp.au3. Help file that comes with it has plenty of examples of how to use it, including example of what you want to do. There are no browsers included in that equation nor other mumbo jumbo. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
faustf Posted April 19, 2013 Author Share Posted April 19, 2013 i try in this mode ShellExecute('http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm','','','',@SW_HIDE) or szData=ShellExecute('http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm','',@SW_HIDE) but dont go hide, open browser and lunch page you have some example ?? thankz Link to comment Share on other sites More sharing options...
faustf Posted April 19, 2013 Author Share Posted April 19, 2013 i resolve alll with this $oIE = _IECreate("http://192.168.1.1/setup.cgi?todo=reboot&this_file=diag.htm&next_file=diag.htm", 0, 0) but is possible have exmple also with shellexecute and with WinHttp.au3 thankz Link to comment Share on other sites More sharing options...
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