Re: Finder seems to have trouble with POSIX
Re: Finder seems to have trouble with POSIX
- Subject: Re: Finder seems to have trouble with POSIX
- From: Gil Dawson via AppleScript-Users <email@hidden>
- Date: Sat, 6 Aug 2022 17:19:46 -0700
Ah! Thanks, Deivy!
You're right: I had missed that!
--Gil
> On Aug 6, 2022, at 3:11 PM, Deivy Petrescu <email@hidden> wrote:
>
> Hey Gil,
>
> Read my post again, you do not need POSIX file for System Events:
>
> tell application "System Events" to exists file F1
>
> System Events understands Posix paths.
>
>
>> On Aug 6, 2022, at 14:50, Gil Dawson via AppleScript-Users
>> <email@hidden> wrote:
>>
>> Thanks, Deivy--
>>
>> Now we have two great alternatives that work:
>>
>> tell application "Finder" to exists F1 as POSIX file --from CK
>> tell application "System Events" to exists POSIX file F1 -- from you
>>
>> Thanks to both of you!
>>
>> --Gil
>>
>>> On Aug 6, 2022, at 10:54 AM, Deivy Petrescu <email@hidden> wrote:
>>>
>>>
>>>
>>>> On Aug 3, 2022, at 23:13, Gil Dawson via AppleScript-Users
>>>> <email@hidden> wrote:
>>>>
>>>> Hi--
>>>>
>>>> I'm using macOS Mojave V10.14.6.
>>>>
>>>> Could someone please help me understand what is happening here?
>>>>
>>>> set F1 to "/Users/gil/Desktop/Temp Test File.pdf"
>>>>
>>>> log "F1=" & F1 --> (*F1=/Users/gil/Desktop/Temp Test File.pdf*)
>>>> log "POSIX file F1=" & POSIX file F1 --> (*POSIX file F1=Internal
>>>> SSD:Users:gil:Desktop:Temp Test File.pdf*)
>>>>
>>>> set PF1 to POSIX file F1
>>>> log "PF1=" & PF1 --> (*PF1=Internal SSD:Users:gil:Desktop:Temp Test
>>>> File.pdf*)
>>>>
>>>>
>>>> tell application "Finder" to exists file F1 --> false (I expected an error)
>>>> tell application "Finder" to exists POSIX file F1 --> false (I expected
>>>> "true")
>>>> tell application "Finder" to exists (POSIX file F1) --> false (I expected
>>>> "true")
>>>> tell application "Finder" to exists PF1 --> true (I expected that!)
>>>>
>>>>
>>>> I would have thought that the first of the last four lines would error and
>>>> the last three lines would all return "true".
>>>>
>>>> I'd appreciate help understanding this.
>>>>
>>>> --Gil
>>>>
>>>
>>> You had an excellent explanation.
>>> Now if I may, here is a suggestion, use System events instead of Finder.
>>> This would return true:
>>>
>>> set F1 to "/Users/gil/Desktop/Temp Test File.pdf
>>> tell application “System Events" to exists file F1 --> true (if the file
>>> exists)
>>>
>>>
>>>
>>> Best, be safe, wear mask, get vaccinated and keep social distance.
>>>
>>> Deivy Petrescu
>>> 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
>
>
>
> Best, be safe, wear mask, get vaccinated and keep social distance.
>
> Deivy Petrescu
> 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