Sign in to follow this  
Followers 0
tqt129

PATH question

30 posts in this topic

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")

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

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 =/

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (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... :P

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 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

Share this post


Link to post
Share on other sites

Valuater scripts on a higher metaphysical plane of existence than us mortals... :D

But, as I don't code on such higher planes, I could be wrong... :)

Edit: We have The Revelation According To Valuater! Cool!

lol..... :P

Just a hobbiest at heart

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

post your code... then we can help you

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

post your code... then we can help you

8)

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

Share this post


Link to post
Share on other sites

ok... in your example you have a sleep(8000)

is to wait for the first program to end or... ???

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

no actually the second program will only work if the first program load.so i just put load time to make sure it loads

Quoting 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 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.

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

Share this post


Link to post
Share on other sites

What pattern????

lol

8)

I like that post Salty


NEWHeader1.png

Share this post


Link to post
Share on other sites

No sense in reinventing the wheel...

$p = @ScriptDir
msgbox(0,"Programs Path!", "RIGHT HERE - >" &$p)

Share this post


Link to post
Share on other sites

#18 ·  Posted (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 by tqt129

Share this post


Link to post
Share on other sites

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

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 :)

Share this post


Link to post
Share on other sites

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\NetZeroVoIP

What's the "valuename" ?
$path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\NetZeroVoIP", "ValueNameHerePlease")

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0