Obtaining text from an existing text file

I can't seem to find a way to do the following:

Open an existing text file from a thumb drive and copy all of the text in it into the clipboard. The file, when opened, shouldn't be displayed. :question:

Here's how I'm planning on using this:
I'm using the program "EncryptOnClick" from a button I've created, and passing it command line parameters.
I'd like to pass it the encrypting/decrypting password, but that would defeat the purpose of encryption if the password could be discovered by looking at the button code.
The text in the file located on the thumb drive will be used as my "Key" (password), so I can pass this text to "EncryptOnClick" as a parameter.

Please help a noob in need... :confused:

Thanks, in advance, Rob.

You can use my small SetClip program to do this.

This is the Opus button. (It assumes that SetClip.exe is in C:\Windows\System32; edit as appropriate after pasting it on to your toolbar.)

<?xml version="1.0"?> <button display="both"> <label>Contents to Clipboard</label> <tip>Copies the contents of the selected text files to the clipboard</tip> <icon1>#clipcopy</icon1> <function type="batch"> <instruction>@runmode hide</instruction> <instruction>&quot;C:\Windows\System32\SetClip.exe&quot; -e</instruction> <instruction>&quot;C:\Windows\System32\SetClip.exe&quot; -f -a {filepath$}</instruction> </function> </button>

[quote="leo"]You can use my small SetClip program to do this.

This is the Opus button. (It assumes that SetClip.exe is in C:\Windows\System32; edit as appropriate after pasting it on to your toolbar.)

<xml> <button> <label>Contents to Clipboard</label> <tip>Copies the contents of the selected text files to the clipboard</tip> <icon1>#clipcopy</icon1> <function> <instruction>@runmode hide</instruction> <instruction>&quot;C:\Windows\System32\SetClip.exe&quot; -e</instruction> <instruction>&quot;C:\Windows\System32\SetClip.exe&quot; -f -a {filepath$}</instruction> </function> </button>[/quote]

Thanks for the rapid reply Leo!

I'm almost there, but am having trouble getting the text to create the button on the Toolbar. I attempted to follow the instructions on the page in the embedded link "How to add buttons from this forum to your toolbars".

I've selected the entire text in green, selected "Copy", and then tried to paste it to the Toolbar while DO is in customize mode, but my "Paste" menu item is greyed-out.

Creating a text file and pasting the contents of the clipboard into it produces the expected result, as can be seen in the attachment "Second Try.jpg". The attachment "First Try.jpg" was attempting to the same, but while right-clicking a slightly diferent area of the Toolbar.

Am I boning out, or what?

Thanks again, in advance, Rob.




I created a button the old fashioned way, and SetClip works like a champ.

My next question:
How can I use a variable to input the text from the clipboard into my button sequence?

Here's what I'm trying to do (the command string that the button executes):
"C:\Program Files\EncryptOnClick\EncryptOnClick.exe" -p "C:\FolderToEncrypt"

The section"" is where I need to insert the clipboard contents (if possible), as the -p command line switch is supposed to preceed the password argument (which would normally be enclosed in double quotes).

Thanks, yet again, Rob.

The problem with pasting the button code was my fault. I forgot that the Quick Reply form mangles XML. :slight_smile: I've edited my post to correct the XML, though you probably don't need it anymore.

You can insert the clipboard text into a command using {clip} like this:

"C:\Program Files\EncryptOnClick\EncryptOnClick.exe" -p "{clip}" "C:\FolderToEncrypt"

[quote="leo"]The problem with pasting the button code was my fault. I forgot that the Quick Reply form mangles XML. :slight_smile: I've edited my post to correct the XML, though you probably don't need it anymore.

You can insert the clipboard text into a command using {clip} like this:

"C:\Program Files\EncryptOnClick\EncryptOnClick.exe" -p "{clip}" "C:\FolderToEncrypt"

Leo, how'd you get so smart?

Works exactly the way I want it to! One Click Encryption/Decryption using the text from my KeyFile on my thumb drive! WooHoo!

EncryptOnClick is freeware, and with DO, I can do what no commercial program was able to do.

Maybe I should start a tread with an appropriate title to encapsulate all the requirements for performing this task.

I can encrypt all the files in the folder that contains my sensitive files, such as passwords, financial data, electronic checkbook register (I use "JustChecking", an excellent program!), etc.

Thanks! Rob.