Created
August 17, 2017 07:38
-
-
Save paulera/b9af6f44aa553b6063d928547c26eab9 to your computer and use it in GitHub Desktop.
VBScript to save clipboard contents to a text file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
' Gets clipboard's contents as pure text and saves it | |
' to the file set in filePath variable. | |
' author https://github.com/paulera | |
' see https://gist.github.com/paulera/b9af6f44aa553b6063d928547c26eab9 | |
' File path to save clipboard contents | |
Dim filePath : filePath = "C:\clipboard.txt" | |
' Use the HTML parser to have access to the clipboard and get text content | |
Dim text : text = CreateObject("htmlfile").ParentWindow.ClipboardData.GetData("text") | |
' Create the file | |
Dim fileObj : Set fileObj = CreateObject("Scripting.FileSystemObject").CreateTextFile(filePath) | |
' Overwrite the text and close the file. | |
fileObj.Write(text) | |
fileObj.Close |
By the way, do you have a script for pasting as well. All I need it to do is to open notepad and paste whatever is on the clipboard.
Not really. Anyways, Line 12
shows how to read whatever is in the Clipboard and store in a text
variable. You try making a script to open notepad, wait 100 milliseconds (just for notepad to load properly), then simulate a Ctrl+V
:
I found some links with a quick search in case it helps:
- Open a program: https://stackoverflow.com/questions/1340355/launch-programs-whose-path-contains-spaces
- Wait for a little delay: https://stackoverflow.com/questions/1729075/how-to-set-delay-in-vbscript
- Simulate keypress: https://stackoverflow.com/questions/43168311/how-can-we-simulate-keyboard-keys-using-vbs
Good luck
this might me very off topic but do you have a script that
shutdowns computer if password is incorrect or if 10 seconds are over?
…On Thu, Oct 22, 2020 at 9:06 AM Paulo Amaral ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
By the way, do you have a script for pasting as well. All I need it to do
is to open notepad and paste whatever is on the clipboard.
Not really. Anyways, Line 12 shows how to read whatever is in the
Clipboard and store in a text variable. You try making a script to open
notepad, wait 100 milliseconds (just for notepad to load properly), then
simulate a Ctrl+V:
I found some links with a quick search in case it helps:
- Open a program:
https://stackoverflow.com/questions/1340355/launch-programs-whose-path-contains-spaces
- Wait for a little delay:
https://stackoverflow.com/questions/1729075/how-to-set-delay-in-vbscript
- Simulate keypress:
https://stackoverflow.com/questions/43168311/how-can-we-simulate-keyboard-keys-using-vbs
Good luck
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/b9af6f44aa553b6063d928547c26eab9#gistcomment-3499750>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARB7C2UGDOJ5QHNR222C7M3SMAU4JANCNFSM4SPMNYGQ>
.
this might me very off topic but do you have a script that shutdowns computer if password is incorrect or if 10 seconds are over?
No
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By the way, do you have a script for pasting as well. All I need it to do is open notepad and paste whatever is on clipboard.