• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Write to file??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Write to file??


  • Subject: Re: Write to file??
  • From: John Delacour <email@hidden>
  • Date: Wed, 31 Jul 2002 18:41:50 +0100

At 3:32 pm -0400 30/7/02, Steve Suranie wrote:

I have a script which at the end writes data to a log file. When I
run the script on my G4......

set thisDate to current date
set logPath to the folder "_logs" of the folder "Merion Image
Archive" of the disk "Cumulus" as string

set thisMonth to the month of thisDate as string

if thisMonth = "January" then
set thisMonth to "01"
else if thisMonth = "February" then
set thisMonth to "02"
else if thisMonth = "March" then
set thisMonth to "03"
else if thisMonth = "April" then


... yawn


If you're running OS X, then you can do this:

-----
set junk to POSIX path of "doc:junk.txt"
-- a file to be created in volume 'doc'
--
set pl to "perl -e '@t = localtime;"
set pl to pl & "printf qq(d-d-d),"
set pl to pl & "$t[5]-100,$t[4],$t[3];'"
set vText to "Today\\047s date is " & (do shell script pl)
--
set pl to " perl -e ' "
set pl to pl & " $f = qq(" & junk & "); "
set pl to pl & " open F, qq(>$f) ; "
set pl to pl & " print F qq(" & vText & "); "
set pl to pl & " close F; "
set pl to pl & " ' "
--
do shell script pl
do shell script "open " & junk
-----

Now that shell scripting is possible, it makes little sense to
continue using the verbose and unwieldy syntax of AppleScript,
especially since the record shows very little advance since AS was
first introduced -- I see the Finder aete, which has always been a
mess, is now even messier than ever and has all sorts of gaps. With
the new 'do shell script' event, however, there is a way to use
Applescript simply as a caller and for IAC.

JD




JD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Write to file??
      • From: Reinhold Penner <email@hidden>
  • Prev by Date: Filter References and TextEdit
  • Next by Date: Re: duplicate file with number
  • Previous by thread: Re: Write to file??
  • Next by thread: Re: Write to file??
  • Index(es):
    • Date
    • Thread