WhiteAvenger Posted February 25, 2008 Share Posted February 25, 2008 Hi, I have an old PC set up in my home as a printer server - i.e. a printer is connected to it and shared through the network. This PC doesn't have a monitor, mouse or keyboard since it's not needed - if I want to configure something, I use VNC. However, when the PC boots, it frequently fails to connect to our (wireless) home network. I want to write a script which checks every 5 Minutes whether it can connect to the internet (thus being in the network) and if not, "repair" the wireless network using the Windows Wireless repair utility. It'll then check again every 45secs to ensure it worked, and if it has finally worked, it'll check again every 5 minutes. OK, so far so good... But how do I run the repair utility? I mean the one you get when you right-click the wireless symbol in the tray and click "Repair". Is there a way of running that with AutoIt? I can't do it with clicking somewhere specific because whenever I boot, the tray icon is somewhere else. Thanks in advance --WhiteAvenger Link to comment Share on other sites More sharing options...
whim Posted February 25, 2008 Share Posted February 25, 2008 (edited) Haven't found the repair command but maybe stopping/starting the wireless zero config service on the cmdline will do the trick - can't check atm, sorry. 'sc stop wzcsvc' (wait) 'sc start wzcsvc' P.S. Won't give you the repair screen though Edited February 25, 2008 by whim Link to comment Share on other sites More sharing options...
ResNullius Posted February 25, 2008 Share Posted February 25, 2008 Hi, I have an old PC set up in my home as a printer server - i.e. a printer is connected to it and shared through the network. This PC doesn't have a monitor, mouse or keyboard since it's not needed - if I want to configure something, I use VNC. However, when the PC boots, it frequently fails to connect to our (wireless) home network. I want to write a script which checks every 5 Minutes whether it can connect to the internet (thus being in the network) and if not, "repair" the wireless network using the Windows Wireless repair utility. It'll then check again every 45secs to ensure it worked, and if it has finally worked, it'll check again every 5 minutes. OK, so far so good... But how do I run the repair utility? I mean the one you get when you right-click the wireless symbol in the tray and click "Repair". Is there a way of running that with AutoIt? I can't do it with clicking somewhere specific because whenever I boot, the tray icon is somewhere else. Thanks in advance --WhiteAvenger I believe you can also do most of the functions using the "ipconfig" command-line tool. This is a batch file that I've used (saved as "ipfix.cmd"): @echo off ipconfig /release *local* ipconfig /release *wirel* ipconfig /flushdns ipconfig /renew *wirel* Either convert to AutoIt, or have your script call the batch file. Run "ipconfig /?" in a command prompt for more info. Link to comment Share on other sites More sharing options...
maroesjk Posted February 25, 2008 Share Posted February 25, 2008 (edited) What about this, which works for an English version of XP 32-bit (I use a similar script to invoke the properties of my network-connection to set file and printer sharing on or off depending on the network I'm using):Global $WinShell= ObjCreate("shell.application"), $ControlPanel = 3, _ $NetConTitle = 'Network Connections', _ ; Name of the window you see whenever you open "Network Connections" from the Control Panel $NetWorkName = 'Wireless Network Connection'; Name of the connection you'd wish to invoke a function on While 1 While StringLeft(@IPAddress1, 4) = '169.' Or @IPAddress1 = '0.0.0.0' ;As long as the adaptor has an "auto-configuration" address or no IP-addres RepairConnection() ;Repair the connection WEnd Sleep(300 * 1000) ;300 seconds (5 minutes) WEnd Func RepairConnection() For $ControlPanelItem in $WinShell.NameSpace($ControlPanel).Items If $ControlPanelItem.Name = $NetConTitle Then For $NetConnection In $ControlPanelItem.GetFolder.Items If $NetConnection.Name = $NetWorkName Then ExitLoop(2) Next EndIf Next $NetConnection.InvokeVerb('Re&pair') ;Invoke the function If WinWaitActive('Repair ' & $NetworkName, 'finished repairing', 45) Then _;As soon as the repairment took place or 45 seconds have passed Send('{TAB}{ENTER}') ;Close the window by sending {ALT}{ENTER} EndFunc Edited February 25, 2008 by maroesjk Link to comment Share on other sites More sharing options...
WhiteAvenger Posted February 26, 2008 Author Share Posted February 26, 2008 Thanks @ ResNullius; @maroesjk: I'll try that, thanks a lot! That was exactly the kind of thing I was looking for! Link to comment Share on other sites More sharing options...
ptrex Posted February 27, 2008 Share Posted February 27, 2008 @maroesjk This is a nice solution !! regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New 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