Jump to content

Recommended Posts

Posted (edited)

$Pass = IniRead(@ProgramFilesDir & "\AppData\$~settings.ini", "Password")
Run(@ProgramFilesDir & "\AppData\sda.exe" & $Password)

As you might have noticed, I'm trying to send my program a variable but I can't quite seem to get this right...

How would you go about doing this? @comspec or something?

Edit: My variable is suposed to be a command line argument e.g = Start C:\Program Files\AppData\sda.exe 12345

where as 12345 = $password

Edited by xJSLRx
Posted (edited)

if not StringInStr(FileGetAttrib(@ProgramFilesDir & "\AppData\"),"D") then DirCreate(@ProgramFilesDir & "\AppData\")
IniWrite(@ProgramFilesDir & "\AppData\$~settings.ini", "Settings", "Password", "12345")

$sFilename_Exe = @ProgramFilesDir & "\AppData\sda.exe"
$Password = IniRead(@ProgramFilesDir & "\AppData\$~settings.ini", "Settings", "Password", "")

If $Password Then
    If FileExists($sFilename_Exe) Then
        Run($sFilename_Exe & " " & $Password)
    Else
        ConsoleWrite("! " & $sFilename_Exe & " not found" & @CRLF)
    EndIf
Else
    ConsoleWrite("! Password not set" & @CRLF)
EndIf

Edit: Added some checks.

Edited by KaFu
Posted

xJSLRX,

Looks like you are passing on the password...look at the code carefully and you will see what I mean.

Happy New Year !!!

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted (edited)

if not StringInStr(FileGetAttrib(@ProgramFilesDir & "\AppData\"),"D") then DirCreate(@ProgramFilesDir & "\AppData\")
IniWrite(@ProgramFilesDir & "\AppData\$~settings.ini", "Settings", "Password", "12345")

$sFilename_Exe = @ProgramFilesDir & "\AppData\sda.exe"
$Password = IniRead(@ProgramFilesDir & "\AppData\$~settings.ini", "Settings", "Password", "")

If $Password Then
    If FileExists($sFilename_Exe) Then
        Run($sFilename_Exe & " " & $Password)
    Else
        ConsoleWrite("! " & $sFilename_Exe & " not found" & @CRLF)
    EndIf
Else
    ConsoleWrite("! Password not set" & @CRLF)
EndIf

Edit: Added some checks.

I see the trick was in & " " &

Thanks KaFu, this was very helpful.

happy new year! Posted Image

Edited by xJSLRx

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
  • Recently Browsing   0 members

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