• 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: Getting file paths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting file paths


  • Subject: Re: Getting file paths
  • From: Jay Louvion <email@hidden>
  • Date: Wed, 28 Sep 2005 13:10:10 +0200

le 28/9/05 13:03, Killobit à email@hidden est réputé(e) avoir
écrit :

> hello list,
>
> I've constructed the following AS:
>
> tell application "Finder"
>    set thePath to URL of container of item 1 of front window
>    return thePath
> end tell
>
> which gets the path of the current (read front most) Finder window,
> but it has 2 major flaws
>
> 1. it fails if no Finder windows are open
> 2. if fails if the front Finder window has no files in it
>
> I was wondering, how could i fix that so it will "always" work
>
> i've tried checking to see if the "current window" is "desktop
> window" but
> i keep getting "Can't get finder window 1" errors
>

In that case I would throw in a "try" handler.
You can recuperate the kind of mistake, error nomber and then decide what
would want to do in such cases.

try
    tell application "Finder"
        set thePath to URL of container of item 1 of front window
        return thePath
    end tell
on error error_name number error_number
    display dialog "Error name:" & return & error_name & return & return &
"Error number: " & error_number
end try

HTH

J.


Jay Louvion
Studio Casagrande
3, rue Müller-Brun
1208 Geneva

T+4122 840 3272
F+4122 840 3271

skypeme:
jaylouvion

www.studiocasagrande.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Getting file paths
      • From: Killobit <email@hidden>
References: 
 >Getting file paths (From: Killobit <email@hidden>)

  • Prev by Date: Getting file paths
  • Next by Date: Re: Object inheritance question, pt 2...
  • Previous by thread: Getting file paths
  • Next by thread: Re: Getting file paths
  • Index(es):
    • Date
    • Thread