Storing info in a client's clipboard like Activestate - clipboard

Activestate Code Recipe has the function of storing information in a clipboard in a client that access the web. How can I do that?

You can store information on the client's clipboard using Javascript.
http://brooknovak.wordpress.com/2009/07/28/accessing-the-system-clipboard-with-javascript/

Related

Missing clipboard formats WinApi

My problem is about WinApi clipboard formats. The scenario is:
Service application enumerates processes and looks for my application. If it's not found it will spawn process with winlogon.exe duplicated token from user session to act as system.
Each time clipboard has been updated application is enumerating formats. It works for CF_TEXT, CF_UNICODE, etc... But I need CF_HDROP - it's missing. It always have 49161 IDataObject with no formats inside.
If I try to run application manually from user context it detects CF_HDROP.
Where did I go wrong?
The user token integrity level is an answer.
This is why some clipboard formats were missing.

can you load external executable javascript from a firefox extension?

Does anyone know if there is a way to load any external executable javascript from a firefox add-on extension? I looked into scriptloader.loadSubScript, but it appears that it can only load from a local resource.
Any help would be appreciated.
You can always xhr for a file, save the contents to disk, then use scriptloader.loadSubScript with an add-on
this would violate the AMO policies though, so you wouldn't be able to upload the add-on to http://addons.mozilla.org
As #erikvold already pointed out, doing so would be a security hazard AND it also violates AMO rules (because it is a security hazard).
Consider your server gets compromised, or there is a way to MITM the connection retrieving the remote script (TLS bugs anyone :p), or you sell your domain and the new owner decides to ship a script to collect credit card information straight from a user's hard disk...
However, it is possible to run a remote script in an unprivileged environment, much like it would run in a website.
Create a Sandbox. The Sandbox should be unprivileged, e.g. pass an URL in your domain into the constructor.
Retrieve your script, e.g. with XHR.
Evaluate your script in the Sandbox and pull out any data it might have generated for you.
This is essentially what tools like Greasemonkey (executing user scripts) do.
Creating and working with Sandboxes in a secure fashion is hard, and the Sandbox being unprivileged prohibits a lot of use cases, but maybe it will work for your stuff.
Try using Components.utils.import .
Example :
const {Cc,Ci,Cu} = require("chrome");
Cu.import("url/path of the file");
Note :
js file which uses DOM objects like window, navigator, etc. will return error saying "window/navigator is undefined". This is simply because the main.js code does not have access to DOM.
Refer this thread for more information.

Windows SendTo from script

I'm writing an application where I have to send an email with an attachment using the default mail application.
Before the email is sent, I want the user to be able to edit the text, i.e. the application should just open the mail client with pre-filled recipient and attachment and give the user the opportunity to send it.
At very minimum I need the same effect I'd got if I selected "SendTo/Mail Recipient" from the context menu of the file.
Solutions based on the "mailto:" trick won't work as there are mail clients that do not support the "attachment=" part.
The most complete solution I've found is this one:
http://www.codeproject.com/Articles/3839/SendTo-mail-recipient
but it seems a lot of code for something so simple! (and also crashes when compiled with VS2008)
Is there any other option? It would be ok even if it was an external tool or script (e.g. a .vbs script to be launched with cscript).
I would advise you to use MAPI (Messaging Application Program Interface).
If dotNet can be part of the solution, here's a ready-to-use class in C# : Class for creating MAPI Mail Messages. It would give you something like this:
MapiMailMessage message = new MapiMailMessage("Test Message", "Test Body");
message.Recipients.Add("Test#Test.com");
message.Files.Add(#"C:\del.txt");
message.ShowDialog();
Otherwise, you can always do it in C++ if you feel confortable with it, like this answer suggest.
Then, you will be able to ShellExecute the binary executable and pass it some parameters.
Hope this helps :-)

Searching for "Windows Printer Interceptor"

I'm searching for a way to send printed documents directly to our Document Management System (DMS). My idea is some kind of "printer interceptor" that catches all the data thats gonna to be send to the printer from application, sends it to my DMS and forwards the printer data to the estimated printer.
That interceptor should worl for any printer. So it could be something thats added directly to spool manager.
Another idea is that interceptor could be a selectable printer from the printer-selectbox of windows-applications. That interceptor-printer itself is configured to redirect the data to another printer-driver.
Does there already exist anything, that I can use, or do I have to write a printer driver from scratch? Is my idea possible at all?
Regards,
Michael
In addition: Where possible I want to store plain text not an image. So I need my interceptor to work before all data is transformed to printer-control-signals
http://www.all2pdf.com/virtual-printer-driver-uni.htm
#mibutec this popular solution could directly call your DMS: http://www.printandshare.info

Creating a new email message using the default email program

How can I programatically open a new message window in the default email client (such as Outlook) using Windows API calls? I will need to include an attachment and would prefer to specify the default message body in 'rich text' (ie. not plain) format.
The ShellExecute solution is good for simple messages without attachments, but if you want more control over the process, you may try the MAPI; in particular, see the MAPISendMail function and the MapiMessage structure.
For even more complex needs, there's the extended MAPI, but I didn't find any documentation about it on the MSDN. However this seems to be a good wrapper around the extended MAPI.
I think you can do this using the ShellExecute. An attachment should be used as parameter: something like this but I don't remember for sure: "mailto:email#something?subject=subject&body=body&attachment=..."

Resources