vtuls Posted February 14, 2010 Posted February 14, 2010 i'm trying to write a programm that will connect with my server computer and sends files from my laptop to my server.this is for my wow (World of warcraft) game before i get all the remarks like "you can't tamper with the wow files" or similar,i'm not going to tamper with those files or in any other way offend the EULA.i just want to copy my update files for the programm and my addons to the server and from there i will redistribute them between my other computers, those of my guests orreacuire them on one of the computers that i had to reinstall.for the addons ill try to make a selection list, i'm thinking of a tree vieuw (if any other sugestions come up ill love to hear them)i want to get the folder where Wow is installd to be acuired by the progamm becouse,it is installed differently on all systemsmore on this topic as it progresses.for now please help me with this first chalange of mine:1. getting the programm to find the wow.exe and returning its path.well thnx for reading this and hope your post will help me and my programm.keep in mind im still a litle bit of a novice so if i'm biting of more than i can chew please don't be afraid to tel me. a badly written code is better than a unwritten onea good written code is even better.but there is always room for improvement. :)
NerdFencer Posted February 15, 2010 Posted February 15, 2010 Check HKEY_LOCAL_MACHINE\SOFTWARE for world of warcraft's key. There is usually an "Install_Dir" or "Path" value that you can read to find the install directory on the the computer. _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell
vtuls Posted February 16, 2010 Author Posted February 16, 2010 ok seems quite doable ill try looking it up tonight but is there an function that reads strings from the registry? a badly written code is better than a unwritten onea good written code is even better.but there is always room for improvement. :)
Steveiwonder Posted February 16, 2010 Posted February 16, 2010 btw dude, for your addons, a better way is to use the curse client. Their latest release updates all computers with the same addons that you install. But my guess is your Multi-boxing and you want to distribute the patches from a single download to the rest of your computers, if thats the case then i think you need to continue on the path of Autoit scripting. They call me MrRegExpMan
vtuls Posted February 16, 2010 Author Posted February 16, 2010 indeed i'm trying to make a programm that also redistributes the updates and the addons. it saves me the time of downloading the updates on every computer im not multi boxing but have 3 computers to keep track of. a badly written code is better than a unwritten onea good written code is even better.but there is always room for improvement. :)
Steveiwonder Posted February 16, 2010 Posted February 16, 2010 Well like i said, to make your life easier, for the addons just use the curseclient. It's easy to use but does require some manual clicking on "update" for each addon which.. you can either write seperate scripts for OR pay for the premium and then it doesn everything for you. and check RegRead for reading the registry. They call me MrRegExpMan
vtuls Posted February 16, 2010 Author Posted February 16, 2010 thnks for the RegRead tip. i looked it up in the help file. it is the awnser to my first problem. now to get to the next problem of detecting my updates. as soon as i have a bit of cohesive code i will post my findings and progress a badly written code is better than a unwritten onea good written code is even better.but there is always room for improvement. :)
Steveiwonder Posted February 16, 2010 Posted February 16, 2010 I don't have wow installed on my work PC so can't check this, but i'm sure there will be some registry value or a value inside some document to state the current version of wow installed. Your client PC's can then check the server for its current version of wow and then.... If $clientVersion < $ServerVersion Then get latest file... or something like that. However, the problem with WOW and the way Blizzard distribute some patches are inconsistant. Not all of the patches are saved in the same location. Some of in a seperate folder (normally the big patches) and some are just placed in the root directory. I'm sure it can be worked around. Just make a seperate folder on the server PC and manually put all the patches into that folder and have the clients check in there for patches. Something like that.. maybe. They call me MrRegExpMan
vtuls Posted February 16, 2010 Author Posted February 16, 2010 ok i don't have my laptop at my disposal at the moment. im at my work and don't have wow installed here. so ill check those registrys later tonight. ill post my findings as prommised. a badly written code is better than a unwritten onea good written code is even better.but there is always room for improvement. :)
kaotkbliss Posted February 16, 2010 Posted February 16, 2010 Since updates come after the core game is installed, you could use filegettime to get a timestamp of a file created durring install and compair to others to find files created later, that would be a way of getting a list of files to copy maybe? 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
NerdFencer Posted February 16, 2010 Posted February 16, 2010 Try using FileGetVersion to retrieve the file version of all the files in the wow directory, and copy over any ones that are newer or don't exist _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell
vtuls Posted February 16, 2010 Author Posted February 16, 2010 ok i checked my registry there is a root called "HKEY_LOCAL_MACHINE\SOFTWARE\Blizzard Entertainment\World of Warcraft" this contains 4 keys (standard),InstallPath, GamePath and uninstallPath. i chose for the installPath because this one contains only the directory in witch the updates and wow is installed, gamepath has the launcher.exe included in the key and i dont need that for now. here an example of how far i am until now. ; wow update manager. ; find the wow.exe file get its location. ; check with update list if there is an update. ; if there is get it from a centralized place ; $dir = @ScriptDir ;opening and checking if file is open ;getting location $loc = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Blizzard Entertainment\World of Warcraft", "InstallPath") msgbox(0, "wow loc", $loc) ;checking the update list if FileExists($dir & "updates.txt") = 1 Then $file = FileOpen( "updates.txt", 1) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf for $i = 0 to 100 step 1 $updatearay[$i] =FileReadLine($file,$i) Next Else msgbox(16,"Database Error", "could not find Database") ; no database found need to create one EndIf a badly written code is better than a unwritten onea good written code is even better.but there is always room for improvement. :)
BrettF Posted February 17, 2010 Posted February 17, 2010 The patch files seem to have a fairly consistent way of being named... I used this script to generate a list of patches needed. It needs a way to generate the $aFiles away but I left that up to you. Basically due to the consitancy of patches being named something like "WoW-2.4.3-to-3.0.1" or "WoW-3.3.0.11159-to-3.3.2.11403" makes it easy. [\code] I would also look at maybe editing the realmlist to create a custom patch server? Whether or not that is against the ELUA or TOS etc I don't know but it may be something worthy to check out ;). [code]#include <Array.au3> Global $currentVersion = "3.0.3.9183" ;FileGetVersion ("wow.exe") Global $count = 0 Global $aUpdates[1] Global $aFiles[5] = ["WoW-3.0.1-to-3.0.2-enUS-Win-Update", "WoW-3.0.2.9056-to-3.0.3.9183-enUS-patch", "WoW-3.0.3.9183-to-3.0.8.9464-enUS-patch", "WoW-3.0.8.9464-to-3.0.8.9506-enUS-patch", "WoW-3.0.8.9506-to-3.0.9.9551-enUS-patch"] Global $aVersions[UBound($aFiles)][3] For $i = 0 To UBound($aFiles) - 1 $array = StringRegExp($aFiles[$i], '(\d*\.\d*\.\d*\.\d*|\d*\.\d*\.\d*)', 3) $aVersions[$i][0] = $array[0] $aVersions[$i][1] = $array[1] $aVersions[$i][2] = $aFiles[$i] Next _ArraySort($aVersions) _ArrayDisplay($aVersions, "List of current From (Col A) and To (Col B) versions.") For $i = 1 To UBound($aVersions) - 1 If $aVersions[$i][0] = $currentVersion Then For $x = $i To UBound($aVersions) - 1 $count += 1 ReDim $aUpdates[$count] $aUpdates[$count - 1] = $aVersions[$x][2] Next EndIf Next _ArrayDisplay($aUpdates, "Patches needed to go from " & $currentVersion & " to the latest") Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Steveiwonder Posted February 17, 2010 Posted February 17, 2010 The naming of patches is fine to follow, its where they are saved that could prove to be an issue? i don't know. They call me MrRegExpMan
vtuls Posted February 17, 2010 Author Posted February 17, 2010 OK i'll look at it BrettF can you shortly explain to me what your doing in the code as you seen in my post i make remarks with every action. because i can't always keep trak of the things i done. and i have 5 other programming languages in my head aswell. 1. C++ 2. html 3. visual basic 4. pascal 5. java and on all 5 im still a novice programmer . Steveiwonder: the update files are mostly stored in the main install folder. addons are stored in the interface folder. so i'm able to coppy them right out of those folders. about the remark on the time stamp of the updates as i have already needed to reinstall and update some the time stamps are exactly the same. and when i copy them from an other computer the time stamp will change to the time i copied the files. a badly written code is better than a unwritten onea good written code is even better.but there is always room for improvement. :)
BrettF Posted February 17, 2010 Posted February 17, 2010 I think if you manually put all patches into a folder on the the server you should be able to select the ones from there. Then its probably simpler to map a network drive or something. Oh and here. expandcollapse popup#include <Array.au3> ;This is the current version of WoW Global $currentVersion = "3.0.3.9183" ;FileGetVersion ("wow.exe") ;This is internal use only Global $count = 0 ;This is the array we will use to populate the required updates Global $aUpdates[1] ;This is an array of patch file names Global $aFiles[5] = ["WoW-3.0.1-to-3.0.2-enUS-Win-Update", "WoW-3.0.2.9056-to-3.0.3.9183-enUS-patch", "WoW-3.0.3.9183-to-3.0.8.9464-enUS-patch", "WoW-3.0.8.9464-to-3.0.8.9506-enUS-patch", "WoW-3.0.8.9506-to-3.0.9.9551-enUS-patch"] ;This the array we will use to store the versions to and from and the file. Global $aVersions[UBound($aFiles)][3] ;Loop through the files For $i = 0 To UBound($aFiles) - 1 ;User reqular expressions to find the version data. Either x.x.x or x.x.x.x. $array = StringRegExp($aFiles[$i], '(\d*\.\d*\.\d*\.\d*|\d*\.\d*\.\d*)', 3) ;Populate the previous data into an array $aVersions[$i][0] = $array[0] $aVersions[$i][1] = $array[1] $aVersions[$i][2] = $aFiles[$i] Next ;Sort it by version from. _ArraySort($aVersions) ;Display it _ArrayDisplay($aVersions, "List of current From (Col A) and To (Col B) versions.") ;Find versions later than our current For $i = 1 To UBound($aVersions) - 1 ;If the version we are looking at is our current version then continue If $aVersions[$i][0] = $currentVersion Then ;New for loop to get the remaining items in our array For $x = $i To UBound($aVersions) - 1 ;Resize the array $count += 1 ReDim $aUpdates[$count] ;Add the version data into the array. $aUpdates[$count - 1] = $aVersions[$x][2] Next EndIf Next _ArrayDisplay($aUpdates, "Patches needed to go from " & $currentVersion & " to the latest") Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Steveiwonder Posted February 17, 2010 Posted February 17, 2010 (edited) Ok.. this is what i would use and it works for the patches. Didn't bother dealing with the addons, TBH addons are so small you could use always copy the "Addons" folder at the start of the script or something.. or write some additional code to copy them depending if they are out of date or not.. Basically it just compares all files / folders from the server / local machine againts each other if one is missing it copies it from the server to the local machine. Once its complete you can add some code to run wow.exe and it will do its normal thing - Check for patches and then insatll them. p.s. Set the values of $LocalFileLocation, $ServerFileLocation Hope it helps. EDIT: This way you won't have to mess with reg exp checking file names for versions etc. The downside you have to have a copy of each patch on each machine so could take up some hard drive space. Some funky code could work around that #Include <File.au3> #Include <Array.au3> Local $LocalVersion, $ServerVersion, $LocalFileLocation, $ServerFileLocation $LocalFileLocation = RegRead("HKEY_CLASSES_ROOT\VirtualStore\MACHINE\SOFTWARE\WoW6432Node\Blizzard Entertainment\World of Warcraft","InstallPath"); Different for Win XP $ServerFileLocation = "\\10.202.160.145\exe\Server\" ; Server path which contains latest version of wow. $LocalVersion = FileGetVersion($LocalFileLocation & "wow.exe") ; Get Local Version of WoW $ServerVersion = FileGetVersion($ServerFileLocation & "wow.exe") ; Get Server Version of WoW - should be latest ;Is Current Version the latest? If $LocalVersion >= $ServerVersion Then TrayTip("Up to date", "You have the latest version of WoW installed", 5) sleep(3000) Exit ; Latest Version installed. EndIf Msgbox(0, "New Version Available"," New version available, you currently have: " & $LocalVersion & " and need to update to: " &$ServerVersion) $ServerFilesFolders = _FileListToArray($ServerFileLocation) ; get list of all files on server. $LocalFilesFolders = _FileListToArray($LocalFileLocation) ; get list of all files on local machine For $i = 1 to $ServerFilesFolders[0] If _ArraySearch($LocalFilesFolders, $ServerFilesFolders[$i]) = -1 Then ; search array from local machine with its current file/folder. If not found (-1) then.. ;A file on the Server doesn't exist on local machine TrayTip("Copying", "Currently copying file: " & $ServerFilesFolders[$i], 3) FileCopy($ServerFileLocation & $ServerFilesFolders[$i], $LocalFileLocation & $ServerFilesFolders[$i]) ;Example : \\server\folder\ & filename.exe , C:\Program Files\World of Warcraft\ & filename.exe EndIf Next TrayTip("Finished", "Finished Copying all required files and folders", 3) sleep(3000) Edited February 18, 2010 by Steveiwonder They call me MrRegExpMan
vtuls Posted February 17, 2010 Author Posted February 17, 2010 ok ill take a look at it tonight. it seems i have inspired you all to some creative thinking. a badly written code is better than a unwritten onea good written code is even better.but there is always room for improvement. :)
vtuls Posted February 17, 2010 Author Posted February 17, 2010 (edited) to install the updates the wow programm normally downloades the update to its own folder. after downloading it, it starts running the update every update is an executable. after the update the programm does not delete them. thats why i am able to coppy them from the base folder to my own server. Edited February 17, 2010 by vtuls a badly written code is better than a unwritten onea good written code is even better.but there is always room for improvement. :)
vtuls Posted February 17, 2010 Author Posted February 17, 2010 (edited) here again an update for my acomplishments of today. have updated the way my database will be written. have found a way to get my updates out of the folder now i need some way to select them and coppy them. but that ill do tomorrow night. let me now what you think of it expandcollapse popup; wow update manager. ; find the wow.exe file get its location. ; check with update list if there is an update. ; if there is get it from a centralized place ; #Include <File.au3> #Include <Array.au3> $dir = @ScriptDir $settings = $dir & "\settings.ini" $updatedb = "updates.txt" if FileExists($settings) = 0 then ;getting location $loc = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Blizzard Entertainment\World of Warcraft", "InstallPath") ;msgbox(0, "wow loc", $loc) ;writing location to settings.ini IniWrite($dir & "\settings.ini", "variables", "GameLocation",$loc) else $loc = IniRead($settings, "variables", "GameLocation","?") TrayTip("location", "got location: " & $loc,2) EndIf $updatearray = _FileListToArray($loc, "wow-*.exe",1) ;checking the update list if FileExists($dir & $updatedb) = 1 Then $file = FileOpen( $updatedb, 1) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf for $i = 0 to 100 step 1 $updatearray[$i] =FileReadLine($file,$i) Next Else msgbox(16,"Database Error", "could not find Database") ; no database found need to create one $file= fileopen($updatedb,1) for $i = 0 to 100 step 1 FileWriteLine($file,$updatearray) Next FileClose($file) EndIf _ArrayDisplay($updatearray) sleep(5000) Edited February 17, 2010 by vtuls a badly written code is better than a unwritten onea good written code is even better.but there is always room for improvement. :)
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