Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
Is it possibly to write to the windows clipboard from either an RPGLE program or from a 5250 session? For example I have an item entry screen, I want to capture the item number, then a pipe and then item description to the clipboard. Once in the clipboard the information will be pasted to another application.
I don't think you would want to use the clipboard for that. Obviously you can do a copy and paste between a Windows app and your 5250 Client Access session. That would probably be better than trying to copy into your clipboard and then running some process that will have to try to access and convert the data into something you can use.
What software are you using to enter the item number? And is it web-based?
Nothing comes to mind, at least not directly. There may be other ways to accomplish the goal, though.
Can't speak for other vendors, but if you're using IBM PC5250, you could use STRPCCMD to start a Windows command.
Another possibility is the 'Incoming Remote Command' feature of System i Access, which is an rexec daemon. From server you use RUNRMTCMD. But this method requires you to know the host name or IP address of the Windows PC (which isn't super difficult to get, just another thing to consider.)
Either way you'd have to write the Windows program that you're going to put in the command string, which would accept the text as a parameter, and the only thing it would do is put it on the clipboard and quit.
Dale - Thanks for the reply. Interesting idea.
TFisher - I am interfacing to an existing program that accepts input from the clip board. The item number would be entered in green screen :(.
I doubt it is possible. iSeries Access is setup to use Data Queues for Host-to-PC communications. But it is an interesting challenge, in deed.
You could setup a data queue that is used to add stuff the the Windows Clipboard.
Post stuff to that data queue from your RPG program.
Then on the windows-side, write a program that waits on the data queue for data, when it gets something it copies that dataqueue data to the clipboard.
The host side is easy, just data queue APIs on the PC-side you'd need to write a program.
Sorry, I totally misread what you are trying to do. I was thinking you wanted to "read" from the clipboard into an RPG program. It should be a bit easier to do what you want to do.
I assume that the PC app doesn't allow the item number to be passed in as a parm?
You can use the STRPCCMD or RUNRMTCMD technique and then use something like 'echo your item number here | clip' to pipe the text into the clipboard. You may have to create a BAT file on the PC and run that, but I think you can just use echo. I have not done anything like this in a while.
Amazing what you learn on this site. Good tip, Fish!
STRPCCMD PCCMD('ECHO 5381 | clip') PAUSE(*NO)
Copies the value '5381' to the clipboard in Windows.
Fish,
Is RUNRMTCMD possible if your PC is remote? I connect from home to System i, how do I direct RUNRMTCMD to my PC session?
thanks Bob! Every once in a while I come up with something halfway useful.
TFisher / Bob - That is awesome!
Pipe it to a CLIP huh? Never heard of CLIP before. Well done Fish.
CLIP
De!--script--ion:
Redirects output of command line tools to the Windows clipboard.
This text output can then be pasted into other programs.
Parameter List:
/? Displays this help message.
Examples:
DIR | CLIP Places a copy of the current directory
listing into the Windows clipboard.
CLIP < README.TXT Places a copy of the text from readme.txt
on to the Windows clipboard.
Chris Ringer
Never heard of clip before either; cool.
Did a little testing. Original question needed to embed a pipe as part of the clipboard data, which seems to be problematic. If you include it in quotes, the quotes are also put on the clipboard. Can you use a different separator? If not, you may have to parse out the quotes.
Also, when I paste, I'm always getting a CRLF. Not sure if this is coming from echo or from clip, but either way you may need to be aware of that.
another thought is that you might look at aaron bartell's mowyourlawn.com, his rpg2dt function, which you utilize the data queue (which I know was already suggested) and then you call whatever from the other side (which obviously would utilize the "clip" command).
One reason I suggest this is not everyone is utilizing i series access and other telnet products do not necessarily support strpccmd, etc.
I use rpg2dt, to open browser windows (like say you want to track a ups package, on the green screen, they click a function key) and a browser window opens up with the ups tracking information. Or say that you want to force a bat to run or a program to execute, or you want to prefill a web page, etc. lots of different ideas.