NeoBook Function: Convert Long Day and Month to Short
There are times when you may need to convert long days (Sunday) into short days (Sun), and long months into short months. An easy way to do this is to put the conversion code into a NeoBook function, and then call it whenever you need it.
For example, an RSS xml feed requires the published date in this format: Fri, 14 Nov 2008 09:11:18. To code a button that will do this when clicked, create 2 new functions (Options|Function Library), name them Convert Long Day to Short and Convert Long Month to Short (or anything you like), and paste the following code into them:
DAY FUNCTION
If "[day]" "=" "Monday"
SetVar "[shortday]" "Mon"
endif
If "[day]" "=" "Tuesday"
SetVar "[shortday]" "Tue"
endif
If "[day]" "=" "Wednesday"
SetVar "[shortday]" "Wed"
endif
If "[day]" "=" "Thursday"
SetVar "[shortday]" "Thu"
endif
If "[day]" "=" "Friday"
SetVar "[shortday]" "Fri"
endif
If "[day]" "=" "Saturday"
SetVar "[shortday]" "Sat"
endif
If "[day]" "=" "Sunday"
SetVar "[shortday]" "Sun"
endif
MONTH FUNCTION
If "[month]" "=" "January"
SetVar "[shortmonth]" "Jan"
endif
If "[month]" "=" "February"
SetVar "[shortmonth]" "Feb"
endif
If "[month]" "=" "March"
SetVar "[shortmonth]" "Mar"
endif
If "[month]" "=" "April"
SetVar "[shortmonth]" "Apr"
endif
If "[month]" "=" "May"
SetVar "[shortmonth]" "May"
endif
If "[month]" "=" "June"
SetVar "[shortmonth]" "Jun"
endif
If "[month]" "=" "July"
SetVar "[shortmonth]" "Jul"
endif
If "[month]" "=" "August"
SetVar "[shortmonth]" "Aug"
endif
If "[month]" "=" "September"
SetVar "[shortmonth]" "Sep"
endif
If "[month]" "=" "October"
SetVar "[shortmonth]" "Oct"
endif
If "[month]" "=" "November"
SetVar "[shortmonth]" "Nov"
endif
If "[month]" "=" "December"
SetVar "[shortmonth]" "Dec"
endif
In your button, enter this code:
... Convert day and month
Call "Convert to short day"
Call "Convert to short month"
... Copy to clipboard
SetVar "[clipboard]" "[shortday], [daynum] [shortmonth] [year] [hour]:[minute]:[second]"
... Paste from clipboard
SendKeys "" "{CtrlDn}v{CtrlUp}"
These two could be combined into one function, but since you may not need both for your application, we're using 2 functions. If you don't need the time, year etc., just delete those variables from the setvar action.
To use them, locate your cursor in a textentry object where you want the date and time to appear, click the button, and voila!, there it is.