Jump to content

Compile exe allowing input


Recommended Posts

I am new to autoit but have been using vbscript for a while. I need some help with this.

I want to use the RunAsSet and compile it as an executable but I would like the executable to take some varialbles, if possable.

IE: AppInstall.exe -PATH -PASSWORD

where:- PATH = path of executable to run

PASSWORD = of user with rights to install

RunAsSet("adminuser", @Computername, "PASSWORD")

RunWait('PATH')

RunAsSet()

Link to comment
Share on other sites

Hi bobuk,

Command Line Parameters.

; Check $CMDLINE[0] for parameter count
If $CMDLINE[0] = 2 Then
    ; Assign 1st parameter to $path
    $path = $CMDLINE[1]
    ; Assign 2nd parameter to $password 
    $password = $CMDLINE[2]
    ;
    RunAsSet("adminuser", @Computername, $password)
    RunWait($path)
    RunAsSet()
EndIf

$CMDLINE is reserved for incoming parameters and used as an array. Test against $CMDLINE[0] for array count before attempting to use the array.

:D

Link to comment
Share on other sites

Hi bobuk,

Command Line Parameters.

; Check $CMDLINE[0] for parameter count
If $CMDLINE[0] = 2 Then
    ; Assign 1st parameter to $path
    $path = $CMDLINE[1]
    ; Assign 2nd parameter to $password 
    $password = $CMDLINE[2]
    ;
    RunAsSet("adminuser", @Computername, $password)
    RunWait($path)
    RunAsSet()
EndIf

$CMDLINE is reserved for incoming parameters and used as an array. Test against $CMDLINE[0] for array count before attempting to use the array.

:D

Thanks, wow, it is so easy. I think I will be using AutoIT more and more.
Link to comment
Share on other sites

That is OK. I would recommend AutoIt along with your VBScript use. You can make use of AutoitX.dll that comes along with the standard AutoIt install to enhance your VBScripts where needed also.

Ensure you get yourself a copy of the Beta AutoIt Installer which has Com, ActiveX and StdOutRead/InWrite handling added.

:D

Edit: In case Nutster reads this, Autoit Beta has inbuilt Regular expressions support and all the rest I may have failed to credit. :D

Edit2: Out and In as in summary above for STD?Read/?Write...

Edited by MHz
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...