tqt129 Posted September 28, 2006 Author Share Posted September 28, 2006 Did 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 yea i did read it. i ran it and i see that its showing the directory the script is on. but im not sure this is what i need. let me try to explain again. with the lame lil 2 liners i posted earlier it works just fine for me. so when i send it to my friend, it wouldnt work because the directory for those programs he installed is somewhere else. So because of that i would have to find a way for it to run without me giving the full path and from what i was reading from you guys saying to use regread? that is where i dont understand what it suppose to do. I am assuming that it suppose to read where the NZVOICE.EXE is install from the registry and then use that value to pass it on to the script? Link to comment Share on other sites More sharing options...
tqt129 Posted September 28, 2006 Author Share Posted September 28, 2006 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. What's the "valuename" ?$path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\NetZeroVoIP", "ValueNameHerePlease")[HKEY_LOCAL_MACHINE\SOFTWARE\NetZeroVoIP\CurrentVersion] "InstallPath"="C:\\NetZeroVoice" Link to comment Share on other sites More sharing options...
Helge Posted September 28, 2006 Share Posted September 28, 2006 Eehm...replace "ValueNameHerePlease" with "InstallPath" If $path equals "" then the valuename wasn't found. Link to comment Share on other sites More sharing options...
Nezoic Posted September 28, 2006 Share Posted September 28, 2006 Ahh whoops, unwound a lil too fast from work Assuming the other program is in the registry as well, you'd need both of them right? Just read...http://www.autoitscript.com/autoit3/docs/f...ons/RegRead.htm Link to comment Share on other sites More sharing options...
tqt129 Posted September 28, 2006 Author Share Posted September 28, 2006 Eehm...replace "ValueNameHerePlease" with "InstallPath" If $path equals "" then the valuename wasn't found. cant i do something like $path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\NetZeroVoIP\CurrentVersion", "InstallPath") run($path\NZVoice.exe) something like that? heh Link to comment Share on other sites More sharing options...
Helge Posted September 28, 2006 Share Posted September 28, 2006 (edited) RegRead() can fail to return the wanted path if the "valuename" is missing or other errors occur, which would make Run() produce an error as it can't find the file. This code below will check that the RegRead didn't fail and that the file actually exists. Also, you must note that you can't use variables in strings just like that...also, you forgot the quotes.$path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\NetZeroVoIP\CurrentVersion", "InstallPath") If $path = "" OR NOT FileExists($path & "\NZVoice.exe") Then MsgBox(16, "Error", "Couldn't find NetZeroVoIP !") Exit Else Run($path & "\NZVoice.exe") EndIf Edited September 28, 2006 by Helge Link to comment Share on other sites More sharing options...
tqt129 Posted September 28, 2006 Author Share Posted September 28, 2006 RegRead() can fail to return the wanted path if the "valuename" is missing or other errors occur, which would make Run() produce an error as it can't find the file. This code below will check that the RegRead didn't fail and that the file actually exists. Also, you must note that you can't use variables in strings just like that...also, you forgot the quotes.$path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\NetZeroVoIP\CurrentVersion", "InstallPath") If $path = "" OR NOT FileExists($path & "\NZVoice.exe") Then MsgBox(16, "Error", "Couldn't find NetZeroVoIP !") Exit Else Run($path & "\NZVoice.exe") EndIf ah that works..too bad i cant find the install path in the registry for the other program sigh... Link to comment Share on other sites More sharing options...
Richard Robertson Posted September 28, 2006 Share Posted September 28, 2006 I see no one thought of looking in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. That is the list of programs that can be uninstalled through Control Panel. Any good installer puts an entry there. Link to comment Share on other sites More sharing options...
Nezoic Posted September 28, 2006 Share Posted September 28, 2006 I was bored and took a look at valuaters code and simplified it a bit. dim $process $program_Dir = "\VoIPVoiceIntegration" $program_EXE = "\VoIPVoice Integration.exe" $temp_program = GetFile($program_EXE & $process) ;find the folder or replace \test123 with $program_exe below msgbox(0, "", $temp_program) Func GetFile($f1) ;Commented out first one to search for just the directory (faster search) but if dir was changed during install... you get the pic. ;RunWait(@ComSpec & ' /c ' & 'dir "' & @HomeDrive & $f1 & '" /a :h /b /s /ad' & ' > "c:\dir.txt"', '') RunWait(@ComSpec & ' /c ' & 'dir "' & @HomeDrive & $f1 & '" /a :h /b /s' & ' > "c:\dir.txt"', '') Sleep(1000) Return FileReadLine("c:\dir.txt", 1) ;delete dir.txt in cleanup (put in root because temp folder access may be restricted EndFunc Hope this makes a little more sense. if not try running cmd then do type "dir VoIPVoiceIntegration /s /ah /b" and you might get a better idea of what it is doing exactly. Which is just searching your entire home driver wich for general home users would be c: if you search for the .exe it will take a little longer since it's checking every file instead of just the directories, but you'll definitly find it. Link to comment Share on other sites More sharing options...
tqt129 Posted September 29, 2006 Author Share Posted September 29, 2006 (edited) ah this actually work. thanks alot everyone. thank you all for replying =) Edited September 29, 2006 by tqt129 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