a little help with network stuffs...

Hi everyone,

I’m trying to make a script that basically opens a PDF on a network volume.
The pdf’s title will change but the network location is constant. I need the script to ask the user for an order#, which in turn is the title of the pdf. So, order# 123456 = 123456.pdf and is always in the same folder on the network. Here is what I’ve got so far, but as you can see, this will go nowhere. This is where I’m stuck:

display dialog "What is the order number?" default answer "" buttons {"OK"} default button 1
set theAd to text returned of the result
set pdfdir to "vol1:DPS-ads:PDFS:" as alias


tell application "Preview"
	open theAd
	
	
end tell
end

Thanks a lot everybody for the help

Hows about

display dialog "What is the order number?" default answer "" buttons {"OK"} default button 1
set theAd to text returned of the result
set pdfdir to "vol1:DPS-ads:PDFS:" & theAd as alias

tell application "Preview"
	open pdfdir
end tell

Beautiful, thanks James. That definitely did the trick, although now I’m trying to get more complicated. I want to have the script spit out a self-defined message if the file doesn’t exist in that directory. I’ve gotten to this point, but can’t get the err dialog to function. Here’s where it is now:

display dialog "What is the order number?" default answer "" buttons {"OK"} default button 1

set theAd to (text returned of the result)
set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set nameExtn to "." & "pdf"
set proofad to (theAd as text) & nameExtn
set pdfAD to "vol1:DPS-ads:PDFS:" & proofad as alias


tell application "Preview"
	try
		open pdfAD
		if err then display dialog "Please check the ad status for PDF_SUCCESS before proofing" buttons {"ok"} default button 1
	end try
end tell

Thanks again!

Hi,

the try block has the stucture

try
    -- try something    
on error
    -- an error has occured
end try

if the file pdfAD doesn’t exist, the error already will thrown in the line

set pdfAD to "vol1:DPS-ads:PDFS:" & proofad as alias

try this:

display dialog "What is the order number?" default answer "" buttons {"OK"} default button 1

set theAd to (text returned of the result)
set proofad to theAd & ".pdf"
try
    set pdfAD to "vol1:DPS-ads:PDFS:" & proofad as alias
    
    tell application "Preview"
        open pdfAD
    end tell
on error
    display dialog "Please check the ad status for PDF_SUCCESS before proofing" buttons {"ok"} default button 1
end try

Note: text item delimiters are not needed

Thanks, that about does it. Problem solved, and I learned a little too :slight_smile:

Thanks guys