Jump to content

Get parameters sent to autoit program


Crash
 Share

Recommended Posts

Hi, let's don't beat about the bush and cut straight to the topic.

I have 2 files. One main.exe and one action.exe (both autoit programs)

Main.exe will interact with users and sends commands to action.exe and action.exe is supposed to carry out the actions.

So like if I want action to do action 1, I will execute it like this:

ShellExecute("action.exe", "1")

But the problem now is, how do action.exe know the parameter? I mean, how to make it READ the parameter?

Pls Please help me

If you're asking me why I want to make them into 2 separate files instead of one. It's simple: because of UAC problems. action.exe will request admin rights and main.exe don't.

So anyway, pls please help me!!! Thanks in advance!! ;)

Edited by Crash

JPGRARMouse Lock | My website | Thanks so much for your help! ❤️

Link to comment
Share on other sites

  • Moderators

Crash,

Look in the Help file under <Using AutoIt - Command Line Parameters>. ;)

M23

P.S. Sorry I can't be more help, but to say that your word "please" is spelled wrongly - twice! Reference :evil:

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I have a script (actually it's compiled, but I don't think it makes a difference) that is executed by running a ShellExecute from another script. The calling script passes parameters thru ShellExecute (like you are doing), and the called script processes those as command line arguments. Here is the code I'm using in the called script to do that.

If $CmdLine[0] > 1 Then
    $CountdownToDate1 = $CmdLine[1]
    $CountdownToDate2 = $CmdLine[2]
    $AlarmDateTime = $CmdLine[3]
    ;MsgBox(0, "", $AlarmDateTime & @LF & $CountdownToDate1 & " " & $CountdownToDate2)
EndIf
Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

This might help you?

At the begging of my script after my variable declaration I put this:

$cmd = UBound($CmdLine) - 1

If $CmdLine[0] = 0 Then
Else
    ReadCmdLineParams()
EndIf

The function below then reads the command line parameters and act accordingly.

Func ReadCmdLineParams()
    For $i = 1 To $cmd
        Select
            Case $CmdLine[$i] = "-reset"
                what_ever_you_want()
                Exit
            Case $CmdLine[$i] = "-shutdown"
                what_ever_you_want()
                Exit
            Case Else
                cmdLineHelpMsg()
        EndSelect
    Next
EndFunc   ;==>ReadCmdLineParams

This works for me...

Edited by PeterAtkin

[topic='115020'] AD Domain Logon Script[/topic]

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