Quark--Opening file

Dear All,
Please see below the code. If file exist then it should open that files only, I tried with try block as well. Can any one tell me where is the problem.


set myJobID to "QuarkTest"
set myPageHeight to "11\""
set myPageWidth to "8\""
set AdvertiserName to "Test 1"
set RunDate to "Test 2"
set ColorInfo to "Test 3"
set SalesRep to "Test 4"
set StatusInfo to "Test 5"
tell application "QuarkXPress Passport"
	activate
	set myCacheFolder to "Macintosh:Test:"
	display alert "my Cache Folder is : " & myCacheFolder
	set myJobIDFolderPath to myCacheFolder & myJobID & ":"
	display alert "myJobIDFolderPath : " & myJobIDFolderPath
	set myDocument to myJobIDFolderPath & myJobID
	display alert "Complete Pat: " & myDocument
	display alert "File Name: " & myJobID
	--try
	tell application "Finder"
		if exists (myDocument) then
			open file myDocument
		end if
	end tell
	--on error
	tell default document 1
		set proprties to {automatic text box:false, facing pages:false}
	end tell
	make new document at beginning with properties {page width:myPageWidth, page height:myPageHeight, horizontal measure:inches, vertical measure:inches, automatic text box:false, keep master page items:false}
	tell page 1 of master document 1
		set properties to {top margin:"0", left margin:"0", bottom margin:"0", right margin:"0"}
	end tell
	--end try
end tell

Regards,
Poo

I don’t this one is too much complicated. Some where I am doing a silly mistakes and since this is the first time I am developing script for Quark and I used Finder to check existence of file.

Regards,
Poo

Hello.

Try changing this:


 tell application "Finder"
       if exists (myDocument) then
           open file myDocument
       end if
   end tell

into this :


 tell application "Finder"
	try
       		myDocument as alias
		open file myDocument
		on error
			display alert "Can't find file " & myDocument
	end try
 end tell

Hi,

I’m sure that Quark can open files itself, the Finder is not needed


set myJobID to "QuarkTest"
set myPageHeight to "11\""
set myPageWidth to "8\""
set AdvertiserName to "Test 1"
set RunDate to "Test 2"
set ColorInfo to "Test 3"
set SalesRep to "Test 4"
set StatusInfo to "Test 5"

set myCacheFolder to "Macintosh:Test:"
display alert "my Cache Folder is : " & myCacheFolder
set myJobIDFolderPath to myCacheFolder & myJobID & ":"
display alert "myJobIDFolderPath : " & myJobIDFolderPath
set myDocument to myJobIDFolderPath & myJobID
display alert "Complete Pat: " & myDocument
display alert "File Name: " & myJobID

tell application "QuarkXPress Passport"
	activate
	try
		open (myDocument as alias)
	on error e
		display dialog e
		tell default document 1
			set proprties to {automatic text box:false, facing pages:false}
		end tell
		make new document at beginning with properties {page width:myPageWidth, page height:myPageHeight, horizontal measure:inches, vertical measure:inches, automatic text box:false, keep master page items:false}
		tell page 1 of master document 1
			set properties to {top margin:"0", left margin:"0", bottom margin:"0", right margin:"0"}
		end tell
	end try
end tell


Thanks stefen,
It is working fine now.

Regards,
Poo