RedwookHighway Posted May 16, 2016 Posted May 16, 2016 Good day I am attempting to write a script that will copy the continence of the clipboard to an array every time a copy action is done. I was looking for the best way to signal to my script to run ClipGet() Is there a way for autoit to run a script on copy?
Jfish Posted May 16, 2016 Posted May 16, 2016 What are you trying to do specifically? There may be a better way. From what are you copying and how are you invoking copy? Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt
RedwookHighway Posted May 16, 2016 Author Posted May 16, 2016 I am attempting to write a script that would allow me to copy one line of text after another and then on pressing a hotkey past them into fields in the order I copied them, on at a time. Ideally it would work with both a right click + copy and the Ctrl + C. I was thinking about using a hotkey but it looks like Ctrl will not work with the hotkey.
Jfish Posted May 16, 2016 Posted May 16, 2016 Where is the text being copied? Is it in a file, program, site? Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt
RedwookHighway Posted May 16, 2016 Author Posted May 16, 2016 Well for the most part it would be within a program called ConnectWise. I would be copying data out of there and pasting it into either a web page or Quickbooks.
iamtheky Posted May 16, 2016 Posted May 16, 2016 maybe something that loops constantly. This demo will show you your array after you have copied 3 different strings to the clipboard. #include<array.au3> local $aOut[0] Do sleep(100) $sOut = clipget() If @Error Then continueloop _ArrayAdd($aOut , $sOut) ClipPut("") Until ubound($aOut) > 2 _ArrayDisplay($aOut) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
RedwookHighway Posted May 16, 2016 Author Posted May 16, 2016 Thank you very much, I am looking at that now.
RedwookHighway Posted May 16, 2016 Author Posted May 16, 2016 The example script will not run. Giver me an error Line 3 Array Variable subscript is badly formatted. Looks like it does not like the 0 in the array. I changed the number of elements to 1 and it now works. Thanks this method will form the base of my script.
jguinch Posted May 17, 2016 Posted May 17, 2016 _ClipBoard_SetViewer seems to be what you need. Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
RedwookHighway Posted May 17, 2016 Author Posted May 17, 2016 Thanks jguinch I'm not sure what the clipboard viewer is I will have to do a little reading. P.S. Nice cup.
jguinch Posted May 18, 2016 Posted May 18, 2016 (edited) _ClipBoard_SetViewer is not a graphical viewer, but a "listener" which intercepts clipboard messages. The example uses a GUI to show how to use the function, but you can use an invisible GUI instead Edited May 18, 2016 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
RedwookHighway Posted September 23, 2016 Author Posted September 23, 2016 For anyone interested, here is what I ultimately got. It will let me copy multiple lines of text. Once I am done copying I hit the ~ key and then start pasting. The script will run through all the items copied started with the first one and then switch back with a fresh clipboard once it's done. expandcollapse popup#include <Array.au3> #include<HotKey.au3> Func HotSwitch() If $modeswitch = 0 Then $modeswitch = 1 Else $modeswitch = 0 EndIf EndFunc HotKeySet("`", "HotSwitch") ;HotKeySet("^v", "HotPaste") Func HotPasteNorm() Send("{SHIFTDOWN}") Send("{INS}") Send("{SHIFTUP}") EndFunc Func HotPaste() ClipPut($ClipboardStore[$n]) Send("{SHIFTDOWN}") Send("{INS}") Send("{SHIFTUP}") sleep(20) $n += 1;increment varable n sleep(60) EndFunc While 1 CopyMode() PastMode() Wend Func CopyMode() HotKeySet("^v", "HotPasteNorm") Global $ClipboardStore[1] Global $modeswitch = 0 ClipPut("") While $modeswitch = 0 sleep(100) $sOut = clipget() If @Error Then continueloop _ArrayAdd( $ClipboardStore, $sOut) ClipPut("") WEnd Beep(1000, 500) EndFunc Func PastMode() HotKeySet("^v", "HotPaste") Global $n = 1 ;this vallue is used to increment the clipboard counter. Local $m = UBound($ClipboardStore) Do Sleep(100) Until $n = $m or $modeswitch = 0 Redim $ClipboardStore[1] $ClipboardStore[0] = "" $n = 1 beep(800, 500) EndFunc
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now