Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Shell.AddArgument
Adds an argument.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Shell | 7.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No |
Parameters
Parameter | Description | Example |
---|---|---|
ShellRef | The reference number from the shell. | $shell |
Argument... | The new argument. | "-l" |
Result
Returns OK or error.
Description
Adds an argument.This argument is added to the list of arguments passed first on each call to Shell.Execute.
With version 8.3, you can add several arguments here.
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.
Please repeat Argument parameter as often as you need.
Examples
Adds an argument:
MBS( "Shell.AddArgument"; $shell; "-v" )
Send email via Outlook.exe with options via command line:
Set Variable [ $app ; Value: "C:\Program Files (x86)\Microsoft Office\Office15\OUTLOOK.EXE" ]
Set Variable [ $attachment ; Value: "C:\Users\Administrator\Desktop\test.jpg" ]
Set Variable [ $to ; Value: "to@test.com" ]
Set Variable [ $subject ; Value: "Test Email" ]
Set Variable [ $cc ; Value: "copy@test.com" ]
Set Variable [ $body ; Value: "Hello World" ]
Set Variable [ $shell ; Value: MBS( "Shell.New" ) ]
Set Variable [ $s ; Value: MBS( "Shell.AddArgument"; $shell; "/c" ) ]
Set Variable [ $s ; Value: MBS( "Shell.AddArgument"; $shell; "ipm.note" ) ]
If [ not IsEmpty ( $attachment ) ]
Set Variable [ $s ; Value: MBS( "Shell.AddArgument"; $shell; "/a" ) ]
Set Variable [ $s ; Value: MBS( "Shell.AddArgument"; $shell; $attachment ) ]
End If
Set Variable [ $s ; Value: MBS( "Shell.AddArgument"; $shell; "/m" ) ]
Set Variable [ $a1 ; Value: MBS( "Text.EncodeURLComponent"; $to; "UTF-8" ) ]
Set Variable [ $a2 ; Value: "?subject=" & MBS( "Text.EncodeURLComponent"; $subject; "UTF-8" ) ]
Set Variable [ $a3 ; Value: If ( Length ( $cc ) > 0 ; "&cc=" & MBS( "Text.EncodeURLComponent"; $cc; "UTF-8" ); "" ) ]
Set Variable [ $a4 ; Value: If ( Length ( $body) > 0 ; "&body=" & MBS( "Text.EncodeURLComponent"; $body ; "UTF-8" ) ; "") ]
Set Variable [ $s ; Value: MBS( "Shell.AddArgument"; $shell; $a1 & $a2 & $a3 & $a4) ]
Set Variable [ $s ; Value: MBS( "Shell.Execute"; $shell; $app) ]
Set Variable [ $r ; Value: MBS("Shell.Release"; $shell) ]
Adds three arguments:
MBS( "Shell.AddArgument"; $shell; "-v"; "-r"; "-e" )
Add parameters various ways:
Set Variable [ $shell ; Value: MBS( "Shell.New" ) ]
# set some parameters to go always:
Set Variable [ $r ; MBS( "Shell.SetArguments"; $shell; "-a"; "test" )
# add optional parameter
If [ $Verbose ]
Set Variable [ $r ; MBS( "Shell.AddArgument"; $shell; "-v" )
End If
# now run command here and pass some more parameters
Set Variable [ $s ; Value: MBS( "Shell.Execute"; $shell; $executable; $InputFile; $OutputFile) ]
See also
- Shell.Execute
- Shell.GetArgument
- Shell.GetArguments
- Shell.New
- Shell.Release
- Shell.SetArguments
- Text.EncodeURLComponent
Example Databases
Blog Entries
This function checks for a license.
Created 11st November 2017, last changed 15th September 2024