Cannot open pdf files (sometimes)

I’m runnung xojo on Macos 14 Mojave. My app has an array of around 100 pdf files, names of which are also set out in a Listbox The files are all stored in the same location.

When the user selects a pdf from the Listbox, the file should open, and in most cases it does, using the default app Preview (I’ve also set Adobe Reader as the default and exactly the same problem described below happens).

Nearly always everything works fine, but there are some pdfs that will not open, and I get the error message “The application “[Filename].pdf” could not be launched because a miscellaneous error occurred (OSStatus -36).”

To make sire there is nothing in my application that is causing the error, I have created a new desktop project with a button on the screen. The Action code for this button is

Dim f as FolderItem = GetOpenFolderItem("???")

I have created a test folder with 20 of the pdfs and 3 of these will not open. It’s always the same 3!

I’ve seen a thread on this forum on a similar problem but there did not seem to be any solution.

Has anyone any ideas what might be causing this? And what can I do?

Most of the pdfs were downloaded from the internet, but I have created a few of them myself using various apps.

Is the format of a pdf file sometimes different?

All the pdfs open ok when this is done from Finder, or from within Preview, or within the Chrome browser

Incidentally, they also all open ok when I use an Applescript app I wrote to do the same thing as my Xojo app,

Any solutions or suggestions gratefully received!

that is a bug that is ignored probably because „the average user“ does not open files nowadays (and if he does so, then he deserves an IOException). The case number is 58856. I requested to make it public but it is still private.
The files that do not open were probably transferred to your computer using an MS-DOS formatted USB-Drive.

Workaround: open the files using


error 36 means I/O error.
where are the pdf files located ? on a network drive ?

They are all on my local hard drive, inside the Mac

Thanks for the advice! Some of the files were created on my present computer, and some were downloaded from the internet. I have not used a USB drive.

I’ll try your workaround soon

I’ve now tried the ShowURL solution, but I’m not sure exactly how to use it as a workaround = so could you go a bit further please!

I now have this:

Dim f as new FolderItem
f = FolderItem.ShowOpenFileDialog("???")
If f.URLPath <> “” Then

This works and shows the URL of the selected file, even if it is one of the ones that the next line
doesn’t open.

So the error is definitely when it gets to the line.

The command you mention will show the url correctly but it doesn’t actually solve the problem.

Forgive me if I’m missing something - I’m fairly new to this!


dim f as FolderItem

f = Folderitem.ShowOpenFileDialog("")

if (f <> nil) AND (f.Exists) then
end if

Thanks for this - it works! Though I don’t understand why, as the Xojo documentation says ShowURL displays in a browser. But never mind that - I’m happy!