• 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: Files and Aliases
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Files and Aliases


  • Subject: Re: Files and Aliases
  • From: "koenig.yvan" <email@hidden>
  • Date: Tue, 11 Mar 2014 22:37:50 +0100


Le 11/03/2014 à 21:31, Gil Dawson <email@hidden> a écrit :

I'm getting a little confused...

I wish to generate a file name into which I will ask TextWrangler to Save some manipulated text.

The TextWrangler .sdef says that it needs an alias for the destination for its Save operation:

save v : Save a window or document.
save specifier : the object to save
[to alias] : file in which to save the window’s contents
...

I can't figure out how to create an alias to a file that's not created yet.  

What does work is 

set OutFile to POSIX file ...(and specify the destination in a text literal)

but I want to compute the destination.  

I've tried 

set OutFileName to (generate the file path as text)
set OutFile to alias OutFileName

but that gets the error "File wasn't found".

I also tried

set OutFileName to (generate the file path as text)
set OutFile to file OutFileName

which got the error "Can't get file".

Am I missing something obvious?

Here's my code that doesn't work:

set InFile to choose file with prompt ¬
"Select an input file." of type "scc"

tell application "Finder"
set InFileName to (name of InFile) as string
set OutFileName to ("" & container of InFile) ¬
& (text 1 through -5 of InFileName) ¬
& " y.scc"
if exists OutFileName then

OutFileName is a string
If there is no file with this pathname you can't get it as alias
So just edit this late instruction as

if exists file OutFileName then

Yvan KOENIG (VALLAURIS, France) mardi 11 mars 2014 22:35:47



 _______________________________________________
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

References: 
 >Files and Aliases (From: Gil Dawson <email@hidden>)

  • Prev by Date: Files and Aliases
  • Next by Date: Re: Files and Aliases
  • Previous by thread: Files and Aliases
  • Next by thread: Re: Files and Aliases
  • Index(es):
    • Date
    • Thread