Sign in to follow this  
Followers 0
Skitty

Command line arg's to program

5 posts in this topic

#1 ·  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

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites



#2 ·  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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

kafu,

You're no fun after an all nighter on new years eve... :x

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

Share this post


Link to post
Share on other sites

#5 ·  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

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

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