Sign in to follow this  
Followers 0
Marshin

Help with script

3 posts in this topic

I am trying to have the script type out the date of the last day of the previous month. it will add and subtract and anything els I need to the month "number" but when I do a IfEqual comand it does not think its equal to that number. see example script :)

SetEnv, notepad, C:\\WINDOWS\\system32\\notepad.exe

SetEnv,Year,%A_YEAR%

SetEnv,Month,%A_MON%

EnvDiv, Month, 1

IfGreaterOrEqual,Month,2,Goto,datefix1

IfLessOrEqual,Month,1,Goto,datefix2

datefix1:

EnvSub,Month,1

Goto,monthset

datefix2:

EnvAdd,Month,11

monthset:

Run, %notepad%

WinWaitActive,Untitled - Notepad

Send,%Month%-

IfEqual,%Month%,1,Send,31

IfEqual,%Month%,2,Send,28

IfEqual,%Month%,3,Send,31

IfEqual,%Month%,4,Send,30

IfEqual,%Month%,5,Send,31

IfEqual,%Month%,6,Send,30

IfEqual,%Month%,7,Send,31

IfEqual,%Month%,8,Send,31

IfEqual,%Month%,9,Send,30

IfEqual,%Month%,10,Send,31

IfEqual,%Month%,11,Send,30

IfEqual,%Month%,12,Send,31

Send,-%Year%{ENTER}


At last, after two thousand years of research, the illudium Q-36 explosive space modulator.Well, back to the old drawing board.

Share this post


Link to post
Share on other sites

IfEqual,%Month%,1,Send,31

<{POST_SNAPBACK}>

If using "IfEqual" you do not need to use "%" for the variable. Try the following to send the last day of the month.

IfEqual,Month,1,Send,31
IfEqual,Month,2,Send,28
...

Share this post


Link to post
Share on other sites

type out the date of the last day of the previous month

IfEqual,Month,1,Send,31

IfEqual,Month,2,Send,31

IfEqual,Month,3,Send,28 ; if its March you'll send the number of days from February - correct ?

But what about a leap year ???? :)

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0