Re: I made a nightmare
Re: I made a nightmare
- Subject: Re: I made a nightmare
- From: Yvan KOENIG <email@hidden>
- Date: Wed, 09 Dec 2015 16:19:44 +0100
Thanks
but it’s a nightmare because I use the original syntax in numerous scripts since several years.
I’m really surprised to see that such a simple syntax is now failing.
Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) mercredi 9 décembre 2015 16:19:38
> Le 2015/12/09 à 16:15, Thomas Fischer <email@hidden> a écrit :
>
> Hello Yvan,
>
> that's interesting, since it touches a number of the problems I run into myself when using AppleScript.
> I tested this on Mavericks but doubt that there are major differences to El Capitan.
>
> My suggestions are:
> – don't coerce to text, stay within the frame of HFS:
> use "folder theName of sourcefolder" instead of "((sourcefolder as text) & theName)"
> – for this to work you have to
> remain within "System Events", so drop "tell me"
> – it seems that AS needs another level of evaluation so
> add a "get".
>
> Altogether I'd use
>
> set dest to quoted form of (get POSIX path of folder theName of sourcefolder)
>
> I think one of the problems is what the "System Events" or you (as in "me") regard as files or folders that can have a POSIX path, the other is that you have to get the POSIX path established first before you can get its quoted form.
> Probably somebody else has some deeper insights.
>
> Best regards
> Thomas Fischer
>
>
>
> Am 09.12.2015 um 14:46 schrieb Yvan KOENIG <email@hidden>:
>
>> Hello
>>
>> I’ running under 10.11.2
>>
>> I try to run this simple script :
>>
>> set theName to "trucmuche"
>> --set sourcefolder to (path to desktop as text) & "formoosmahna:" as alias
>> set sourcefolder to choose folder
>> tell application "System Events"
>> if not (exists folder theName of sourcefolder) then
>> make new folder at end of sourcefolder with properties {name:theName}
>> end if
>> -- set dest to quoted form of POSIX path of ((sourcefolder as text) & theName)
>> tell me to set dest to quoted form of POSIX path of ((sourcefolder as text) & theName)
>> end tell
>>
>> and I get an awful :
>>
>> Résultat :
>> error « Il est impossible d’obtenir POSIX path of \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\"." number -1728 from «class posx» of "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche"
>>
>> Same result if I don’t insert « tell me to ».
>> I made several attempts and the only one behaving flawlessly is :
>>
>> set theName to "trucmuche"
>> --set sourcefolder to (path to desktop as text) & "formoosmahna:" as alias
>> set sourcefolder to choose folder
>> tell application "System Events"
>> if not (exists folder theName of sourcefolder) then
>> make new folder at end of sourcefolder with properties {name:theName}
>> end if
>> set dest to my quoteIt((sourcefolder as text) & theName)
>> end tell
>>
>> on quoteIt(aPath)
>> return quoted form of POSIX path of aPath
>> end quoteIt
>>
>> As far as I remember, the initial syntax behaved well in recent past.
>> Is it a new behavior introduced by 10.11.2 ?
>>
>>
>> Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) mercredi 9 décembre 2015 14:42:36
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
> _______________________________________________
> 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
_______________________________________________
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