Previous Thread
Next Thread
Print Thread
PDFX 9 Window's A-Shell Issue #35685 18 Nov 22 04:39 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
In trying to upgrade from PDFX 3 to 9, we're seeing an issue with Window's A-Shell. I've attached a screenshot with a "windows cannot find "file to be created by PDFX error. I click OK on the error dialog, and PDFX 9 creates the file as expected.

I've tested with the same results from 6.5.1721.3 and 6.5.1721.7.

I can't go back further because our code is compiled with the new DYNFUNC named parameter header flag.

P.S.

ATE works as expected.

Attached Files PDFXStd-9.2.359-ashell-not-exist.png
Last edited by Stephen Funkhouser; 18 Nov 22 04:46 PM.

Stephen Funkhouser
Diversified Data Solutions
Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35686 18 Nov 22 05:12 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
It's not clear to me what event is triggering the error here. Is it the automatic launch of the PDF viewer? Did the pdf file not get created?

Seems like it should be easy to isolate and reproduce the problem, assuming it is within the perimeter of PDFX, with a single-line program consisting of the XCALL SPOOL with the print file.

I take it that the same process worked with PDFX3. But despite efforts to try to bridge the gaps between PDFX3 and the later versions, there were a lot of niggling little differences in the names of the directives, etc.that have to be translated. So being able to see the exact print file (or at least the //PDFX directives) may be critical to sorting this out.

Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35687 18 Nov 22 05:28 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
Sorry, had to reboot my laptop before I could find the code.

It happens regardless of whether or not the PDF viewer is launched. The pdf file does get generated, but only after clicking clicking "OK" on the dialog.

Yes, this works with PDFX 3.

Code
		prefix'filename$ = fn'fileunique_get_filename$(mode=FILEUNQ_FN_JOBNAM ,path$="PRINT:" ,amos'spec=1)
		ch'prefix = Fn'NextCh(CH_BASE)
		OPEN #ch'prefix,prefix'filename$,OUTPUT

		!Save created PDF file
		PRINT #ch'prefix,"//PDFX,Save.Type,2"
		!Turn off save dialog
		PRINT #ch'prefix,"//PDFX,Save.ShowSaveDialog,0"
		!Specify file output
		PRINT #ch'prefix,"//PDFX,Save.FullFileName," + pdf'filename$

		IF (pdfx'options.open'pc'file = 1) THEN
			PRINT #ch'prefix,"//PDFX,Save.App.Run,1"
		ELSE
			PRINT #ch'prefix,"//PDFX,Save.App.Run,0"
		ENDIF

		!Overwrite existing files
		PRINT #ch'prefix,"//PDFX,Save.WhenExists,Overwrite"
		!Add some generic info fields
		PRINT #ch'prefix,"//PDFX,Info.Use,1"
		![106]
		IF (font.size <> 0) AND (font.name <> "") AND (font.weight <> "") AND (printer = "PDFL") THEN
			PRINT #ch'prefix,"//SETMAPMODE,LOENGLISH"
			PRINT #ch'prefix,"//SETFONT,";STR(font.size);",";font.name;",0,0,";font.weight;",0,0"
		ENDIF
		CLOSE #ch'prefix

		XCALL SPOOL &
			, file$=filename$ &
			, printer$=printer &
			, switches=SPL_NODELETE+APEX_OFF  &
			, prefix$=prefix'filename$



Stephen Funkhouser
Diversified Data Solutions
Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35688 18 Nov 22 06:55 PM
Joined: Sep 2002
Posts: 5,471
F
Frank Online Content
Member
Online Content
Member
F
Joined: Sep 2002
Posts: 5,471
Have you tried changing the target dir to something simple like c:\pdfx ?

Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35689 18 Nov 22 07:00 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
I guess it's not as easy to reproduce as I thought it would be. Here's my test file...
Code
//PDFX,Save.Type,2
//PDFX,Save.ShowSaveDialog,0
//PDFX,Save.FullFileName,"c:\users\joaqu\documents\in04q.pdf"
//PDFX,Save.App.Run,1
//PDFX,Save.WhenExists,Overwrite
//PDFX,Info.Use,1
hello world


Works fine here (naturally!)

Is it some issue with the actual directory? Does it happen with a directory like c:\temp?

Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35692 18 Nov 22 08:44 PM
Joined: Sep 2002
Posts: 5,471
F
Frank Online Content
Member
Online Content
Member
F
Joined: Sep 2002
Posts: 5,471
Jack again attaching himself to my coat-tails laugh

Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35694 18 Nov 22 09:36 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
Changing the directory doesn't change anything; however, adding a trace.print statement right before the prefix file is created fixes it.


Stephen Funkhouser
Diversified Data Solutions
Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35697 18 Nov 22 10:10 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
Hey Frank - I didn't notice you tiptoeing into this chat room! Tempting to say something about great minds... but maybe it should be "wrong answers..." instead.

So Stephen, you put a trace right before the prefix file is opened? closed? Seems to suggest a timing issue. Was the filespec that it was trying to create the one from the fn'fileunique_get_filename$() function, or was it just the pdf version of the original filename? Does a very short sleep in place of the trace do the trick?

Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35699 18 Nov 22 10:55 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
Here's an improved version of the simple test program, but it continues to work ok here without any delays or traces. Could be run as is except for the output filespec.
Code
defxcall SPOOL, file${,printer$,switches=0,copies=1,form$="",lpp=56,width=80,prefix$="",suffix$="",overlay$="",totpages=0}

    open #1, "prefix.prt", output
    ? #1, "//PDFX,Save.Type,2"
    ? #1, "//PDFX,Save.ShowSaveDialog,0"
    ? #1, "//PDFX,Save.FullFileName,""c:\users\joaqu\documents\APEX\in04q.pdf"""
    ? #1, "//PDFX,Save.App.Run,1"
    ? #1, "//PDFX,Save.WhenExists,Overwrite"
    ? #1, "//PDFX,Info.Use,1"
    close #1
    
    open #2, "test.prt", output
    ? #2, "Hello world"
    close #2
    
    xcall SPOOL, file$="test.prt", prefix$="prefix.prt", &
                 printer$="pdfx9"
    end

Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35701 18 Nov 22 11:09 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
Red herring with the trace.print fixing it. I can't reliably figure out how to reproduce. It's happens seemingly randomly and then doesn't just as randomly.

Not fun to track down.


Stephen Funkhouser
Diversified Data Solutions
Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35703 18 Nov 22 11:41 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
Sure sounds like some kind of timing issue. I did experiment with what happens if the prefix file isn't found, but in that case it simply proceeds as if there wasn't any prefix (creating a pdf with the default name, location and behavior).
I take it adding a SLEEP 2 doesn't resolve it?

Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35721 21 Nov 22 09:58 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
Sorry, pretty busy trying to resolve an email delivery problem. What black-hole, voodoo magic practice this is.

I think I've found the issue, and it's in our code. We prompt the "would they like to open the folder the pdf is being generated in". This uses MX_SHELLEX, it's supposed to be striping the filename via Fn'To'Host$() with flag=1 on local windows. Somehow the filename is still in the folder$ variable, and this is where the error message is prompting.

No idea when this started happening. I'm going to fix this on our side. Very confusing; since this did appear to start happening until I updated to PDFX 9.

He's a snippet of the client folder launching function.
Code
	folder$ = fn'directory_exp'env$(folder$,DIRGENV_ATE)

	XCALL AUI,AUI_ENVIRONMENT,MXOP_GET,guiflags
	IF (guiflags AND AGF_LOCWIN) THEN
		folder$ = Fn'To'Host$(folder$, 1)                               ! return just the directory part of the native path
	ELSE
		folder$ = fn'directory_get'dir$(org'spec$=folder$, mode=DIRGENV_ATE)
	ENDIF

	IF (guiflags AND AGF_LOCWIN) THEN                                         ! if environemnt is any local windows
		XCALL MIAMEX,MX_SHELLEX,fn'client_launch'folder,folder$,action,params

	ELSEIF ((guiflags AND AGF_ATE) # 0) THEN                                  ! if environment is ATE
		XCALL MIAMEX,MX_SHELLEX,fn'client_launch'folder,folder$,action,params


P.S. sorry for waisting your time.


Stephen Funkhouser
Diversified Data Solutions
Re: PDFX 9 Window's A-Shell Issue [Re: Stephen Funkhouser] #35722 22 Nov 22 12:58 AM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
Very confusing indeed. But I'm glad you found it. Not sure I ever would have.


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3