F.launch selectively working

Hi everyone, can anyone shed some light on why the first example below works, but the second and third examples do not?? Totally perplexed.

Running Catalina.

EXAMPLE 1 (works):

// DEFINE THE APP PATH
Dim f As FolderItem
f = GetFolderItem("/Applications/Safari.app")

//  IF ALL OK - LAUNCH
If f <>  Nil Then
  f.Launch

EXAMPLE 2 (fails to launch):

 // DEFINE THE APP PATH
    Dim f As FolderItem
    f = GetFolderItem("/Applications/Mail.app")

    //  IF ALL OK - LAUNCH
    If f <>  Nil Then
      f.Launch

EXAMPLE 3 (fails to launch):

 // DEFINE THE APP PATH
    Dim f As FolderItem
    f = GetFolderItem("/Applications/Notes.app")

    //  IF ALL OK - LAUNCH
    If f <>  Nil Then
      f.Launch

I have noticed that Mail and Notes have no file extension displayed in the Applications folder, so I tried omitting the .app from the path name - to no avail.

Any help appreciated.

It may depend on the version of macOS that you are running on.

For instance in 10.15, system apps are actually in /System/Applications

But I also notice from your code that you’re checking for Nil, but you’re not checking whether the item exists.

1 Like

Yes - I just worked out that the actual path is /System/Applications - was just about to post the solution in case any other people had the same issue.

Thanks.

1 Like

Use LaunchServicesFindApplicationForInfoMBS to locate the apps. The Gods know what idiocy Apple will think of in the future to hide apps.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.