Edit report at https://bugs.php.net/bug.php?id=19545&edit=1
ID: 19545
Comment by: mmellon at ecrs dot com
Reported by: xxx-nospam-php at BrazilianTranslation dot net
Summary: Clipboard functions
Status: Not a bug
Type: Feature/Change Request
Package: *General Issues
Operating System: Windows 95
PHP Version: 4.2.3
Block user comment: N
Private report: N
New Comment:
This feature was requested in 4.2.
In 4.2, this was trivial to do:
<?php
function clipboard_copy($text)
{
$ie = new COM('InternetExplorer.Application');
$ie->Navigate('about:blank');
while ($ie->ReadyState != 4)
{
sleep(0.1);
}
$ie->document->ParentWindow->ClipboardData->SetData("text",
$text);
$ie->Quit();
}
clipboard_copy("foo\r\nbar");
?>
The way COM objects are handled is a bit different in PHP5 and later... the
syntax differences are detailed here: http://devzone.zend.com/238/com_dotnet/
(this article is referenced in the official PHP COM class documentation)
It would still be trivial to do.
Seeing how easy this is to do, I don't think a library function is justified.
However, I sympathize with the requestor's position about PHP being used as
something other than a web language. I use it for GUI and command line apps all
the time.
Previous Comments:
------------------------------------------------------------------------
[2011-01-01 01:05:11] [email protected]
Use com: http://php.net/com
------------------------------------------------------------------------
[2002-11-11 06:24:54] [email protected]
Luciano,
Doesn't the fact that in 6 years of PHP nobody talked about integrating windows
clipbard suggest you that it is a minor need and we couldn't care less about it?
There are COM functionalitites (can't these be used somehow?)... you can write
a lovely Perl script that goes into your clipboard and interact with it via
PHP's shell commands... and so on and so on.
There are ways and ways to get your clipboard contents into a PHP script. Don't
ask me more on how because I never even thought about it, but this should be
possible as of now.
Intergating this feature into PHP core today makes few or none sense. Unless
there will be a high request and a clear view why it is needed.
Maxim Maletsky
------------------------------------------------------------------------
[2002-11-11 00:13:06] xxx-nospam-php at BrazilianTranslation dot net
Oh, I would if I could. But I'm afraid I do not have any competence at all for
that. I started programming only one year ago. I know nothing of C, for
example, except that PHP inherited a lot from it so they look alike sometimes.
I wouldn't know where to start.
I have no intention to put up any "battle". I just miss the feature very often,
never saw any mention of it anywhere, not even in this bug/feature request
section, and thought that maybe it was time someone asked for it. But if that's
how the development team feels about it, case closed.
Again, thanks for the reply.
Luciano Espirito Santo
[Note to passers-by and occasional readers: reading my previous message again,
I noticed that I claim to "spend a lot of time writing in Perl". It sounds as
if I actually spend a lot of time writing in Perl and that I am a Perl expert.
What I actually meant was that I take too long to write anything in Perl,
because I do not feel comfortable with it.]
------------------------------------------------------------------------
[2002-11-10 23:59:21] [email protected]
You really have nothing to complain about until you submit a patch with this
functionality. Then you can argue its technical merits. Asking us to
implement a feature that none of us need is a rather impossible battle for you.
------------------------------------------------------------------------
[2002-11-10 23:52:38] xxx-nospam-php at BrazilianTranslation dot net
I'm disappointed to hear that.
PHP is "intented primarely for web" (sic), but that doesn't have to rule out
other uses. Several articles about the use of PHP as a shell scripting language
have been written. I think it is just a natural step for anyone who makes
extensive and intensive use of PHP. What is the point of php-cli.exe, anyway?
I've been messing with several other languages lately, only in search of better
integration with the Windows environment, so I can make better use of shell
and/or automation scripts. I've tried Perl, Ruby, Tcl, Python and even stinky
VB, and a few of these languages support the Windows clipboard. Not only that,
they handle CGI functions but also seek better integration with the Windows
environment. Especially Python. But I don't like Python. I don't want to write
in Python. I could write in Perl and not feel miserable, but I spend a lot of
time writing in Perl. I know PHP, that is the one I know. I feel comfortable
writing in PHP. It is an excellent language, IMO superior to all others in
several aspects, why does it (still) have to be regarded as a "Web-only"
language? Why can't it extend into other territories, like Python is doing and
becoming ever more popular as we speak? GTK is a good point. But GTK slows
everything down a little, and not all shell applications require a GUI.
I think it is just natural for any of these languages to evolve and extend its
functionalities. PHP knows that. That's why PHP-cli was made, that's why its
OOP (classes) implementation has been getting so much attention, that's why
some effort has been made towards developing and improving its XML, COM and
Windows API functions.
Anyway, if there is any other reason for not implementing clipboard functions
in PHP, fine. But let it be a more reasonable one. Because if clipboard
functions are "completely off topic", what to say of COM and Windows API? And
if it's "for Web use only", then why bother with PHP-cli?
Thanks for the reply, at any rate.
Luciano Espirito Santo
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=19545
--
Edit this bug report at https://bugs.php.net/bug.php?id=19545&edit=1