kjcdude Posted November 24, 2007 Share Posted November 24, 2007 (edited) I'm currently working on a script that will check all the pc's at my work for certain applications and the version they are running, then write to an ini file either yes or no, which will eventually be read by another autoit scrip that will fix all the problems. The big problem i'm running into is being able to run the file multiple times on different machines without causing the scripts to freeze due to the fact that they all write to a single file. Here is an exerpt of the script, the script itself works perfectly fine, i just need to be able to run ~50 or so at the same time. $dtmodified = @mon & "/" & @mday & "/" & @YEAR & " - " & @hour & ":" & @min & ":" & @sec $logini = "\\nas01\Volume_1\Log\11-24-07 6.ini" IniWrite($logini, "Modified", "When", $dtmodified) $compnum = StringRight(@ComputerName, 3) $winuisize = FileGetSize("C:\Program Files\Steam\SteamApps\winui.gcf") $wowversion = FileGetVersion("C:\Program Files\World of Warcraft\WoW.exe") $wowscanversion = FileGetVersion("C:\Program Files\World of Warcraft\Scan.dll") $xfireversion = FileGetVersion("C:\Program Files\Xfire\Xfire.exe") $xfiregamesversion = IniRead("C:\Program Files\Xfire\Xfire.ini", "Toucan", "Build", "0") ;vent 3.0.1 if $ventversion = "3.0.1.0" Then IniWrite($logini, "Vent", $compnum, "1") Else IniWrite($logini, "Vent", $compnum, "0") EndIf ;Steam WinUI if $winuisize = "26427508" Then IniWrite($logini, "Steam-WinUI" , $compnum, "1") Else IniWrite($logini, "Steam-WinUI" , $compnum, "0") EndIf ;wow 2.3.0.7561 If $wowversion = "2.3.0.7561" and $wowscanversion = "2.2.3.36" Then IniWrite($logini, "WoW" , $compnum, "1") Else IniWrite($logini, "WoW" , $compnum, "0") EndIf ;Xfire 1.84 If $xfireversion = "1.0.0.13133" and $xfiregamesversion = "28887" Then IniWrite($logini, "Xfire" , $compnum, "1") Else IniWrite($logini, "Xfire" , $compnum, "0") EndIf I've briefly thought about looking into having it write to a sql database, but i really don't feel like setting one up locally. Edited November 24, 2007 by kjcdude Link to comment Share on other sites More sharing options...
flyingboz Posted November 24, 2007 Share Posted November 24, 2007 The big problem i'm running into is being able to run the file multiple times on different machines without causing the scripts to freeze due to the fact that they all write to a single file.I've briefly thought about looking into having it write to a sql database, but i really don't feel like setting one up locally.you can test the success of the iniwrite within a while or do loop, retrying until complete. Or create a file that acts as a 'lock', and only allowing the writing of a file if the 'lock' does not exist.of course, the database would be much more robust. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
kjcdude Posted November 25, 2007 Author Share Posted November 25, 2007 What if i used the remote script execution script, and had them all talk to a single script (server) who then executes all the ini writes. Do you think that would work better? Link to comment Share on other sites More sharing options...
flyingboz Posted November 27, 2007 Share Posted November 27, 2007 What if i used the remote script execution script, and had them all talk to a single script (server) who then executes all the ini writes. Do you think that would work better?you simply need a way to ensure that it works. All you need is to ensure that what you're trying to write got written. A loop that reads the key/value pair , and verifies that it is the same as that which you tried to write guarantees proper operation , and provides all of the functionality requested. Infinite loop protection should be in place as well, such that if the file becomes unavailable that you fail in a controlled manner."Better" is highly subjective. Aim for reliability first, functionality second, and debugging ease third. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. 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