• 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: OSX Coding Help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OSX Coding Help


  • Subject: Re: OSX Coding Help
  • From: Jeff Grossman <email@hidden>
  • Date: Mon, 30 Jun 2003 14:23:17 -0700

on 6/27/03 10:13 AM, Andrew Oliver at email@hidden wrote:

> On 6/27/03 7:55 AM, "Jeff Grossman" <email@hidden> wrote:
>
>> I have the following script which will delete some files, if they exist, and
>> then export some address lists from LetterRip Pro. I want the script to run
>> from cron as an application. If I remove the beginning part which deletes
>> the existing files the script will run fine via cron. If I add back in the
>> part about deleting files, the script will not run via cron. Is it not
>> possible to do what I want with Applescript and cron?
> [snip[]
>
> There's actually no need to delete the files at all.
>
> When you 'open for access' the files to write out the new data, just 'set
> EOF' of each file to 0 before you start writing data. That will effectively
> clear the existing file before any new data is written and solves your
> problem.

Okay, I tried your idea, but it does not seem to be working for me. When I
run the script, I get a duplicate file error. Here is a copy of the script:

set the FishadsAddressFile to open for access "OSX:List Addresses:Fishads
Addresses" with write permission
set eof of "OSX:List Addresses:Fishads Addresses" to 0
tell application "LetterRip_Server"
set a_list to subscriber list "Fishads"
set theCount to count of subscribers of a_list

set cur to 1
repeat until cur > theCount
set theSub to subscriber cur of a_list
set theName to name of theSub
set theAddress to email address of theSub
set cur to cur + 1
my WriteFile(FishadsAddressFile, theName, theAddress)
end repeat
end tell
close access FishadsAddressFile

set the HuntadsAddressFile to open for access "OSX:List Addresses:Huntads
Addresses" with write permission
set eof of "OSX:List Addresses:Huntads Addresses" to 0
tell application "LetterRip_Server"
set a_list to subscriber list "Huntads"
set theCount to count of subscribers of a_list

set cur to 1
repeat until cur > theCount
set theSub to subscriber cur of a_list
set theName to name of theSub
set theAddress to email address of theSub
set cur to cur + 1
my WriteFile(HuntadsAddressFile, theName, theAddress)
end repeat
end tell
close access HuntadsAddressFile

set the FishReportsAddressFile to open for access "OSX:List
Addresses:FishReports Addresses" with write permission
set eof of "OSX:List Addresses:FishReports Addresses" to 0
tell application "LetterRip_Server"
set a_list to subscriber list "Fish Reports"
set theCount to count of subscribers of a_list

set cur to 1
repeat until cur > theCount
set theSub to subscriber cur of a_list
set theName to name of theSub
set theAddress to email address of theSub
set cur to cur + 1
my WriteFile(FishReportsAddressFile, theName, theAddress)
end repeat
end tell
close access FishReportsAddressFile

set the HuntReportsAddressFile to open for access "OSX:List
Addresses:HuntReports Addresses" with write permission
set eof of "OSX:List Addresses:HuntReports Addresses" to 0
tell application "LetterRip_Server"
set a_list to subscriber list "Hunt Reports"
set theCount to count of subscribers of a_list

set cur to 1
repeat until cur > theCount
set theSub to subscriber cur of a_list
set theName to name of theSub
set theAddress to email address of theSub
set cur to cur + 1
my WriteFile(HuntReportsAddressFile, theName, theAddress)
end repeat
end tell
close access HuntReportsAddressFile

set the NewsAddressFile to open for access "OSX:List Addresses:News
Addresses" with write permission
set eof of "OSX:List Addresses:News Addresses" to 0
tell application "LetterRip_Server"
set a_list to subscriber list "News"
set theCount to count of subscribers of a_list

set cur to 1
repeat until cur > theCount
set theSub to subscriber cur of a_list
set theName to name of theSub
set theAddress to email address of theSub
set cur to cur + 1
my WriteFile(NewsAddressFile, theName, theAddress)
end repeat
end tell
close access NewsAddressFile

to WriteFile(myFile, aName, anAddress)
write aName & tab & anAddress & return to myFile
end WriteFile

Thanks,
Jeff
--
Jeff Grossman (email@hidden)
Director - Information Systems, Turner's Outdoorsman
http://www.turners.com
_______________________________________________
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: OSX Coding Help
      • From: Andrew Oliver <email@hidden>
    • Re: OSX Coding Help
      • From: "Steven D. Majewski" <email@hidden>
References: 
 >Re: OSX Coding Help (From: Andrew Oliver <email@hidden>)

  • Prev by Date: Redeem Your Coupon-Get Your Apology Early (The Line is Long)
  • Next by Date: Re: OSX Coding Help
  • Previous by thread: Re: OSX Coding Help
  • Next by thread: Re: OSX Coding Help
  • Index(es):
    • Date
    • Thread