Discussion:
loading the clipboard
(too old to reply)
Jim Nagel
2019-01-02 15:40:09 UTC
Permalink
From within a program, is there a way of loading a specified string onto
the clipboard?

It used to be possible in Ro4.39 but the routine I had there does not work
in Ro5.

I'd want to do this from within Basic or a Datapower script, or perhaps a
PHP script.

The intention is that the user can then use Ctrl-V to paste the string
into a dialogue field of some other application. For example, generate an
address to paste onto a envelope for printing, or generate an email
address to paste into the email client.
--
Jim Nagel www.archivemag.co.uk
"From" address is genuine but will change. Website has current one.
Ronald
2019-01-02 19:50:43 UTC
Permalink
Post by Jim Nagel
From within a program, is there a way of loading a specified string onto
the clipboard?
It used to be possible in Ro4.39 but the routine I had there does not work
in Ro5.
I'd want to do this from within Basic or a Datapower script, or perhaps a
PHP script.
The intention is that the user can then use Ctrl-V to paste the string
into a dialogue field of some other application. For example, generate an
address to paste onto a envelope for printing, or generate an email
address to paste into the email client.
I have used Typer by Martin Bazely for something similar in the past.
http://www.starfighter.acornarcade.com/mysite/utilities.htm
I think it is as simple as writing the text file it expects to find in
<Wimp$ScrapDir>.Typer.File You have to click on the icon to deposit the
text at the focus though. The intended design of dragging some text to
the iconbar icon is pretty handy as a bonus.

Written in BASIC, probably many areas of interest to you.

Ronald M.
Jim Nagel
2019-01-03 15:23:43 UTC
Permalink
Post by Jim Nagel
From within a program, is there a way of loading a specified string onto
the clipboard? It used to be possible in Ro4.39 but the routine I had
there does not work in Ro5.
Found the routine I was using on the RiscPC (4.39). It used
SYS "ClipboardHolder_Copy" ,0,&FFF,A$,L%
but RiscOS 5 does not (yet) provide that SYS call.
Could it be added? Would surely be widely useful.

Meanwhile my workaround is to write the string to a scrap file and cause
it to open as a tiny filer window, from whence file can be dragged to the
required location. (Ctrl-V in the Ro4 clipboard routine was neater.)
--
Jim Nagel www.archivemag.co.uk
Post by Jim Nagel
"From" address is genuine but will change. Website has current one.
Alan Wrigley
2019-01-03 17:09:26 UTC
Permalink
Post by Jim Nagel
Found the routine I was using on the RiscPC (4.39). It used
SYS "ClipboardHolder_Copy" ,0,&FFF,A$,L%
but RiscOS 5 does not (yet) provide that SYS call.
Could it be added? Would surely be widely useful.
The Clipboard Holder module is specific to the RO4/6 branch of the OS. For
RO5 you have to use the standard clipboard protocol as devised by Acorn
which involves claiming the clipboard and then responding to requests for
the current clip. This document describes how it works:

http://chrisacorns.computinghistory.org.uk/docs/Acorn/AN/240.pdf

Alan
--
RISC OS - you know it makes cents
Andrew Conroy
2019-01-03 21:53:04 UTC
Permalink
Post by Alan Wrigley
Post by Jim Nagel
Found the routine I was using on the RiscPC (4.39). It used
SYS "ClipboardHolder_Copy" ,0,&FFF,A$,L%
but RiscOS 5 does not (yet) provide that SYS call.
Could it be added? Would surely be widely useful.
The Clipboard Holder module is specific to the RO4/6 branch of the OS.
For RO5 you have to use the standard clipboard protocol as devised by
Acorn which involves claiming the clipboard and then responding to
http://chrisacorns.computinghistory.org.uk/docs/Acorn/AN/240.pdf
The downside to this method is that the clipboard contents are only
preserved whilst the app that put them there is active. If you quit the
app, it takes the clipboard with it. This means Jim can't have a 'script'
to put something onto the clipboard, he needs a full Wimp application
that stays running and responds to User Messages.

A truly global clipboard would preserve the contents even after the app
quits.

Andrew
--
+----------------------------------------+---------------------------------+
| Andrew Conroy, Owl-Art Un-Ltd. | email: ***@argonet.co.uk |
| Coming to you on an Acorn RiscPC SA110 | |
+----------------------------------------+---------------------------------+
The impossible I can do at once, miracles take a little longer!!
Alan Wrigley
2019-01-03 22:45:12 UTC
Permalink
Post by Andrew Conroy
A truly global clipboard would preserve the contents even after the app
quits.
Indeed. It wouldn't be too hard to write a RO5 replacement for the Clipboard
Holder. In fact, if Jim wants this feature purely for his own use he could
always use UniServer, which effectively does that for its UniClip function.

Alan
--
RISC OS - you know it makes cents
Steve Fryatt
2019-01-03 23:13:26 UTC
Permalink
On 3 Jan, Alan Wrigley wrote in message
Post by Alan Wrigley
Indeed. It wouldn't be too hard to write a RO5 replacement for the
Clipboard Holder. In fact, if Jim wants this feature purely for his own
use he could always use UniServer, which effectively does that for its
UniClip function.
A Clipboard module already exists for RISC OS 5, written by Fred Graute many
years ago: Jim simply needs the Clipboard_PutClip SWI, as far as I can see.

I'm not quite clear where the module is in current distributions, however,
so Jim probably wants to ask this question on the ROOL forum.
--
Steve Fryatt - Leeds, England

http://www.stevefryatt.org.uk/
Fred Graute
2019-01-04 01:31:24 UTC
Permalink
Post by Jim Nagel
Post by Jim Nagel
From within a program, is there a way of loading a specified string onto
the clipboard? It used to be possible in Ro4.39 but the routine I had
there does not work in Ro5.
Found the routine I was using on the RiscPC (4.39). It used
SYS "ClipboardHolder_Copy" ,0,&FFF,A$,L%
but RiscOS 5 does not (yet) provide that SYS call.
Could it be added? Would surely be widely useful.
For RO5 you can use the Clipboard module. It's currently not available
from the ROOL website but there is a copy in !MiniTime.

The code to use it should be something like this:

String$ = "Test global clipboard"
Length% = LEN(String$)
Leafname$ = "TestClip"

SYS "XClipboard_Put",0,&FFF,String$,Length%,Leafname$,0 TO ;Flags%
IF ((Flags% AND 1) = 1) THEN
SYS "XClipboardHolder_Copy",0,&FFF,String$,Length%
ENDIF

You'll also need to make sure that the Clipboard module is loaded when
ClipboardHolder is absent. Either in the BASIC program or an Obey file.

HTH
--
Fred Graute
http://www.stronged.iconbar.com/
Loading...