KB-133318: call

call

The call command can be used to execute applications. The command allows you to use the following configuration options when executing a script application:

  • Formulation of any number of call arguments
  • Determine whether the script should wait until the end of the execution of the application and how long it should wait
  • Determine the directory in which scripts are executed
  • conditions when to go through with the call command and when to ignore it

Syntax:

call `<Application>`
{
    [arg `<Argument>`]
    [arg.nomarks `<Argument>`]
    [wait `<Milliseconds>`]
    [rundir `<absolute path>`]
    [iftrue `<Condition>`]
    [iffalse `<Condition>`]
}

Applications can be executed in the following ways:

  • Via the name of the application

call vdscriptEmailNotification.exe

Note

If call is used in this way, the application must exist in the same script directory as the SCRIPT file.

  • Via the absolute path

call C:WindowsSystem32notepad.exe

  • Via the MS-DOS command

call cmd::net use

This command can be configured using a script:

arg / arg.nomarks

The following value is given using quotation marks.

Example:

argC:path with spacestest folder

transmits -> “C:path with spacestest folder

Via arg and arg.nomarks, you can use numerous execution arguments to call up application(s).

Arguments may contain key words which are taken directly from the runtime of the interpreter. If an argument is defined using arg, the information it contains will be put into quotation marks (” “). If the argument is defined using “arg.nomarksâ€, information it contains will not be put into quotation marks.

Argument definition in the scrip Passing the argument to the applicatio
arg``C:path with spacesTest </samp C:path with spacesTest
arg.nomarks -u Username -u Usernam

wait

Sets the delay time (in milliseconds) between the application being called up and the execution of the next script command.

Possible values:

  • 0: The next script command will be executed without needing to wait until the end of the execution of the application
  • n: The next script command will be executed after `milliseconds OR after the end of the execution of the application

Note

If the wait argument is used without a value or omitted altogether, the system waits until the called application has completed its task.

Example:

call cmd::net use { arg $def::var2 wait 0 rundir $def::var1 }

rundir

Determines in which directory the called application should be executed from.

Possible values:

  • rundir<absolute path to the directory>: The folder will be used as an execution directory
  • rundir<absolute path to a file>: The directory in which the given file is located is used as the execution directory.

Note

If the argument rundir is left, the scripting directory is used as the execution directory.

iftrue/iffalse

Sets the conditions that need to be fulfilled so that the execution can take place

A condition can be formulated via iftrue or iffalse so that the call is only executed if the condition is fulfilled (iftrue) or not fulfilled (iffalse). The following applies:

  • No condition is set as standard. This means that the execution is always carried out
  • Multiple conditions are connected by a logical AND

Note

If the arguments iftrue and iffalse are not included, the call will always be carried out.

Example 1

Function ScriptBeforeUpload
{
call ExampleApplication.exe
{
arg /Addr: $vdog::uploadjob->5002
arg /Account:TestAccount
arg /Password:abcdef
arg /DirDst: $vdog::specific->dirbackup
arg /PathLog: $vdog::logfile
arg /Lang: $vdog::language
}
done
}

In this example, the call command creates the following command:

ExampleApplication.exe "/Addr :`<IP>`†"/Account:TestAccount†"/Password:abcdef†“/DirDest :`<Directory for the backup>`†"/PathLog :`<Logdatei>`†“/Lang :`<Language-Id>`â€

Note

Please note that:

  • <samp>ExampleApplication.exe`needs to exist in the scripting directory
  • <IP>taken from the job configuration of the job (from a UNC job)
  • <Directory for the backup>set by the versiondog system. This is the directory whose contents will be packed and saved as Backup.zip after the upload.
  • <Log file>an exchange file for ScriptBeforeUpload, used to transfer information to the job result. The log file (path and name) is taken from the upload script from the versiondog system (see also $vdog::logfile)
  • <Language-ID>contains the current language of the versiondog system

Example 2

Function ScriptBeforeUpload
{
def::var1 = \$vdog::uploadjob->5002d$Data

call cmd::net use
{
arg.nomarks $def::var1
arg.nomarks $vdog::uploadjob->5004decode
arg.nomarks /user:$vdog::uploadjob->5003decode
arg.nomarks /persistent:no
}

dir.copy
{
source $def::var1
dest $vdog::specific->dirbackupData
spec *.prd|*.dat
}

dir.copy
{
source $def::var1ReferenceImages
dest $vdog::specific->dirbackupDataReferenceImages
}

call cmd::net use
{
arg.nomarks $def::var1
arg.nomarks /delete
}
done
}

In this example, the call command creates the following command:

net use `<Network directory>` `<Password>` /user :`<User>` /persistent:no

Note

Please note that the authentication is encoded. The password is passed to the call via ($vdog::uploadjob->5004decode) and the user is passed decoded from the job configuration via ($vdog::uploadjob->5003decode).

Example 3

Function ScriptBeforeEdit
{
// some logic to determine the editor
$def::var1 = `<determine editor, for example, notepad.exe>`

//exit script and continue with default logic, if no editor could be determined
exit.ifemptyvar $def::var1
// open selected file directly in editor
$def::var2 = $vdog::specific->WorkingDir$vdog::specific->SelectedFile
// launch editor, but don’t wait
call $def::var1
{
arg $def::var2
wait 0
rundir $def::var1
}
// editor is launched, no default logic needed
done
}

In this example, the call command generates the following call:

notepad.exe `<Project file>`

Note

Please note that:

  • The command does not wait for the editor to close. More often, the script is ended at the very end and the control is given back to versiondog.
  • The working directory of the component (also the storage location of the project file) is determined as the execution directory.

Example 4

Function ScriptAfterCheckInS
{
$def::var1 = $func::getifcomponenttypeid(2691BA5A90ED4C5887D4BDDD1F8C9A48, 1);
call MyCopyScript.exe
{
… some arguments
iftrue $def::var1=1
}
}

In this example, theMyCopyScript.exeis only triggered by all arguments if the Check-In process of a component of a specific component type is impacted.


Last update: September 15, 2023

Related Articles

IMPRINT | PRIVACY POLICY | COOKIE POLICY

Privacy Preference Center