Sign in to follow this  
Followers 0
Jimbo13

Trouble with Send Date to Make a File

4 posts in this topic

I need to Send the date to be used as a file name, but only have 8 Characters to use.

I have an old Extech 38332 multimeter that has an RS-232 interface.

I'm able to launch the meter interface software, navigate through it to get everything automated except the file naming, which needs to be the date > 12/21/08 < format, that's no more than 8 char. long.

what I see typed into the file input location is > 1/29/200 <then everything comes to a halt.

I'm sure there is a way of shortening the date to give just 08, but I need some help.

Did I mention novice!!!

Here is what I'm trying:

#include <Date.au3>

_NowDate()

_DateTimeFormat(@YEAR & "/" & @MON & "/" & @MDAY, 0)

Send(_DateTimeFormat(@YEAR & "/" & @MON & "/" & @MDAY, 0))

what I see typed into the file input location is > 1/29/200 <then everything comes to a halt.

Jimbo

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You don't need to include Date.au3 for this, and you cannot use the "/" character in a filename on Windows systems, as far as I know. If you are not actually trying to create a Windows file, but only to send a particular string to a device or control, then replace the "-" characters in the following code, with your "/" character.

But following will work for a filename and is ready to test, but I rarely begin a filename with a number:

$date = StringRight(@YEAR,2) & "-" & @MON & "-" & @MDAY
MsgBox(0, "", $date)

If you used "." in place of "/" - Eurostyle, then some machine somewhere might mistake it for the marker of a file extension.

I guess you just need this for the Send function:

$date = StringRight(@YEAR,2) & "/" & @MON & "/" & @MDAY
Send($date)

But welcome to the AutoIt forums, anyhow!

Edited by Squirrely1

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

I need to Send the date to be used as a file name, but only have 8 Characters to use.

I have an old Extech 38332 multimeter that has an RS-232 interface.

I'm able to launch the meter interface software, navigate through it to get everything automated except the file naming, which needs to be the date > 12/21/08 < format, that's no more than 8 char. long.

what I see typed into the file input location is > 1/29/200 <then everything comes to a halt.

I'm sure there is a way of shortening the date to give just 08, but I need some help.

Did I mention novice!!!

Here is what I'm trying:

#include <Date.au3>

_NowDate()

_DateTimeFormat(@YEAR & "/" & @MON & "/" & @MDAY, 0)

Send(_DateTimeFormat(@YEAR & "/" & @MON & "/" & @MDAY, 0))

what I see typed into the file input location is > 1/29/200 <then everything comes to a halt.

Jimbo

Use StringRight(@Year, 2) instead of @Year

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

You don't need to include Date.au3 for this, and you cannot use the "/" character in a filename on Windows systems, as far as I know. If you are not actually trying to create a Windows file, but only to send a particular string to a device or control, then replace the "-" characters in the following code, with your "/" character.

But following will work for a filename and is ready to test:

$date = StringRight(@YEAR,2) & "-" & @MON & "-" & @MDAY
MsgBox(0, "", $date)

If you used "." in place of "/" - Eurostyle, then some machine somewhere might mistake it for the marker of a file extension.

I guess you just need this for the Send function:

$date = StringRight(@YEAR,2) & "/" & @MON & "/" & @MDAY
Send($date)

But welcome to the AutoIt forums, anyhow!

from jimbo

Thanks, that did the trick, I figured I was trying to make it too complicated.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0