• 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: Saving a temp file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving a temp file?


  • Subject: Re: Saving a temp file?
  • From: James Burns <email@hidden>
  • Date: Thu, 13 Feb 2003 08:34:33 -0500

On Wednesday, February 12, 2003, at 11:28 PM, bill wrote:

Making good progress on my app in AppleScript studio, but have run into
another roadblock. I need to save a temporary file (that I'll alter in
another handler) without any user intervention. I need to overwrite it
if it exists already without bugging the user.

I'm taking a cue from another app and saving the file to
/private/tmp/tempFile, but I get an error if the file already exists.

Hope this handler can help you, it's in the "Photo Summary.scpt", you can
download the iPhoto script from Apple.

<http://a1392.g.akamai.net/7/1392/51/43f8b9d4f33a94/www.apple.com/ applescrip
t/iphoto/archive.sit>

Set the append_data to false will overwrite the file.


on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as text
set the open_target_file to ,
open for access file target_file with write permission
if append_data is false then ,
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file


By the way, you could also try this one, to get a place for temporary items
:

path to temporary items folder as string


Have fun :)


bill



Both great suggestions! Thank you so much for your help.

-----
James Burns
http://www.jamesburnsdesign.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.

References: 
 >Re: Saving a temp file? (From: bill <email@hidden>)

  • Prev by Date: Re: BEST way to change 1 character in a file?
  • Next by Date: Scripting with 'Internet Explorer'
  • Previous by thread: Re: Saving a temp file?
  • Next by thread: Re: FM inserting Movie
  • Index(es):
    • Date
    • Thread