For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > December 2004 > PHP and clipboard









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PHP and clipboard
Phantom_guitarist

2004-12-23, 3:58 pm

Does anybody know a way of placing text into the clipboard using PHP?

I have wrote a script in PHP which a program runs on it's selection.
Unforuantly, what ever you send back to the program from the PHP script it
replaces what you originally selected with the output.

So what I am looking at doing is being able to send it directly to windows
clipboard from PHP.


Regards

Stefan


Glenn O Larsen

2004-12-23, 3:58 pm

> Does anybody know a way of placing text into the clipboard using PHP?

I dont think this is possible in PHP without any exstra extensions. You may
try to create a .NET application or Java application that does the
"copy-to-clipboard" job, and then intigrate that program in to PHP with
dotnet_load or "new Java()". (I would never do this.. :P)

Normaly they say : "Use the correct language for the correct purpose" So i
guess that PHP is not correct in this case... Im sorry.

Good Luck!

Regards,
Glenn O Larsen


Alvaro G Vicario

2004-12-23, 3:58 pm

*** Phantom_guitarist wrote/escribió (Thu, 23 Dec 2004 15:02:17 -0000):
> Does anybody know a way of placing text into the clipboard using PHP?


What clipboard do you mean? Clipboard is a feature of GUIs so the concept
doesn't make much sense when we're talking about a web server that
typically runs as service or daemon. If you're writing a shell script then
you should find a program that does the job and call it via exec(). The
exact command depends on your window manager.


--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
Phantom_guitarist

2004-12-23, 3:58 pm

Thanks.
Managed to find a program to copy to the clipboard but I am now having
problems passing arguments to the program using exec().

I persume I just add them to the end of the command (seperate with a space).

eg.

exec("command.exe 'hello'");

or

exec("command.exe '".$text."'");

regards

Stefan


"Alvaro G Vicario" <alvaro_QUITAR_REMOVE@telecomputeronline.com> wrote in
message news:eh32f7tumgwf$.5yjq5g2v3msl$.dlg@40tude.net...
> *** Phantom_guitarist wrote/escribió (Thu, 23 Dec 2004 15:02:17 -0000):
>
> What clipboard do you mean? Clipboard is a feature of GUIs so the concept
> doesn't make much sense when we're talking about a web server that
> typically runs as service or daemon. If you're writing a shell script then
> you should find a program that does the job and call it via exec(). The
> exact command depends on your window manager.
>
>
> --
> -- Álvaro G. Vicario - Burgos, Spain
> -- Thank you for not e-mailing me your questions
> --



Alvaro G Vicario

2004-12-28, 8:59 am

*** Phantom_guitarist wrote/escribió (Thu, 23 Dec 2004 16:13:00 -0000):
> I persume I just add them to the end of the command (seperate with a space).


That's it.

> exec("command.exe 'hello'");


If you don't type the command's full path, make sure the system knows how
to find it (i.e., its folder is in the PATH variable).



--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
Glenn O Larsen

2004-12-28, 3:56 pm

> Does anybody know a way of placing text into the clipboard using PHP?

I dont think this is possible in PHP without any exstra extensions. You may
try to create a .NET application or Java application that does the
"copy-to-clipboard" job, and then intigrate that program in to PHP with
dotnet_load or "new Java()". (I would never do this.. :P)

Normaly they say : "Use the correct language for the correct purpose" So i
guess that PHP is not correct in this case... Im sorry.

Good Luck!

Regards,
Glenn O Larsen


Phantom_guitarist

2004-12-28, 3:56 pm

Thanks.
Managed to find a program to copy to the clipboard but I am now having
problems passing arguments to the program using exec().

I persume I just add them to the end of the command (seperate with a space).

eg.

exec("command.exe 'hello'");

or

exec("command.exe '".$text."'");

regards

Stefan


"Alvaro G Vicario" <alvaro_QUITAR_REMOVE@telecomputeronline.com> wrote in
message news:eh32f7tumgwf$.5yjq5g2v3msl$.dlg@40tude.net...
> *** Phantom_guitarist wrote/escribió (Thu, 23 Dec 2004 15:02:17 -0000):
>
> What clipboard do you mean? Clipboard is a feature of GUIs so the concept
> doesn't make much sense when we're talking about a web server that
> typically runs as service or daemon. If you're writing a shell script then
> you should find a program that does the job and call it via exec(). The
> exact command depends on your window manager.
>
>
> --
> -- Álvaro G. Vicario - Burgos, Spain
> -- Thank you for not e-mailing me your questions
> --



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com