• 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: run script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: run script


  • Subject: Re: run script
  • From: JJ <email@hidden>
  • Date: Wed, 22 Aug 2001 23:37:37 -0700

> 1) As I understand, the command "open for acces" in the scripting additions
> opens a text file passed as an alias. When the file doesn't exist, it
> creates it. My question may be stupid but it is not possible to create an
> alias to a file that doesn't exist! If I send directly a new file name
> instead of an alias like open for access "Macintosh HD:Work:MyTextFile" it
> doesn't work. What am I doing wrong?
>
set new_file to "HD:Desktop Folder:Inexistent_File"
open for access new_file with write permission
write "Hello, Dolly" to new_file
close access new_file

It's not for use with text files. It works with any kind of file. Usually,
it's so useful create the file before manipulating it.

i.e.

set the_Data to "GIF89a
,
@G6y DNT[Xmo{yN;4
9?"
tell application "Finder" to set newfile to make file at desktop with
properties {name:"file.gif", file type:"GIFf", creator type:"MSIE",
data:the_Data}

Where you say "data:the_Data";, you're writing text to your new file.

JJ


  • Follow-Ups:
    • Re: run script
      • From: Ric Phillips <email@hidden>
  • Prev by Date: re: scriptable Chooser 8.6
  • Next by Date: Re: Print and OK button..?
  • Previous by thread: Re: run script
  • Next by thread: Re: run script
  • Index(es):
    • Date
    • Thread