Добрый день. Можно ли каким либо образом передавать параметры в макрос? И если да, то как их считать внутри макроса.
Пусть это будет строка, я уж сам ее разберу на то что мне надо внутри макроса.
Заранее спасибо всем откликнувшимся...
' Just beeps
' Ver. 22 Mar 2015
' You may want to rename it to M1030.m1s (to autorun it after M30) or M1047.m1s (to autorun it after M47)
' Plays Windows' "Default Beep". Default "Default Beep" is "Windows Ding.wav",
' it can be changed in Sounds properties in Windows control panel.
' Parameters: Pnumber Rnumber
' P is for Pause: it is a pause between [starts of] beeps (in seconds).
' R is for Repeat: how many times to beep. If R=0, it beeps once. If R<0, it beeps endlessly.
' Omitted parameters are supposed to be 0.
' It is not recommended to omit parameters, because Mach3 has a bug that keeps parameter values from previous runs.
' Examples:
' M1032 beeps once (if did not run previously with different R)
' M1032 P1 R2 beeps twice with a 1-second pause
' M1032 P5 R-1 beeps infinitely with 5-second pause
' If the macro is to run with no parameters (for example as M1030 automatically after every M30),
' then you may want to uncomment (i.e. remove the apostrophe from the beginning of the line) and edit lines 10 and 20
' and optionally comment lines 05 and 15 (i.e. put an apostrophe in the very beginning of the lines):
05 Pause = Param1() ' P argument: pause in seconds
'10 Pause = 0.5
15 Repeat = Param3() ' R argument: Repeat this number of times (once if 0, infinitely if <0)
'20 Repeat = -1
If IsLoading = 0 Then ' Is the code loading or should it be executed?
StartTime = Date() & " " & Time(Now)
Pause = Abs(Pause*1000) ' convert to milliseconds
While IsMoving
Sleep 100
Wend
' Go:
i=1: count=1
Do
Beep : message "Beeped " & count & " of " & Repeat & " times (started at " & StartTime & ")"
Sleep Pause
count=count+1
If Repeat>=0 Then
i=i+1
Else
i=Repeat-1
End If
Loop Until i>Repeat
End If