Can't Get File Error in 10.2.6

I believe I have completely searched the BBS. I am in the process of converting a script that has worked for several year’s to OS X. Basically the script uses information found in a text file to insert PDF’s, in order, to form a book. I have been able to get the script to work (Thanks to Acrobat 6!). My problem is that if one of the page code pdf’s is missing I have instructions to insert a blank page. Now the folder that contains the PDF’s has a file called §blank.pdf in it, but when the script runs, I get a dialoge error box that says “Can’t get (in black text) file”§blank.pdf", then the box contains a list of all of the files in the folder including the §blank.pdf file. Does this have anythng to do with having to access or set permissions? I have replicated this “problem” on my work and home machines, both running X.2.6 The variable listOfAllFiles is defined earlier in the script

tell application “Finder”
set listOfAllFiles to list folder (pdfFiles as alias)
end tell

–here is the If statement that occurs several lines later that checks for the correct pdf, then should insert the blank page when the correct file is not found.

if (processingFirstPageOfForm is true) then
set pdfFilename to pageCodePrefix & pageNumber & pageSubpageDivider & subpageNumber & ¬
mastheadID & formNum & “_” & subForm & reviseString & “.pdf”
set pdfPagePath to (pdfFiles as text) & pdfFilename
set processingFirstPageOfForm to false
else
set pdfFilename to pageCodePrefix & pageNumber & pageSubpageDivider & subpageNumber & reviseString & “.pdf”
set pdfPagePath to (pdfFiles as text) & pdfFilename
set blankPagePath to file “§blank.pdf” of listOfAllFiles
end if

Any one get this error message before?

I suspect that this line is choking because you are referring to a list and not a valid reference to a folder.

set blankPagePath to file “§blank.pdf” of listOfAllFiles

It probably needs to be file “§blank.pdf” of folder “path:to:some:folder”

If all of the files in listOfAllFiles are in the same folder, you could use the Finder to get the container of one of them. I don’t know what listOfAllFiles contains (file paths, aliases, etc.) but maybe something like this will work:

tell application "Finder"
	set fileContainer to container of item 1 of listOfAllFiles as alias
	set blankPagePath to file "§blank.pdf" of fileContainer
end tell

I’m sorry. the variable pdfFiles was defined one line earlier with a choose folder with prompt.

try
set pdfFiles to choose folder with prompt “Where are the PDF files?”
end try

On one of my previous efforts I tried (with no success):
set blankPagePath to file “§blank.pdf” of folder (pdfFiles as alias)

I’ll try your suggestion! By the way, how do you get your code to show up in the white box?

** By the way, how do you get your code to show up in the white box? **

Wrap it in code tags. :slight_smile:

display dialog "Hi"

I think you have me on the right track. I tried “§blank.pdf” of folder “path:to:some:folder” it didn’t work. I took out the word folder and it worked (or at least it brought me to different error)

“§blank.pdf” of “path:to:some:folder”

Thanks!

set blankPagePath to (pdfFiles as text) & "ßblank.pdf"