Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
file creation naming
#1
i am trying 2 create a file but have the name on the file be the current date. i can create the file just can't get it the name of the file 2 be the date it was made.
#2
s.setfile("$Desktop$\test\.txt" -1 -1 1)<is the code i am using but what i need is the file name 2 be the current date
#3
Use the Text dialog to format the filename string. Make sure it does not contain / and other characters that cannot be used in filenames. At first store it into a variable, then use the variable with setfile.
#4
i am trying just can't seem 2 work it out can u give an example please
#5
Code:
Copy      Help
str name.time("$desktop$\%m-%d-%y.txt")
str data="data"
data.setfile(name)
#6
try this.

Code:
Copy      Help
str a b
a="this is the file contents"
b.time("%m%d%Y")
out b
b.from("c:\temp\" b ".txt")
out b
a.setfile(b)



You can see more about 'from' on my blog at
http://themacrohook.blogspot.com/search/label/from
An old blog on QM coding and automation.

The Macro Hook
#7
ty so much now i see what i was doing wrong Big Grin
#8
I'm haviing trouble now that i changed something.i have made the folder now have the current date on it.and the filename is a window text.but the problem i am having is getting it 2 find the folder with the current date on it .
#9
i am trying this 4 example as a code
but i get::::Error (RT) in Function1: cannot open or create file: The system cannot find the path specified.
str a b
str ft.time("$desktop$\test\%m-%d-%y")
mkdir(ft)
a="this is the file contents"
b.getwintext(win("Instant Message" "YSearchMenuWndClass")); err
b.from("$desktop$\test\" ft "\" b ".txt")
out b
a.setfile(b)
#10
how can i get it 2 find the folder with the the current date? i can create it just can't save the file in that folder
#11
looks to me like you're putting in the path twice.

str a b
str ft.time("$desktop$\test\%m-%d-%y")
mkdir(ft)
a="this is the file contents"
b.getwintext(win("Instant Message" "YSearchMenuWndClass")); err
b.from("$desktop$\test\" ft "\" b ".txt")
out b
An old blog on QM coding and automation.

The Macro Hook
#12
the file is being created inside another folder on my desktop
#13
ok here is what i am trying 2 do i am creating a folder on my desktop then creating another foler inside that.then trying 2 save a file in2 the second folder.
#14
i'd stay away from the whole '$desktop$' paths and just go with the actual names
c:\doc....etc.

here's what you're trying to do...

$desktop$\test\$desktop$\test\07-30-07\.txt

and that's why you're getting the error.
An old blog on QM coding and automation.

The Macro Hook
#15
ok i see what your saying why is that coming up like that? but the issue i have is this file will be on different computers with different user names
#16
if you look at the underlined portions above, you'll see that youre putting it in twice.
An old blog on QM coding and automation.

The Macro Hook
#17
ok i found the error it was declaring the desktop twice
changed code 2 this and it worked
b.from("" ft "\" b ".txt")


Forum Jump:


Users browsing this thread: 1 Guest(s)