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

Saving a temp file?


  • Subject: Saving a temp file?
  • From: James Burns <email@hidden>
  • Date: Wed, 12 Feb 2003 13:28:01 -0500

Hello:

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'm taking a cue from another app and saving the file to /private/tmp/tempFile, but I get an error -1700).

Here's the relevant handler:

-------------------------------
on changeOutput()
-- write file to temp directory
set AppleScript's text item delimiters to ":"
set sceneName to (last text item of sceneFile as string) -- sceneName is a var with the complete path to a file
set AppleScript's text item delimiters to oldDelims
set tempFile to POSIX file ("/private/tmp/" & sceneName) as string -- make the new path to the tempfile
-- at this point I have a correctly formatted filename stored in tempFile
try
set fileRef to (open for access tempFile with write permission) -- here's where it fails...
on error what
display dialog what
return
end try
set fileSize to (get eof of tempFile)
set eof of fileRef to 0
write fileContents to fileRef
close access fileRef

end changeOutput
----------------------------------

I'd appreciate any help in this matter. What I basically have to do is save a file without confirmation or user intervention, and it can be deleted on quitting.

Thanks in advance.

-----
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.

  • Prev by Date: Re: FM inserting Movie
  • Next by Date: Re: Saving a temp file?
  • Previous by thread: Re: New Safari beta
  • Next by thread: Re: Saving a temp file?
  • Index(es):
    • Date
    • Thread