AutoHotKey 减法和 Return 变量
AutoHotKey Subtraction and Return Variable
我已经开始为 WhatsApp web 创建一个脚本,它是为了更改组名和剩余天数。但是,我希望每天都能 运行 脚本,这样就可以节省一天的时间。
我不确定如何做减法或如何去做这个,AutoHotKey 有没有 return 函数所以我可以 return 最后的变量。
假设天数是 90
所以当我 运行 接下来的脚本将是 89
那么我运行之后的第二天就是87
我是 AutoHotKey 的新手,仍在了解它,但到目前为止我很喜欢它。
; FormatTime transforms a YYYYMMDDHH24MISS timestamp into the specified date/time format.
FormatTime, Date, CurrentDate, YYYYMMDD
Expires := 20170611 ; 06/12/2017
; Subtract Date timestamp from Expires timestamp
EnvSub, Expires, CurrentDate, days
; The result is stored in Expires
Msgbox % Expires " days left till ..."
https://autohotkey.com/docs/commands/FormatTime.htm
每天 运行 脚本,在您的启动文件夹中创建它的快捷方式,或使用 SetTimer。
距特定时间还剩多少天、几小时和几分钟:
FormatTime, Date, CurrentDateTime, YYYYMMDDHHMI
expires := 201706111537 ; 06/11/2017 15:37
; time left in minutes:
expires_minutes := expires
EnvSub, expires_minutes, CurrentDateTime, minutes
; time left in hours:
expires_hours := expires_minutes
EnvDiv, expires_hours, 60
; time left in days:
expires_days := expires_minutes
EnvDiv, expires_days, (24 * 60)
; rest of the division in hours:
rest_hours := expires_hours - (expires_days * 24)
; rest of the division in minutes:
rest_minutes := expires_minutes - (expires_hours * 60)
Msgbox %expires_days% days, %rest_hours% hours and %rest_minutes% minutes left till ...
我已经开始为 WhatsApp web 创建一个脚本,它是为了更改组名和剩余天数。但是,我希望每天都能 运行 脚本,这样就可以节省一天的时间。
我不确定如何做减法或如何去做这个,AutoHotKey 有没有 return 函数所以我可以 return 最后的变量。
假设天数是 90
所以当我 运行 接下来的脚本将是 89
那么我运行之后的第二天就是87
我是 AutoHotKey 的新手,仍在了解它,但到目前为止我很喜欢它。
; FormatTime transforms a YYYYMMDDHH24MISS timestamp into the specified date/time format.
FormatTime, Date, CurrentDate, YYYYMMDD
Expires := 20170611 ; 06/12/2017
; Subtract Date timestamp from Expires timestamp
EnvSub, Expires, CurrentDate, days
; The result is stored in Expires
Msgbox % Expires " days left till ..."
https://autohotkey.com/docs/commands/FormatTime.htm
每天 运行 脚本,在您的启动文件夹中创建它的快捷方式,或使用 SetTimer。
距特定时间还剩多少天、几小时和几分钟:
FormatTime, Date, CurrentDateTime, YYYYMMDDHHMI
expires := 201706111537 ; 06/11/2017 15:37
; time left in minutes:
expires_minutes := expires
EnvSub, expires_minutes, CurrentDateTime, minutes
; time left in hours:
expires_hours := expires_minutes
EnvDiv, expires_hours, 60
; time left in days:
expires_days := expires_minutes
EnvDiv, expires_days, (24 * 60)
; rest of the division in hours:
rest_hours := expires_hours - (expires_days * 24)
; rest of the division in minutes:
rest_minutes := expires_minutes - (expires_hours * 60)
Msgbox %expires_days% days, %rest_hours% hours and %rest_minutes% minutes left till ...