|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-09-21 17:29 UTC] xxx-nospam-php at BrazilianTranslation dot net
Hi. I've always wanted to be able to read from and write to Windows' clipboard. It is possible in Perl, but I prefer to use PHP. I do not intend to manipulate a Web site visitor's clipboard through CGI, I know it is impossible. It is for shell scripting only. PHP has such an incredible number of functions, it surprises me that no such functions have been made yet. Many thanks, Luciano Espirito Santo PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 04:00:01 2025 UTC |
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.