tqt129 Posted September 28, 2006 Share Posted September 28, 2006 I wrote a little script to run multiple programs at certain order. but i notice it wouldnt work for everyone because people instal ltheir programs on different path. is there a way to fix that? this is the code. of course it works fine for me because thats my path but if someone use it, i would have ot change it =0 run ("C:\Program Files\NetzeroVoIP\NZVoice.exe", "", @SW_MINIMIZE) sleep (8000) run ("C:\Program Files\PDT\VoIPVoiceIntegration\VoIPVoice Integration.exe") Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2006 Share Posted September 28, 2006 (edited) you can use RegRead() to find the correct location... and if it exists $temp_program = GetFile("\" & $process[$x]) Func GetFile($f1) RunWait(@ComSpec & ' /c ' & 'dir "' & @HomeDrive & $f1 & '" /a :h /b /s' & ' > "' & @TempDir & '\dir.txt"', '', @SW_HIDE) Sleep(1000) Return FileReadLine(@TempDir & "\dir.txt", 1) EndFunc 8) Edited September 28, 2006 by Valuater Link to comment Share on other sites More sharing options...
tqt129 Posted September 28, 2006 Author Share Posted September 28, 2006 you can use RegRead() to find the correct location... and if it exists $temp_program = GetFile("\" & $process[$x]) Func GetFile($f1) RunWait(@ComSpec & ' /c ' & 'dir "' & @HomeDrive & $f1 & '" /a :h /b /s' & ' > "' & @TempDir & '\dir.txt"', '', @SW_HIDE) Sleep(1000) Return FileReadLine(@TempDir & "\dir.txt", 1) EndFunc 8) i dont understand what its going on with this code heh. can you take the time to educate me =/ Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2006 Share Posted September 28, 2006 (edited) Ok $Temp_file ; a "changeable" variable $process[$x] ; is another ( in array format, but not necessary) can be just $process GetFile() ; calls a function "\" & $process[$x] ; add a slash before the process name ( ex... \notepad.exe ) ... inside the function RunWait(@ComSpec & ' /c ' & 'dir "' & @HomeDrive & $f1 & '" /a :h /b /s' & ' > "' & @TempDir & '\dir.txt"', '', @SW_HIDE) ; runs and waits for the dos command Dir ( directory ) to search for the $fl ( same as "\" & $process[$x] ) /a :h /b /s ; says to look in sub-folders and just return the files found ( no header etc ) > "' & @TempDir & '\dir.txt" ; says output the info found into a text file in the users temp folder Return FileReadLine(@TempDir & "\dir.txt", 1) ; returns the fist line read inside that temp file ok???? 8) Edited September 28, 2006 by Valuater Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 28, 2006 Share Posted September 28, 2006 (edited) i dont understand what its going on with this code heh. can you take the time to educate me =/ Valuater scripts on a higher metaphysical plane of existence than us mortals... I think he left a couple steps out. 1. Do you have registry keys you could be checking for the location of these .exe files? If so, you could RegRead() the appropriate keys for the file locations. 2. I think the code example he posted uses the exe file's name (somehow put in the $process[$x] array variable) in a DIR /S search of the operator's entire home drive. But, as I don't code on such higher planes, I could be wrong... Edit: We have The Revelation According To Valuater! Cool! P.S. All that step 2. stuff above is still not necesary if you can identify the right REG keys to get the path from. Edited September 28, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2006 Share Posted September 28, 2006 Valuater scripts on a higher metaphysical plane of existence than us mortals... But, as I don't code on such higher planes, I could be wrong... Edit: We have The Revelation According To Valuater! Cool!lol..... Just a hobbiest at heart8) Link to comment Share on other sites More sharing options...
tqt129 Posted September 28, 2006 Author Share Posted September 28, 2006 Ok $Temp_file ; a "changeable" variable $process[$x] ; is another ( in array format, but not necessary) can be just $process GetFile() ; calls a function "\" & $process[$x] ; add a slash before the process name ( ex... \notepad.exe ) ... inside the function RunWait(@ComSpec & ' /c ' & 'dir "' & @HomeDrive & $f1 & '" /a :h /b /s' & ' > "' & @TempDir & '\dir.txt"', '', @SW_HIDE) ; runs and waits for the dos command Dir ( directory ) to search for the $fl ( same as "\" & $process[$x] ) /a :h /b /s ; says to look in sub-folders and just return the files found ( no header etc ) > "' & @TempDir & '\dir.txt" ; says output the info found into a text file in the users temp folder Return FileReadLine(@TempDir & "\dir.txt", 1) ; returns the fist line read inside that temp file ok???? 8) hmm $Temp_file was not in the code you posted earlier, is it $temp_program you intend to type? Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2006 Share Posted September 28, 2006 (edited) hmm $Temp_file was not in the code you posted earlier, is it $temp_program you intend to type?yes... ( that was a test, lol ...... glad to see you were paying attention )8) Edited September 28, 2006 by Valuater Link to comment Share on other sites More sharing options...
tqt129 Posted September 28, 2006 Author Share Posted September 28, 2006 yes... ( that was a test, lol ...... glad to see you were paying attention )8)LoL well you got my attention but i still dont know how to work it.sighness ~_~. i get an error trying to run it Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2006 Share Posted September 28, 2006 post your code... then we can help you 8) Link to comment Share on other sites More sharing options...
tqt129 Posted September 28, 2006 Author Share Posted September 28, 2006 post your code... then we can help you8)im trying to do what the code i posted earlier. right now trying to figure out how to use that in the code you provide. heh Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2006 Share Posted September 28, 2006 ok... in your example you have a sleep(8000) is to wait for the first program to end or... ??? 8) Link to comment Share on other sites More sharing options...
tqt129 Posted September 28, 2006 Author Share Posted September 28, 2006 ok... in your example you have a sleep(8000)is to wait for the first program to end or... ???8)no actually the second program will only work if the first program load.so i just put load time to make sure it loads Link to comment Share on other sites More sharing options...
Helge Posted September 28, 2006 Share Posted September 28, 2006 Open up regedit.exe and go to "HKEY_LOCAL_MACHINE\SOFTWARE\". Check if you can find the applications' names listed there and see if there are some keys that specifies where they are installed. You then use this information in RegRead. Example for AutoIt : $path = RegRead("HKLM\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") MsgBox(64, "", $path) Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 28, 2006 Share Posted September 28, 2006 no actually the second program will only work if the first program load.so i just put load time to make sure it loadsQuoting Valuator in post #2:you can use RegRead() to find the correct location...Quoting me from post #5:1. Do you have registry keys you could be checking for the location of these .exe files? If so, you could RegRead() the appropriate keys for the file locations.P.S. All that step 2. stuff above is still not necesary if you can identify the right REG keys to get the path from.Quoting Helge from post #14:Open up regedit.exe and go to "HKEY_LOCAL_MACHINE\SOFTWARE\". Check if you canfind the applications' names listed there and see if there are some keys that specifieswhere they are installed. You then use this information in RegRead.Do you see a pattern here?I see a pattern here.There just might be a pattern here... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2006 Share Posted September 28, 2006 What pattern???? lol 8) I like that post Salty Link to comment Share on other sites More sharing options...
Nezoic Posted September 28, 2006 Share Posted September 28, 2006 No sense in reinventing the wheel... $p = @ScriptDir msgbox(0,"Programs Path!", "RIGHT HERE - >" &$p) Link to comment Share on other sites More sharing options...
tqt129 Posted September 28, 2006 Author Share Posted September 28, 2006 (edited) Quoting Valuator in post #2:Quoting me from post #5:Quoting Helge from post #14:Do you see a pattern here?I see a pattern here.There just might be a pattern here... I do have it on registry..sorry i didnt mention it earlier. it is in C:\NetZeroVoice for install path . HKEY_LOCAL_MACHINE\SOFTWARE\NetZeroVoIP Edited September 28, 2006 by tqt129 Link to comment Share on other sites More sharing options...
Nezoic Posted September 28, 2006 Share Posted September 28, 2006 I do have it on registry..sorry i didnt mention it earlier. it is in C:\NetZeroVoice for install path . HKEY_LOCAL_MACHINE\SOFTWARE\NetZeroVoIPDid you read my post? @ScriptDir = wherever the script is running, even after you complie it the macro still functions. You can do it from the registry, but this is much easier Link to comment Share on other sites More sharing options...
Helge Posted September 28, 2006 Share Posted September 28, 2006 No sense in reinventing the wheel...tqt129 shows a script that runs two files from two different folders. For your idea to work the script would have to be placed in the same folder as both of the program- files at the same time, making @ScriptDir magically return the correct path at the right time, which I believe is pretty impossible...hmm, yep. HKEY_LOCAL_MACHINE\SOFTWARE\NetZeroVoIPWhat's the "valuename" ?$path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\NetZeroVoIP", "ValueNameHerePlease") 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