HELP with gettime function used in filename convention

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
dyso
Newbie
Posts: 2
Joined: Thu Jul 20, 2006 4:25 am

HELP with gettime function used in filename convention

Post by dyso » Fri Jul 21, 2006 1:41 am

I am trying to get the gettime function to use the result in the filename of a windows text file. eg:

day>day
month>month
gettime>clock
let>filename=c:\test.txt
let>newfilename=c:\test%day%%month%%clock%.txt
copy>filename,newfilename

however, the result returned by the gettime function contains a colon ( : )character eg: 11:00:00 AM and as windows does not allow these types of characters to be used in a file name the file does not get created even though Macro Scheduler reports the macro completes successfully.

My question is: is there a way to change the formatting of the result of the gettime function so that it does not include these characters or is there a way to get windows ( XP Pro ) to accept these characters is filenames?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Jul 21, 2006 2:30 am

It's better to get Sec Min Hour separately then you can format them anyway you like:

Sec>Seconds
Min>Minutes
Hour>Hour
Message>%Hour%%Minutes%%Seconds%

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Jul 21, 2006 3:42 am

try this:

gettime>clock
stringreplace>clock,:,-,newclock

but, I agree with the previous post and usually just get the individual elements then manipulate them any way I want.

dyso
Newbie
Posts: 2
Joined: Thu Jul 20, 2006 4:25 am

Post by dyso » Fri Jul 21, 2006 6:02 am

thankyou both; this worked great.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts