Headlines
vulkanos4.lha - development/library/graphics
Mar 21, 2026
vim_mui.lha - utility/text/edit
Mar 21, 2026
imp3handler.lha - network/misc
Mar 20, 2026
amigadiskbench.lha - utility/benchmark
Mar 20, 2026
acm.lha - audio/convert
Mar 19, 2026
avalanche.lha - utility/archive
Mar 18, 2026
vintagesongplayer.lha - audio/play
Mar 16, 2026
hwp_avcodec.lha - library/hollywood
Mar 16, 2026
depscan.lha - utility/shell
Mar 16, 2026
amiarcadia.lha - emulation/gamesystem
Mar 12, 2026
Topic options
View mode
Newest First
How put text file contents into the clipboard?
Posted on:
2012/12/28 11:38
#1
Home away from home
Joined: 2007/5/19 13:23Last Login
: 1/4 10:17
From England
Group:
Registered Users
Can anyone tell me how to put the contents of a file (including new lines) into the clipboard of OS4? We have the "clip" command, but that only seems to allow putting a single line of text into the clipboard. There is a "clip" command (from 2001) on Aminet, which does what I want, but it mysteriously crashes when I try to call it from my own program (but not from the Shell) so I think it must be buggy. We have a "CLIPS:" assignment, but copying stuff to it doesn't seem to do anything?
Author of the
PortablE programming language.
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 12:18
#2
Home away from home
Joined: 2006/12/4 23:15Last Login
: Today 8:17
Group:
Registered Users
From the AWeb source using IIFParse.library void Clipcopy(UBYTE *text,long length) { struct IFFHandle *iff; UBYTE *p; for(p=text;p<text+length;p++) { if(*p==0xa0) *p=' '; } if(iff=AllocIFF()) { if(iff->iff_Stream=(ULONG)OpenClipboard(PRIMARY_CLIP)) { InitIFFasClip(iff); if(!OpenIFF(iff,IFFF_WRITE)) { if(PushChunk(iff,ID_FTXT,ID_FORM,IFFSIZE_UNKNOWN)) goto err; if(PushChunk(iff,ID_FTXT,ID_CHRS,length)) goto err; if(WriteChunkBytes(iff,text,length)!=length) goto err; if(PopChunk(iff)) goto err; if(PopChunk(iff)) goto err; err: CloseIFF(iff); } CloseClipboard((struct ClipboardHandle *)iff->iff_Stream); } FreeIFF(iff); } }
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 12:20
#3
Home away from home
Joined: 2006/12/4 23:15Last Login
: Today 8:17
Group:
Registered Users
BTW The assingment CLIPS: is literaly an assignment so copying to it will copy a file to ram:clipboard
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 12:44
#4
Just can't stay away
Joined: 2006/11/30 11:30Last Login
: Today 6:49
From Finland
Group:
Registered Users
@ChrisH
Easiest way would be to use WriteClipVector() from textclip.library:
Quote:
ITextClip->WriteClipVector(string, strlen(string));
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 12:54
#5
Home away from home
Joined: 2007/5/19 13:23Last Login
: 1/4 10:17
From England
Group:
Registered Users
@salass00, broadblues So there is really no easy solution that non-programmers can use? It seems that I can read from TEXTCLIP: but not write to it (using C:Copy).
Author of the
PortablE programming language.
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 13:09
#6
Just can't stay away
Joined: 2006/11/30 11:30Last Login
: Today 6:49
From Finland
Group:
Registered Users
I thought that was what you were asking for, an easy solution for a programmer, since you said that:
Quote:
There is a "clip" command (from 2001) on Aminet, which does what I want, but it mysteriously crashes when I try to call it from my own program (but not from the Shell) so I think it must be buggy.
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 13:16
#7
Home away from home
Joined: 2007/5/19 13:23Last Login
: 1/4 10:17
From England
Group:
Registered Users
@salass00
Well, an easy solution for non-programers would also be a (very!) easy solution for programmers
I'm just surprised what I want to do isn't actually possible, without using a compiled programming language.
Author of the
PortablE programming language.
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 14:13
#8
Just popping in
Joined: 2009/9/19 20:02Last Login
: 2/24 15:09
Group:
Registered Users
put the output stream to textclip like: type ram:test.txt > textclip:
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 14:16
#9
Amigans Defender
Joined: 2009/5/1 17:57Last Login
: Today 14:10
From Czech Republic
Group:
Registered Users Staff members Moderators
@salass00
Quote:
Easiest way would be to use WriteClipVector() from textclip.library Out of curiosity: as I haven't found textclip.library anywhere in the system, where is it located actually? Is it part of some other OS component?
The
Rear Window blog
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 14:33
#10
Home away from home
Joined: 2007/5/19 13:23Last Login
: 1/4 10:17
From England
Group:
Registered Users
@Goos That worked, thanks!
Author of the
PortablE programming language.
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 15:36
#11
Just can't stay away
Joined: 2006/12/9 10:44Last Login
: 3/20 15:23
From Lyon, France
Group:
Registered Users
@ChrisH
Quote:
I'm just surprised what I want to do isn't actually possible, without using a compiled programming language. Well in OS3.9, there was not even a Clip command
One step at a time
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 17:04
#12
Just can't stay away
Joined: 2006/11/30 11:30Last Login
: Today 6:49
From Finland
Group:
Registered Users
@trixie
Quote:
Out of curiosity: as I haven't found textclip.library anywhere in the system, where is it located actually? Is it part of some other OS component?Looks like it might be generated in memory by textclip-handler:
http://dl.dropbox.com/u/26599983/textclip_library.jpg
Re: How put text file contents into the clipboard?
Posted on:
2012/12/28 21:51
#13
Just can't stay away
Joined: 2006/12/1 18:01Last Login
: Yesterday 23:59
From Copenhagen, Denmark
Group:
Registered Users
Quote:
Goos wrote: put the output stream to textclip like: type ram:test.txt > textclip: Hey, brilliant! Another little known Amiga gem revealed. Thanks!
Best regards,
Niels
Currently Active Users Viewing This Thread:
1
(
0 members
and 1 Anonymous Users
)