jben Posted April 3, 2008 Author Posted April 3, 2008 So do you mean this If Not FileCopy(@ScriptDir & "\Software\Devcon\devcon.bat", "c:\temp\devcon.bat") Then RunErrorFunc() EndIf
Ealric Posted April 3, 2008 Posted April 3, 2008 So do you mean this If Not FileCopy(@ScriptDir & "\Software\Devcon\devcon.bat", "c:\temp\devcon.bat") Then RunErrorFunc() EndIf What he means is something along the lines of this: If Not FileCopy(@ScriptDir & "\Software\Devcon\devcon.bat", "c:\temp\devcon.bat") Then _error() EndIf If Not FileCopy(@ScriptDir & "\Software\Devcon\devcon.bat", "c:\temp\devcon.exe") Then _error() EndIf Runwait ("c:\temp\devcon.bat") If Not FileDelete("c:\temp\devcon.bat") Then _error2() EndIf If Not FileDelete("c:\temp\devcon.exe") Then _error2() EndIf Func _error() MsgBox(48,"Error","The file cannot be copied to this location") EndFunc Func _error2() MsgBox(48,"Error","Cleanup of the files were not successful.") EndFunc My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]
jben Posted April 3, 2008 Author Posted April 3, 2008 Thanks alot and thankyou to everyone that contributed to this post. Its been a nightmare for me but i'm glad i've come to a resolution now, whew.
Ealric Posted April 3, 2008 Posted April 3, 2008 Thanks alot and thankyou to everyone that contributed to this post. Its been a nightmare for me but i'm glad i've come to a resolution now, whew.Great to hear. Yep, sometimes the simplest things are the best things eh? My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]
MadBoy Posted April 3, 2008 Posted April 3, 2008 This is what I have doneFileCopy(@ScriptDir & "\Software\Devcon\devcon.bat", "c:\temp\devcon.bat")FileCopy(@ScriptDir & "\Software\Devcon\devcon.exe", "c:\temp\devcon.exe")Runwait ("c:\temp\devcon.bat")FileDelete ("c:\temp\devcon.bat")FileDelete ("c:\temp\devcon.exe")and it works. Do you think that will be fine, or do i need some sort of error checking. ThanksWhy do you need .bat at all? I mean what code is in it that you can't put it all in autoit? My little company: Evotec (PL version: Evotec)
jben Posted April 3, 2008 Author Posted April 3, 2008 (edited) I'm not sure MadBoy. Just going on my limited knowledge to be honest. I did find this on the net this evening though: RunDll32.exe Syssetup.dll,UpdatePnpDeviceDrivers Supposdly that code will refresh the hardware list. Now i'm wondering if maybe it would be easyier this way but don't know if AutoIT is capable of doing that?. I haven't tried the code in a batch file as i'm on my home PC now and don't really want to fiddle with my drivers to see if it works. But in effect when a driver is installed that requires a restart I would click No and then run that code above in a batch file, which would then rescan the hardware list and show the hardware in the device manager without rebooting. The ideal scenario for me would be to install the driver, then refresh the hardware list and then don't open the add new hardware wizard if other hardware is detected. Because as it stands I believe the code above will bring up the wizard if it detects anything else. I don't want the hardware wizard to appear as I have it planned to install the drivers later in my installation procedure. Its not a big deal considering all of this is automated and doesn't exactly effect the user but would just be for completnes. Edited April 3, 2008 by jben
inthewayboy Posted April 9, 2008 Posted April 9, 2008 Yeah, the .bat seems redundant at this point...using the Run() or RunWait() commands should yield positive results, and you could hide the GUI you are talking about by using the @SW_HIDE option for the command. It looks like MadBoy had the correct code on the first page to just run it natively in the script. That would be the direction I would take at least. I don't know about the Run32DLL, but I'm sure there is a way to execute that in AutoIt.
Wilenty Posted December 17, 2009 Posted December 17, 2009 DllCall("Syssetup.dll", "int", "UpdatePnpDeviceDrivers")
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