Shyke Posted September 12, 2005 Share Posted September 12, 2005 I was using the "Run" command and I had encountered a problem that I am guessing you guys would have a relatively easy time fixing. I need the program to prompt the person to search for a specific program on thier pc and when they find the executable file then it should save this information to a small .dat file and then the program should be able to use that file path from there with Run... have any idea's? Link to comment Share on other sites More sharing options...
Valuater Posted September 12, 2005 Share Posted September 12, 2005 (edited) is this an addition to your original script??? does it have an area to place an inputbox???? do you want a separate input box??? 8) Edited September 12, 2005 by Valuater Link to comment Share on other sites More sharing options...
BigDod Posted September 12, 2005 Share Posted September 12, 2005 I was using the "Run" command and I had encountered a problem that I am guessing you guys would have a relatively easy time fixing.I need the program to prompt the person to search for a specific program on thier pc and when they find the executable file then it should save this information to a small .dat file and then the program should be able to use that file path from there with Run... have any idea's?<{POST_SNAPBACK}>Read up on FileOpenDialog in the help files Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Shyke Posted September 12, 2005 Author Share Posted September 12, 2005 Wow! FileOpenDialog answered all my questions in one step except for how do you get it to write the path to registry or a .dat file and instead of always asking it can just read it from there after the first launch? Link to comment Share on other sites More sharing options...
BigDod Posted September 12, 2005 Share Posted September 12, 2005 Wow!FileOpenDialog answered all my questions in one step except for how do you get it to write the path to registry or a .dat file and instead of always asking it can just read it from there after the first launch?<{POST_SNAPBACK}>Now lookup FileWrite Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Shyke Posted September 12, 2005 Author Share Posted September 12, 2005 Another problem... Here is the Code: If Not FileExists("restarter.dat") Then $pathfind = FileOpenDialog("Where is your loader?", "C:\", "Loader (*.exe)", "3", "loader.exe") FileWrite("restarter.dat", "" & $pathfind) $path = FileRead("restarter.dat", 100) Else $path = FileRead("restarter.dat", 100) EndIf Here is the problem: The thing only writes a 1 to the file instead of the path and at another part WinActivate($path) doesn't work, can anyone help? Link to comment Share on other sites More sharing options...
BigDod Posted September 12, 2005 Share Posted September 12, 2005 Another problem... Here is the Code:If Not FileExists("restarter.dat") Then $pathfind = FileOpenDialog("Where is your loader?", "C:\", "Loader (*.exe)", "3", "loader.exe") FileWrite("restarter.dat", "" & $pathfind) $path = FileRead("restarter.dat", 100) Else $path = FileRead("restarter.dat", 100) EndIfHere is the problem: The thing only writes a 1 to the file instead of the path <{POST_SNAPBACK}>This writes to the file properly on my computer, are you using the Beta version. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Shyke Posted September 12, 2005 Author Share Posted September 12, 2005 (edited) No, I am using the stable version. EDIT: I tried the beta and still a no go and the program should always make the .dat if there is no restarter.dat in the AutoIt program folder. EDIT2: It does write it, but does it read it too from that folder? Edited September 12, 2005 by Shyke Link to comment Share on other sites More sharing options...
Valuater Posted September 12, 2005 Share Posted September 12, 2005 this will do the trick expandcollapse popupDim $path, $file, $t Dim $Loc = "C:\Temp\restarter.txt" While 1 If Not FileExists($Loc) Then $pathfind = FileOpenDialog("Where is your loader?", "C:\", "Loader (*.exe)", "3", "loader.exe ") If $pathfind <> "" Then $file = FileOpen($Loc,1) FileWrite($file, $pathfind) FileClose($file) Else MsgBox(0,"Sorry"," You need to place a *loader.exe* to start this program ") EndIf EndIf If FileExists($Loc) Then $file = FileOpen($Loc, 0) $path = FileReadLine($file, 1) FileClose($file) If @error then MsgBox(0, "sorry","the file/info was is not found ") If StringInStr($path, ".exe") Then MsgBox(0,"test worked", $path ) $ans = MsgBox(68,"Replace?", "Would you like to replace the current *loader.exe* ? ") If $ans = 6 Then FileDelete($Loc) Else $t = 11 ExitLoop EndIf EndIf Else MsgBox(0,"Sorry", " the correct exe path was not found") FileDelete($Loc) EndIf WEnd If $t = 11 Then MsgBox(0,"YEPPER!!!", "this test was a SUCCESS!!!!!") hope that helps 8) Link to comment Share on other sites More sharing options...
Shyke Posted September 13, 2005 Author Share Posted September 13, 2005 I will edit that a bit and make it work. Thank-you alot and expect to hear another problem *sigh*. Link to comment Share on other sites More sharing options...
Shyke Posted September 13, 2005 Author Share Posted September 13, 2005 Haha! The whole program as one works extremely well except for the fact that the script seems to grab other open windows and maximize it in the process... Is there anyway that we could do the whole thing in the background? Script: expandcollapse popupHotKeySet("{ESC}", "Terminate") Dim $path, $file, $t Dim $Loc = "C:\Temp\restarter.txt" While 1 If Not FileExists($Loc) Then $pathfind = FileOpenDialog("Where is your loader?", "C:\", "Loader (*.exe)", "3", "loader.exe") If $pathfind <> "" Then $file = FileOpen($Loc, 1) FileWrite($file, $pathfind) FileClose($file) Else MsgBox(0, "WoW Server Restarter", "You must specify the location of your loader.") EndIf EndIf If FileExists($Loc) Then $file = FileOpen($Loc, 0) $path = FileReadLine($file, 1) FileClose($file) If @error Then MsgBox(0, "WoW Server Restarter", "The specified file/information was not found.") If StringInStr($path, ".exe") Then ExitLoop EndIf Else MsgBox(0, "WoW Server Restarter", "The loader was not found at that directory.") FileDelete($Loc) EndIf WEnd MsgBox(0, "WoW Server Restarter", "Running WoW server and minimizing..." & @CRLF & "DTW Build") While 1 Sleep(1500) Start_WoW() WEnd Func Start_WoW() If Not ProcessExists("wowemu.exe") Then Sleep(500) Run($path) EndIf Sleep(500) WinActivate($path) WinWait("") WinSetState("", "", @SW_MAXIMIZE) If WinExists($path) Then WinKill($path) EndIf $pixel = PixelGetColor(93, 95) If $pixel = 16776960 Then ProcessClose("wowemu.exe") EndIf EndFunc Func Terminate() Exit 0 EndFunc Well, yeah that is the entire script that I ahve been working on with the help of you guys over the last two weeks... Link to comment Share on other sites More sharing options...
MrSpacely Posted September 13, 2005 Share Posted September 13, 2005 No, I am using the stable version.EDIT: I tried the beta and still a no go and the program should always make the .dat if there is no restarter.dat in the AutoIt program folder.EDIT2: It does write it, but does it read it too from that folder?<{POST_SNAPBACK}>Stable version hehe I had the stable version once with a small script and it crashedreally weird I removed a line and it crashed beta version it worked fineAnd I made it on the stable version so never used any beta functions.Although i stepped to beta much more stable the the stable version;) 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