PDF not automatically opening

Use this board to ask questions or have discussions with other Genie users.
sunny
Profound User
Posts: 29
Joined: Wed Sep 08, 2021 1:01 pm
First Name: Sunny
Last Name: Krowski
Company Name: United Cerebral Palsy Arkansas
Phone: (501) 224-6067
Address 1: 9720 N Rodney Parham Rd
City: Little Rock
State / Province: Arkansas
Zip / Postal Code: 72227
Country: United States
Contact:

PDF not automatically opening

Post by sunny »

I have read several messages in Genie on this topic but don't seem to be getting it to work.

I have a CLP that uses
STRPCO
MONMSG MSGID(CPA0701 IWS4010)
STRPCCMD PCCMD(&NT) PAUSE(*NO)

Where &NT is "START \\IP address\IFS HOME folder\IFS user folder\' || &NM".
Where &nm is the name of the PDF document with the suffix .PDF.

When I run the CL on the green screen, it opens the PDF document in PDF without an issue.

I realized that I needed to do something in Genie so I added another field to the screen the has the link name \\IP address\IFS HOME folder\IFS user folder ||&NM

I added a button to the screen so that once the document has been created, they can view the document.

I have tried multiple ways to get the onclick to work but have not been able to get it to function.

I tried runPCCommand("start field");
I tried runPCCommand("start \\IP address\IFS HOME folder\IFS user folder\document.PDF");
I then read that sometimes Java has an issue with \ so I changed it to be runPCCommand("start \\\\IP address\\IFS HOME folder\\IFS user folder\\document.PDF");

I gave up on the field and hardcoded the path and document.

I tried runPCCommand("Acrobat.exe \\IP address\IFS HOME folder\IFS user folder\document.pdf");

I even tried runPCCommand("Acrobat.exe"); thinking it would just bring up Acrobat but it didn't work.
I tried to add pui.runPCCommand("Acrobat.exe");

I tried other things but so far nothing has worked.

I don't want to install command launcher on each computer.

What do you suggest for me to get the PDF to come up automatically?

Thanks for your help
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: PDF not automatically opening

Post by Scott Klement »

In most programming languages (C, C++, PHP, Node.js, JavaScript, Ruby, Python, Perl, Java... not going to list them all here) the backslash character is an "escape" character. So yes, you have to use two backslashes to insert one into the string. You said you read something about Java -- there is absolutely no Java in our product -- but JavaScript (which is not at all related to Java) also requires this as do most other languages.

If the PC is set up properly, the command is formatted properly, etc opening a PDF like this should work fine.

However, I wonder why you're trying to open PDFs as if you are in a 5250 emulator? Why not open them the normal way a web browser does, instead of the kludgy 5250 "pc command" approach?
sunny
Profound User
Posts: 29
Joined: Wed Sep 08, 2021 1:01 pm
First Name: Sunny
Last Name: Krowski
Company Name: United Cerebral Palsy Arkansas
Phone: (501) 224-6067
Address 1: 9720 N Rodney Parham Rd
City: Little Rock
State / Province: Arkansas
Zip / Postal Code: 72227
Country: United States
Contact:

Re: PDF not automatically opening

Post by sunny »

I am not opening it 5250. The CLP actually opens the PDF in acrobat. But, when I select the option from the Genie screen it doesn't open the PDF at all.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: PDF not automatically opening

Post by Scott Klement »

Genie is a 5250 emulator. I understand perfectly what you are doing -- you are running a PC command to open a PDF, and if the user happens to be running on Windows, it will open in whatever program they have installed (or in the case of AcroRead32.exe, it'll open in Adobe Reader, if they happen to have it installed and in their PATH.)

What you're doing should work fine -- and works fine for me. If you want to keep that methodology, you'll need to troubleshoot things and determine what the problem is.

However, this is a 5250 programming "way of thinking" about the problem.

Nobody in a web application "way of thinking" would say "let's launch the Windows command to open this file" -- that's just not the paradigm that people would use in web programming. Instead, they'd send the PDF in an HTTP request, and let the browser handle opening it. Alternately, they might use PDF software to render it directly in the browser screen.

Have you considered that approach? You can do it from Genie with the pui.download() function.
sunny
Profound User
Posts: 29
Joined: Wed Sep 08, 2021 1:01 pm
First Name: Sunny
Last Name: Krowski
Company Name: United Cerebral Palsy Arkansas
Phone: (501) 224-6067
Address 1: 9720 N Rodney Parham Rd
City: Little Rock
State / Province: Arkansas
Zip / Postal Code: 72227
Country: United States
Contact:

Re: PDF not automatically opening

Post by sunny »

When I run it on 5250, it looks like the attached.

When I run it in Atrium and take the same 6, it creates the PDF but does not open.

We are a non-profit and don't the resources to purchase new software or to have to go to all of our employees to install new software.

The files are stored on IFS so I don't think they will go to an http. If they can be opened that way, I am not familiar with that.

I still don't understand why it works on 5250 but not through Atrium.

Thanks for you help.
Attachments
2022-02-18 15_07_12-Window.png
2022-02-18 15_07_12-Window.png (49.72 KiB) Viewed 31870 times
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: PDF not automatically opening

Post by Scott Klement »

As I said before, I don't know why it's not working for you, it works fine for me.

I suggest troubleshooting the problem.
sunny
Profound User
Posts: 29
Joined: Wed Sep 08, 2021 1:01 pm
First Name: Sunny
Last Name: Krowski
Company Name: United Cerebral Palsy Arkansas
Phone: (501) 224-6067
Address 1: 9720 N Rodney Parham Rd
City: Little Rock
State / Province: Arkansas
Zip / Postal Code: 72227
Country: United States
Contact:

Re: PDF not automatically opening

Post by sunny »

I have been troubleshooting and have put it into debug. There has to be something in either Genie or Atrium that is causing this issue since it works fine when run on a green screen. In debug, it is running the command but just doesn't open and it opens find on green screen.

How do you recommend I "troubleshoot" this since the only difference is Genie/Atrium?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: PDF not automatically opening

Post by Scott Klement »

First of all, which of the methods are you using for running the PC command?
  • Java applet (deprecated)
  • PC Command Listener
  • PC Command Launcher
  • onpcccommand event
Can you show us your configuration that you're using to configure whichever of the above tools you're using?

Next, debug it in the browser tools
  • If using onpccommand, open your JavaScript in the browser's debugger, set a break point at the start of it, step through the code and see what's happening when it runs. Just as any other time you debug a program.
  • If using the PC Command Listener, open the developer tools for your browser and watch the network requests. You'll see a request made to localhost on the port that you've configured within your instance. What is happening to that connection? Is it running? Is there an error? Does the command look correct?
  • If using the PC Command Launcher, a specially crafted URL is being built that will run the launcher as a separate utility. In this case, you need to have configured your system to respond corretly to this URL. Use the browser's network tools to see that it is launching the URL, and what response it is getting. Compare the URL in the network request to the one configured in your system, make sure everything is spelled correctly, etc.
  • If using the Java applet, simply switch to another method. You will be getting an error in this case saying that the runCommand function isn't available, unless you have Java applet support set up properly. Most browsers today don't support Java applets, that's why this method is deprecated -- so I would strongly suggest changing to another method.
  • In all of the cases, watch the console to see if there are any errors or other telltale signs of a problem.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: PDF not automatically opening

Post by Scott Klement »

Also, to make sure you understand: This is a public forum, not technical support.

Imagine you had a problem with your car. You might:
  • Ask your friends if they've had a similar problem, or ask on social media. Good chance that someone might've had the same problem, they might point you in the right direction, etc. But, you certainly wouldn't expect them to actually fix it for you.
  • You could take it to a mechanic. Here you would expect it to be professionally diagnosed and fixed (for a fee.)
These forums are more akin to asking your friends or social media. They are intended to allow users of Profound Logic's tools to exchange ideas, tips, approaches, etc. These forums are free to everyone, there is no fee to use them. That's why I offer advice like "I suggest troubleshooting it".

If you want direct assistance, someone to actually work with you, etc. then please use technical support. For that, you do have to pay for a support contract (but I suspect your company is already doing that.)
sunny
Profound User
Posts: 29
Joined: Wed Sep 08, 2021 1:01 pm
First Name: Sunny
Last Name: Krowski
Company Name: United Cerebral Palsy Arkansas
Phone: (501) 224-6067
Address 1: 9720 N Rodney Parham Rd
City: Little Rock
State / Province: Arkansas
Zip / Postal Code: 72227
Country: United States
Contact:

Re: PDF not automatically opening

Post by sunny »

I understand the purpose for this forum. I have seen similar questions from others but the answers didn't seem to work for my system so I thought someone might have some other suggestions! I didn't know it was limited as to what questions could be asked.

As I said in the first of this question, it works fine on green screen so there has to be something about your product that blocks it from working and I am not wanting to go to 1000 pcs and install new software to make it work. I don't see a straight forward reason it just stops working because it is being called through Genie/Atrium.

I am sorry that you were inconvenienced. I thought that a user that had been through my situation might have an answer.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests