Jump to content

How to Pass two arguments in shellExecuteWait?


Recommended Posts

also, your variables should be before your shellexecute

to check if you have everything formatted correctly you can output to console while in the scite editor...

$Aircraft="aircraft"

$sheet_name="sheet_name"

$myString = @ScriptDir & '\EVM.exe ' & $Aircraft & ' | ' & $sheet_name

ConsoleWrite($myString)

 

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
Share on other sites

@alienclone

 

Thanks for your reply.

i want to use Aircraft and sheet_name in another autoit script.

when i use the $sheet_name it gets appended with the  $Aircraft value  like this :    aircraft|sheet_name

however i want only sheet_name.

 

Edited by spoo
Link to comment
Share on other sites

$CmdLine[0] returns the number of parameters, so for the command above it should return the following, if aircraft or sheet has spaces then make sure you enclose in quotes ""

$CmdLine[0] = 2
$CmdLine[1] = Aircraft
$CmdLine[2] = Sheet

Another way is to use the following UDF, might be overkill for this, but I use the udf frequently.

Using something like, just compile and run:
Usage: ShellExecute("Script.exe", "--Aircraft "Aircraft Value" "--Sheet "Sheet Value" ;~ Quotes only required if value includes spaces
 

#include <CmdLine.au3>

Global $g_sResult = ""

If _CmdLine_Get("Aircraft") <> Null Then $g_sResult &= "Aircraft = " & _CmdLine_Get("AirCraft") & @CRLF
If _CmdLine_Get("Sheet") <> Null Then $g_sResult &=  "Sheet = " & _CmdLine_Get("Sheet") & @CRLF

;~ Debugging/Testing purposes
Global $g_bDebug = _CmdLine_FlagExists("Debug") ? False : True
If $g_bDebug Then
    ShellExecute(@ScriptFullPath, '/Aircraft "aircraft with whitespace" /Sheet "sheet with white space" -Debug')
EndIf
If $g_sResult <> "" Then MsgBox(4096, "Results", $g_sResult)

 

Link to comment
Share on other sites

45 minutes ago, Subz said:

$CmdLine[0] returns the number of parameters, so for the command above it should return the following, if aircraft or sheet has spaces then make sure you enclose in quotes

i see that i completely misunderstood the question, i thought they were trying to pass arguments TO the shellexecute line

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

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