• 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: Creating an empty XML file on my desktop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Creating an empty XML file on my desktop


  • Subject: RE: Creating an empty XML file on my desktop
  • From: Rick Gordon <email@hidden>
  • Date: Thu, 24 Apr 2008 19:34:44 -0700

Although the documentation suggests that open for access will create a file if none exists, I can't make that work for me either (using OS 10.4.11). So I use the Finder to make a new file and then open that file for access.

tell application "Finder"
  set newXMLFile to make new file at desktop with properties {name:"images.xml"}
end tell
set newXMLAlias to newXMLFile as alias
set fileReference to open for access file newXMLAlias with write permission
...

I would also be curious to know why open for access will not create an empty file if none exists, contrary to the documentation as I understand it.

Rick Gordon

------------------

On 4/24/08 at 7:13 PM -0700, Eric Welch wrote in a message entitled
"Creating an empty XML file on my desktop":

>I've almost got the whole thing ready to throw together in a whole Applescript. But I was wondering how to tell Applescript to create an empty text file on my desktop named "images.xml" I won't bother you with the other stuff, or Global variable declarations.
>
>What I'm using to write the information into the XML file is:
>
>set file_reference to open for access file "Ansel:Users:eric:Desktop:images.xml" with write permission
>write fullText to file_reference
>close access file_reference
>
>I've got the whole xml information (variable fullText) formatted properly to write to the empty XML file. And with a file on the desktop, it writes the information into the file just fine.
>
>But it escapes me how to create the text file in the first place before I open and write to it the information from Portfolio.

--

___________________________________________________

RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________

WWW:   http://www.shelterpub.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • RE: Creating an empty XML file on my desktop
      • From: email@hidden
References: 
 >Creating an empty XML file on my desktop (From: Eric Welch <email@hidden>)

  • Prev by Date: Creating an empty XML file on my desktop
  • Next by Date: Re: Creating an empty XML file on my desktop
  • Previous by thread: Creating an empty XML file on my desktop
  • Next by thread: RE: Creating an empty XML file on my desktop
  • Index(es):
    • Date
    • Thread