Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Generating a filename thru AppleScript...

Generating a filename thru AppleScript...
Thread Tools
Junior Member
Join Date: Dec 2000
Location: Orono, ME
Status: Offline
Reply With Quote
Jul 10, 2001, 11:32 PM
 
I am trying to get AppleScript to generate a name based on the date. So say I generated this name today my file would be named foo07/11. What is the syntax for doing this? I know it is something like:

save window 1 in file "Max esktop Folder TR & (curent date)" as string with creator «class TBB6»

but I can't figure out the combo of parentheses in the path. Thanks.

Dan
     
Junior Member
Join Date: Apr 2001
Status: Offline
Reply With Quote
Jul 12, 2001, 07:37 AM
 
Originally posted by Glenstorm:
<STRONG>I am trying to get AppleScript to generate a name based on the date. So say I generated this name today my file would be named foo07/11. What is the syntax for doing this? I know it is something like:

save window 1 in file "Max esktop Folder TR & (curent date)" as string with creator «class TBB6»

but I can't figure out the combo of parentheses in the path. Thanks.

Dan</STRONG>
Here's an example that will create a new text file with creator type "TBB6" on the desktop... as far as I know, the month still has to be coerced into a number (the result of (month of (current date)) being January...)
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>set month_list to {{a:<font color = red>"<font color = blue>1</font>"</font>, b:January}, {a:<font color = red>"<font color = blue>2</font>"</font>, b:February}, {a:<font color = red>"<font color = blue>3</font>"</font>, b:March}, {a:<font color = red>"<font color = blue>4</font>"</font>, b:April}, {a:<font color = red>"<font color = blue>5</font>"</font>, b:May}, {a:<font color = red>"<font color = blue>6</font>"</font>, b:June}, {a:<font color = red>"<font color = blue>7</font>"</font>, b:July}, {a:<font color = red>"<font color = blue>8</font>"</font>, b:August}, {a:<font color = red>"<font color = blue>10</font>"</font>, b:September}, {a:<font color = red>"<font color = blue>10</font>"</font>, b:October}, {a:<font color = red>"<font color = blue>11</font>"</font>, b:November}, {a:<font color = red>"<font color = blue>12</font>"</font>, becember}}
repeat with a_month in month_list
<font color = green>if</font> month of (current date) is (b of a_month) then
set the_month to (a of a_month)
end <font color = green>if</font>
end repeat
set the_day to (day of (current date))
tell application <font color = red>"Finder"</font>
make file at desktop with properties {name:<font color = red>"foo"</font> & the_month & <font color = red>"/"</font> & the_day, file type:<font color = red>"TEXT"</font>, creator type:<font color = red>"TBB6"</font>}
end tell</font>[/code]
Hope this was what you're looking for...
-acur
     
Junior Member
Join Date: Dec 2000
Location: Orono, ME
Status: Offline
Reply With Quote
Jul 12, 2001, 02:05 PM
 
Thanks for that help...
I will work with it and see if I can get it to work. The twist is that I am using Text-Edit Plus to automatically format a document for me and I want it to save it the incremental monthly format... So ultimately I wanted Tex-Edit to due the saving. I guess I can have the finder create the file first and then paste the result into the new file...

[ 07-12-2001: Message edited by: Glenstorm ]
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:08 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2