• 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 a new folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a new folder


  • Subject: Re: Creating a new folder
  • From: Paul Berkowitz <email@hidden>
  • Date: Sun, 09 May 2004 21:33:27 -0700

On 5/9/04 9:03 PM, "Carl Anderson" <email@hidden> wrote:

> Yeah, I sort of forgot to include the script. So, here it is
> set PartA to path to desktop
> set PartA to PartA & "Test:"
> display dialog PartA as text
> tell application "Finder"
> set myNewFolder to make new folder at PartA with properties
> {name:"Temp"}
> end tell
> It works until it reaches the line "set myNewFolder to make new folder
> at PartA with properties {name:"Temp"}"
> where it says "Finder got an error: Can't get some object." and the new
> folder is created, but not in the folder "Test", but on the desktop
> along side that folder.

Some blanks lines between text and script would be easier to read.


set PartA to path to desktop
-- that's an alias. You should say:

set PartA to (path to desktop as string) -- or
set PartA to (path to desktop as Unicode text)

set PartA to PartA & "Test:"
-- now you're concatenating an alias plus a string. The result of two
differing types where the second (string) can't be coerced to the first
(alias) is a list. You've ended up with an unuseable list:

{alias "HD:Users:you:Desktop:", "Test:"}

display dialog PartA as text
--too late for the "as text" : it will display OK since 'as text'
coerces the list to a string with the default text delimter being ""
resulting in the text you're hoping for:


{alias "HD:Users:you:Desktop:", "Test:"} as text
--> "HD:Users:you:Desktop:Test:"

but it doesn't change PartA from being a list.

tell application "Finder"
set myNewFolder to make new folder at PartA with properties
{name:"Temp"}
end tell

-- the Finder can't make a folder "at" a list. Error. You have to make
it at a folder (or an alias).


>
> It works until it reaches the line "set myNewFolder to make new folder
> at PartA with properties {name:"Temp"}"
> where it says "Finder got an error: Can't get some object." and the new
> folder is created, but not in the folder "Test", but on the desktop
> along side that folder.
>
--That's a typical Finder coercion: it tries to guess what you want and
does the best it can.


set PartA to path to desktop as string
set PartA to PartA & "Test:"
display dialog PartA
tell application "Finder"
set myNewFolder to make new folder at folder PartA with properties
{name:"Temp"}
end tell



--
Paul Berkowitz

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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: Creating a new folder (From: Carl Anderson <email@hidden>)

  • Prev by Date: Re: [ADMIN] Reminder: turn off the list before turning on your vacation responder
  • Next by Date: Re: Creating a new folder
  • Previous by thread: Re: Creating a new folder
  • Next by thread: Re: Creating a new folder
  • Index(es):
    • Date
    • Thread