ID : 3987
RunByName
Function
To start up a program as a different task. Unlike Run command, you can use a formula for task name.
Syntax
RunByName task name[, argument list]
Guaranteed Entry
- Task name
- Designate a task name by String Type data. Refer to "How to Designate a Task Name."
- Argument list
- A task which needs to have argument should be designated by Variant Type.
However, an argument with ByRef cannot be started up.
Description
At the time of program execution, evaluate a formula designated as a task name and create the task name dynamically to Run. This is useful to Run sequential named tasks at a time.
Except format, other behaviors are the same as Run.
Related Terms
Run, others are the same as Run.
Attention
- If a specified task is not found, "81500029: Failed to find a file." is displayed.
- Refer to Run.
Example
In the following example, start up 9 (Pro2 to Pro10) tasks which have same argument. There are three arguments between Pro2 and Pro10, so the element defines 3 arrays in RunByName.
'!TITLE "Start Up a Task Using a Formula"
'Pro1.pcs
Sub Main
TakeArm Keep = 0
Dim n as Integer
'Create task name Pro2 to Pro10 using a formula and start them up
For n=2 To 10
'Designate an argument given to the task by an array
RunByName "Pro" & n , Array( "Pro" & n, n, P[n])
Next
End Sub
Pro2.pcs
Sub Main( ByVal sVal As String, ByVal lCnt as Integer, ByVal posCur As Position)
'Process (omitted here)
End Sub
'Pro3.pcs to Pro10.pcs will be following as above.
ID : 3987