Re: Lists and network volumes
Re: Lists and network volumes
- Subject: Re: Lists and network volumes
- From: Jay Louvion <email@hidden>
- Date: Tue, 30 May 2006 17:45:36 +0200
- Thread-topic: Lists and network volumes
Title: Re: Lists and network volumes
On 29.5.2006 20:04, entity "deivy petrescu" <email@hidden> spake thus:
>
> On May 29, 2006, at 13:27, Jay Louvion wrote:
>
>> On 29.5.2006 16:45, entity "deivy petrescu" <email@hidden>
>> spake
>> thus:
>>
>>> Jay, the code above works fine OMM.
>>> You certainly do not need to open the folder to get the count of
>>> folders in that folder.
>>> What is the error that you get?
>>>
>>>
>>> Deivy
>>
>> My code sometimes errors out saying “Finder got an error: Can't get
>> name of
>> every folder of alias "/Volumes/public/Tempo/DIDIER"”
>
> Something is very wrong with the above statement. The "Finder" will
> never see "/Volumes/public/Tempo/DIDIER" as a bonafide item.
> The "Finder" would complain about such folder. "Finder" only
> understands colon as folder delimiters.
> My suggestion, enclose the folder you want with a choose folder.
> Something like:
>
> set thefolder to choose folder
> tell application "Finder" to set EventCodeList to name of every
> folder of thefolder
>
> This way, you ( or any other user) will not make any mistakes when
> selecting the folder.
>
> you can also use "System Events" instead of "Finder" it will accept
> posix file paths.
>
>> The network volume is a NAS running Unix; but I had encountered the
>> same
>> kind of error when mounting a volume attached to a Mac machine on the
>> Network (a FireWire LaCie disk).
>>
>> I found that by coding an open folder, the error was never returned.
>> Otherwise, the error occurs, even though only sometimes.
>> How would you code something similar ? Sometimes (=mostly) my
>> coding is
>> somewhat clumsy and I could do with some correcting if it seems
>> necessary.
>> My utlimate goal is to get the folder whose label is set to 2
>> (=red). That
>> errors ALL the time unless the Finder is activated and delayed.
>>
>
> I just tried the script with an external FireWire and it worked fine
> without a single "Finder" window opened.
> I do not think your code is clumsy, errors happen and making mistake
> is the best way to learn!
> However, if I may I'll give you a suggestion;
> Instead of
>
> set thefolder to alias "public:Tempo:DIDIER:"
>
> where I assume you are writing the name of the volume, why don't you
> do the following, with your Script Editor window open you type the
> following outside a tell block
>
> set k to posix file "
>
> Then select the folder you want to work with and click and drag it to
> the Script Editor window. SE will prompt you to select either copy
> the item of an alias, choose alias, close the open quotation and it
> will be converted into:
> set k to file "an Finder type alias"
> change it to
> set k to alias "an Finder type alias" -- file by alias.
>
> You should be OK and good to go!
>
>
>> TIA,
>>
>> j.
>>
>> Jay Louvion
>> Studio Casagrande
>> 3, rue Müller-Brun
>> 1208 Geneva
>>
>
> Very welcome!
> Tell me if it works for you.
>
> Deivy
Thanks for your time, Deivy. I am unfortunately still exactly at the same point. The path returned by your method is the same as the one specified in my script. I now don’t get any more mistakes from getting the list of the names of folders, but it’s impossible (following my experience) to return the names of folders with red labels without activating the Finder and throwing in a delay to boot.
The only way I can get things to work is like this:
tell application "Finder"
set thefolder to "public:Tempo:DIDIER:" -- will compile even if the volume is not mounted
open folder thefolder -- imperative
activate --imperative
delay 0.5 --tried 1 and 0.1, but 0.5 seems OK; also imperative
activate me -- convenient
set EventCodeList to name of every folder of folder thefolder whose label index is 2
end tell
The error returned otherwise is: “Finder got an error: Can't get name of every folder of folder "public:Tempo:DIDIER:" whose label index = 2.”
Thanks for your time.
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
P Please consider the environment before printing this email.
_______________________________________________
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