Help with Relative URLS/File paths

I am working on project (a master PDF that requires relative urls i.e. folder/pdf-files/filename1.pdf
the Master PDF will be in a folder called “master”.
How do i reference the file URLS in applescript? without using an absolute address.
The finished PDF will be put in 2 different locations, the first a windows server, and second is a CD/DVD.
would for example
set FileLocation to “folder/pdf-files/filename1.pdf” as string
work?
keith

Hello.

So inside your PDF document you will have something like : file://folder/pdf-files/filename1.pdf ?
And now you want to create a list with file urls for all the files which are within your master.PDF’s folder?

Please answer and we’ll see what we can do.

yes, thats right, but i have 3000 file references in the master PDF, i already have a script that will search for their name and add a hyperlink (in indesign CS4) i just want to know if i can use relative URL’s / file paths to the files.

to make things clearer: in the indesign document i have a reference: [aabb1122] my script loads the filenames which in this case would be aabb1122.pdf, it removes the extension (“.pdf”), and then searches the document for “aabb1122” when it locates it it creates a hyperlink to the file in a folder, what i want to do is refer to that folder with something like " file://folder/pdf-files/" so that the exported pdf can be used on either a cd or a windows server.
i hope that makes things clearer.

Hello.

I can help you with the part that generates the urls as relative references, but somebody else would have to help you with replacing the former links or references in your inDesign document.

I surmise that every file referenced by the inDesign document is laying under or in the same catalog as the main document. Is that correct?

What I will do, is have a file list, then provide you with a routine for entering the file reference to search for, and then return back a file url relative to the the main document.

My solution will work as long as all the filenames is unique. I’m a little bit out of time today, so please be patient.

Hello.

I have made the snippet for you that creates a list of file urls, if this is not exactly what you have in mind, or you need something aside that you may actually use to look up into this generated list with, don’t hesitate!


property theNames : {}
property LF : (run script "\"\\n\"") as Unicode text -- Nigel Garvey
-- Parts © McUsr 2010 and put in the Public Domain
set astid to AppleScript's text item delimiters
set theFolder to (choose folder) as Unicode text
tell application "Finder"
	set theNames to every item of entire contents of folder theFolder as alias list
end tell
set AppleScript's text item delimiters to LF
set theNames to items 2 thru -1 of my theNames as Unicode text -- every text item if there is no .DS_STORE file
set AppleScript's text item delimiters to theFolder
set theNames to every text item of my theNames
set AppleScript's text item delimiters to ""
set theNames to theNames as Unicode text
set AppleScript's text item delimiters to ":"
set theNames to every text item of my theNames
set AppleScript's text item delimiters to "/"
set theNames to theNames as Unicode text
set theNames to do shell script "echo " & quoted form of theNames & "| /usr/bin/sed 's/^/file:\\/\\//g'"
log "LIST OF FILE URLS:\n ”\n " & theNames
” and here is the list, what was over was the text
set AppleScript's text item delimiters to return
set theNames to every text item of my theNames
set AppleScript's text item delimiters to astid