-
-
Save paulera/b9af6f44aa553b6063d928547c26eab9 to your computer and use it in GitHub Desktop.
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 |
Doesn't work. By the way, I am very new to vbscript so there could be reasons.
Doesn't work. By the way, I am very new to vbscript so there could be reasons.
Try changing the path on Line 9
to one where you have writing permissions.
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.
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?
No
Save this somewhere in your disk, create a shortcut to it in the desktop and assign a shortcut. Run it after doing [Ctrl+C].