Send a command script an argument

Discussion, questions and support.
Post Reply
vrod5454
Posts: 20
Joined: Apr 18th, ’18, 02:13

Post by vrod5454 » Aug 30th, ’18, 21:22

I am able to make the date command script below work in a send via %INSERT_.mydate%.

Code: Select all

Days:=8
BDays := 0
While (BDays < Days) 
{
 Today += 1, D
 FormatTime, WDay, %Today%, WDay
 If (Wday <> 1) && (WDay <> 7) ; not Sunday and not Saturday
	 BDays++
}
FormatTime, Date, %Today%, dd/MM/yyyy
Send, %Days% business days from now is %Date%.
Original code from https://autohotkey.com/boards/viewtopic.php?t=1818

To make the above command script more flexible... would it be possible to send the command the argument "days" - like a function{} ? For example:

Code: Select all

%INSERT_.mydate, 1 %
would be plus 1 day- etc.

I understand that the date command script would need to be revised to accept the parameter.

Thanks,
Victor
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » Sep 2nd, ’18, 16:31

You can use INPUT variables in your code so:
Substitute:

Code: Select all

%INPUT_NoOfDays% business days from today is %CODE_DaysCalculation%.
where CODE_DaysCalculation is

Code: Select all

Days:=INPUT_NoOfDays
BDays := 0
While (BDays < Days) 
{
 Today += 1, D
 FormatTime, WDay, %Today%, WDay
 If (Wday <> 1) && (WDay <> 7) ; not Sunday and not Saturday
	 BDays++
}
FormatTime, Date, %Today%, dd/MM/yyyy
Send, %Date%
Post Reply