Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #1469 > unrolled thread

clipboard from a script

Started byJim Nagel <jimnewsm10d@abbeypress.co.uk>
First post2012-03-06 12:10 +0000
Last post2012-03-07 11:01 +1300
Articles 3 — 3 participants

Back to article view | Back to comp.sys.acorn.programmer


Contents

  clipboard from a script Jim Nagel <jimnewsm10d@abbeypress.co.uk> - 2012-03-06 12:10 +0000
    Re: clipboard from a script Martin Wuerthner <spamtrap@mw-software.com> - 2012-03-06 13:29 +0100
      Re: clipboard from a script Ron <beeb@woosh.co.nz> - 2012-03-07 11:01 +1300

#1469 — clipboard from a script

FromJim Nagel <jimnewsm10d@abbeypress.co.uk>
Date2012-03-06 12:10 +0000
Subjectclipboard from a script
Message-ID<25f3306c52.jim@nails.abbeypress.net>
Are commands available to put something onto the ("global") clipboard, 
which can be used in a script?

I have some text that is held in two or more string variables in one 
application, and I want to be able to concatenate and then paste into 
another application.  (I know I could do it via a Save box or 
something, but I use Workspace or Moredesk, and the target application 
is in a different virtual desktop, so the clipboard is the ideal 
route.)

In the scrap directory, loose, I notice that a file called ScrapFile 
appears when I copy or cut a selection, and then a file called 
Clipboard is generated when I paste it. (Why?  In fact the file 
Clipboard is regenerated *each time* I paste it.)  This is probably a 
red herring -- manually changing the contents of ScrapFile has no 
effect on subsequent pasting.

Impression stores the contents of its clipboard (for text anyway) in 
the system variable Impulse$selection -- again, changing its contents 
manually has no effect on subsequent pastes.

A further problem might be that my string will include Newlines.  If 
commands for the clipboard do exist, do certain characters such as 
Newline need special attention?

-- 
Jim Nagel                        www.archivemag.co.uk
>> "from" address is genuine but will change.  website has current one.

[toc] | [next] | [standalone]


#1470

FromMartin Wuerthner <spamtrap@mw-software.com>
Date2012-03-06 13:29 +0100
Message-ID<a8aa326c52.martin@bach.planiverse.com>
In reply to#1469
In message <25f3306c52.jim@nails.abbeypress.net>
          Jim Nagel <jimnewsm10d@abbeypress.co.uk> wrote:

> Are commands available to put something onto the ("global") clipboard,
> which can be used in a script?

No. The "global" clipboard is an abstract thing that is negotiated 
between applications. There is no separate global clipboard in the 
system which you can place things, it is always one of the 
applications that just happens to hold the global clipboard at any 
given time. Your script cannot hold the clipboard, so that idea cannot 
work.

That said, the Select strand of RISC OS has a separate global 
clipboard module as an extension of the original scheme, so on any 
Select version you can put any file onto the global clipboard with a 
single SWI call (ClipboardHolder_Copy).

> A further problem might be that my string will include Newlines. If
> commands for the clipboard do exist, do certain characters such as
> Newline need special attention?

The clipboard does not care about the format of your data. It simply 
holds typed files. You can have Newlines in a text file, so you can 
have them on the clipboard, too.

-- 
Martin
---------------------------------------------------------------------
Martin Wuerthner         MW Software      http://www.mw-software.com/
        RISC OS Software for Design, Printing and Publishing
---------------------------------------------------------------------

[toc] | [prev] | [next] | [standalone]


#1472

FromRon <beeb@woosh.co.nz>
Date2012-03-07 11:01 +1300
Message-ID<2305676c52.beeb@ron1954.woosh.co.nz>
In reply to#1470
In message <a8aa326c52.martin@bach.planiverse.com>
          Martin Wuerthner <spamtrap@mw-software.com> wrote:

> In message <25f3306c52.jim@nails.abbeypress.net>
>           Jim Nagel <jimnewsm10d@abbeypress.co.uk> wrote:
> 
> > Are commands available to put something onto the ("global") clipboard,
> > which can be used in a script?
> 
> No. The "global" clipboard is an abstract thing that is negotiated 
> between applications. There is no separate global clipboard in the 
> system which you can place things, it is always one of the 
> applications that just happens to hold the global clipboard at any 
> given time. Your script cannot hold the clipboard, so that idea cannot 
> work.
<snip>
An alternative, requiring !Typer to be loaded, and redirect the output
from the variables to <Wimp$ScrapDir>.Typer.File
Then a click on the Typer iconbar icon will spool your variablesto the
caret.

echo <variable1> { > <Wimp$ScrapDir>.Typer.File }   (overwrites previous)
echo <variable2> { >> <Wimp$ScrapDir>.Typer.File }  (appends to previous)

would output the variables separated by newlines.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.acorn.programmer


csiph-web