Jump to content

Problem with RegRead()


Recommended Posts

Hi Guys,

I have a problem using the RegRead()-function.

If I read a RegKey, for example the path of a Program, like this:

$var = RegRead("HKEY_CURRENT_USER\Software\MirandaFusion","")

MsgBox(0,"Path",$var)

Run("miranda32.exe", $var)

Here the function returns : "C:\Program Files\MirandaFusion" in the MessageBox.

That´s ok. But when I try to give the path (in $var) to the funtion Run(). It doesn´t work.

My intention is to search for the path of an application an then to start the Program in this path.

I would be pleased if somebody could give me an advice how it could work?

Thank U

DirtyDan "Newbie"

Link to comment
Share on other sites

That´s ok. But when I try to give the path (in $var) to the funtion Run(). It doesn´t work.

More information is needed on what doesn't work about it. Is there an error? What is not working? Please describe.

Link to comment
Share on other sites

More information is needed on what doesn't work about it. Is there an error? What is not working? Please describe.

Sry, I forgot.

No there´s no Error-Message or something.

When I know the path and type:

Run("example.exe",example_path)

Everything is fine.

But if I dont nothing happens.

Greetz DirtyDan

Link to comment
Share on other sites

Maybe you should try this one:

CODE
Run( $var & "\miranda32.exe", $var)

gkrapp has it right. $var is only the directory path so you need to append the filename.extension as shown in his example.

Link to comment
Share on other sites

gkrapp has it right. $var is only the directory path so you need to append the filename.extension as shown in his example.

Sorry it was my mistake.

It works. I just typed the wrong path for the registry.

Thank U very much.

Greetz DirtyDan

Link to comment
Share on other sites

shot in the dark ...

Run("miranda32.exe",$var & "\")

If not perhaps look into RunAs().

No. The path is still missing in Run.

If StringRight($Var, 1) = "\" Then $Var = StringTrimRight($Var, 1)
$App = $Var & "\miranda32.exe"
If NOT FileExists($App) Then
   MsgBox(0, "File Error", "The path to the application is incorrect")
   Exit
EndIf
Run($App, $Var)

EDIT: Minor code change.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

The shot in the dark was guessing what he had tried to result in it not working. muttley

You´re totally right. ;-)

I tried, but it didnt work, but I think he posted 1 minute before me. ^^

You are good Guys, I think the next time I´m going to ask the one or other question. Today I started scripting with AutoIt.

And I think it´s very nice. And it works great, if U know what to type in^^

Greetz DirtyDan

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...