STRPCCMD

Use this board to ask questions or have discussions with other Genie users.
Post Reply
kaw
New User
Posts: 15
Joined: Tue Sep 11, 2012 2:16 pm
First Name: Djibril
Last Name: SOW
Company Name: union5
Contact:

STRPCCMD

Post by kaw »

How to open excel by clicking a button?

Thank you!
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: STRPCCMD

Post by Scott Klement »

If your spreadsheet is on IBM i, consider using the pui.download() JavaScript API from an onclick event in a button.

Here's the docs:
http://www.profoundlogic.com/docs/displ ... 8config%29

In Genie, you'd want to set your onclick to something like:

Code: Select all

pui.download({ "id":  "/ifs/path/to/spreadsheet.xls", "inline": true, "contentType": "application/vnd.ms-excel" });
You'd also need to set up your PUIDNLEXIT program to allow the download. (See link, above, for more info.)

It's also possible to do this with STRPCCMD... But, with STRPCCMD, the spreadsheet needs to be accessible to the PC already (i.e. available via Windows Networking or something)

Code: Select all

strpccmd pccmd('X:\Path\To\spreadsheet.xls')
But, again, that'll only work if the pathname is already something accessible to windows, whereas with pui.download() it's transferred over HTTP the same as the web page. I personally find that more elegant.
kaw
New User
Posts: 15
Joined: Tue Sep 11, 2012 2:16 pm
First Name: Djibril
Last Name: SOW
Company Name: union5
Contact:

Re: STRPCCMD

Post by kaw »

I'm Genie. I have an RPG program on green screen allows you to create files and places them in the IFS and opens automatically with to command STRPCCMD and I would do the same on Genie.
I tried a button
STRPCCMD pccmd ('L: \ www \ kaw \ toto.pdf')
but I have the following error message:OnClick Error: Unexepected identifier
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: STRPCCMD

Post by Scott Klement »

STRPCCMD would need to be called from a CL program, the QCMDEXC API, or another similar API. You can't run it directly from a Genie button, since that button actually runs on your PC's browser, it doesn't run on IBM i -- and therefore can't run IBM i commands.

However, there's a JavaScript API named runPCCommand that you can call from a Genie button. It does the same thing as STRPCCMD -- basically, just a JavaScript implementation of STRPCCMD.
http://www.profoundlogic.com/docs/displ ... ommand+%29

But, beware of backslashes. in the CL environment, backslash is just a normal character. But with JavaScript, it has a special meaning, so you need to be sure you escape it. This is described in the preceding link as well.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests