The following code is a long way of using Macro Scheduler to enter the name of the month into a file name. This has been broken out as a separate topic, but is based on code from the topic "Create and Save Filenames Based Upon Today's Date. The previous code referenced here was posted on Sun Jan 05, 2003, and modified by me with an additional posting on Mon Jan 06, 2003.
The script will fail with a value of %MM% to work with.
Be sure to look for extra spaces at the end of the lines if copy and pasted from the forum.
=========================================
Label>UserVariables
//Set this variable to "T" or "F"
Let>Longnames=T
Label>EndUserVariables
//This section must be run after making month into 2 digits (%MM%) as done in earlier script.
//This section must be run before using %MM% from earlier script.
Label>GetMonthFormat
If>Longnames=F,Normal
Label>GetMonthLongNames
//==========================
If>%MM%=01,Jan
If>%MM%=02,Feb
If>%MM%=03,Mar
If>%MM%=04,Apr
If>%MM%=05,May
If>%MM%=06,Jun
If>%MM%=07,Jly
If>%MM%=08,Aug
If>%MM%=09,Sep
If>%MM%=10,Oct
If>%MM%=11,Nov
If>%MM%=12,Dec
Label>Error
//============
Message>ERROR! ERROR! ERROR!%CRLF%%CRLF%Month needs to be 2 digits from 01 to 12.
Wait>10
Goto>End
//============
Label>Jan
Let>MM=January
Goto>Normal
Label>Feb
Let>MM=February
Goto>Normal
// Repeat 3 lines each for other months Mar to Nov
>
>
>
Label>Dec
Let>MM=December
Goto>Normal
Label>EndGetMonthLongNames
//==========================
Label>Normal
//From this point forward %MM% will be longname or 2 digit date
//Display results of Long Names for months.
//Note comma and spaces in next line, also using %DD% and %YYYY% from earlier script.
MessageModal>Title is %MM% %DD%, %YYYY%
//Message above should have format like January 05, 2003 if Longnames is set to "T"
//Message above should have format like 01 05, 2003 if Longnames is set to "F"
Label>End
=============================
This macro script will be followed by an easier VB version. Stay tuned.....
Month Names in filenames
Moderators: JRL, Dorian (MJT support)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Month Names in filenames
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
The following macro script uses VB to get the literal name of the month. It would be inserted between the following lines and replace all of the code between them:
Label>GetMonthLongNames
>
>
>
Label>EndGetMonthLongNames
The VB code to be inserted follows here:
========
VBStart
VBEnd
//MM is included here only for testing, will come from earlier script
Month>MM
VBEval>Monthname("%MM%"),MM
MessageModal>Long month name is %MM%
//MM is included here only for testing, will come from earlier script
Month>MM
VBEval>Monthname("%MM%",True),MM
MessageModal>Abbreviated month name is %MM%
Label>End =====================================
At this point, %MM% will be a text name vs. a number. This could be modified so the output goes to %mmlong% or %mmshort% so that the numberic value of %MM% is not lost. But I think I have provided the basic foundation that can be built upon.
Again, hope this is helpful.......
And another reminder to watch for and remove any extra spaces at the end of lines on code cut and pasted from the forum.
============================
Note: This script was edited on 1/7/03 at 10:15PM EST using the built in VB function vs. making a special function. Thanks to Support for demonstrating that yesterday.
Label>GetMonthLongNames
>
>
>
Label>EndGetMonthLongNames
The VB code to be inserted follows here:
========
VBStart
VBEnd
//MM is included here only for testing, will come from earlier script
Month>MM
VBEval>Monthname("%MM%"),MM
MessageModal>Long month name is %MM%
//MM is included here only for testing, will come from earlier script
Month>MM
VBEval>Monthname("%MM%",True),MM
MessageModal>Abbreviated month name is %MM%
Label>End =====================================
At this point, %MM% will be a text name vs. a number. This could be modified so the output goes to %mmlong% or %mmshort% so that the numberic value of %MM% is not lost. But I think I have provided the basic foundation that can be built upon.
Again, hope this is helpful.......
And another reminder to watch for and remove any extra spaces at the end of lines on code cut and pasted from the forum.
============================
Note: This script was edited on 1/7/03 at 10:15PM EST using the built in VB function vs. making a special function. Thanks to Support for demonstrating that yesterday.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!