-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLinewisePaste.au3
108 lines (86 loc) · 2.49 KB
/
LinewisePaste.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
; This script pastes either by stripping out tabs or by typing out the clipboard contents (replacing line feeds with down arrows)
; This can be useful when constructing lists of file names and entering them into an ArcMap Batch window
; Written by A. Anderson using AutoIt
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
#include <Misc.au3>
Local $hDLL = DllOpen("user32.dll")
Global $g_bPaused = False
Global $makeanException = False
$dll = DllOpen("user32.dll")
AutoItSetOption( "WinTitleMatchMode", 2)
HotKeySet("!d", "Dpaste") ; Alt-d
HotKeySet("!z", "Lpaste") ; Alt-z
HotKeySet("!v", "Tpaste") ; Alt-v
HotKeySet("{PAUSE}", "stopThePresses")
MsgBox($MB_SYSTEMMODAL, "LinewisePaste rev. 2018-02-06", "Use ALT-V to paste stripping out TABs." & @CRLF & @CRLF & "Use ALT-Z to type out the clipboard as individual letters," & @CRLF & "replacing line feeds with DOWN keys." & @CRLF & @CRLF & "Pressing PAUSE will halt a typing Paste." & @CRLF & @CRLF & "To close the program, right-click the icon in the system tray.")
$goOn = True
While 1
Sleep(10000)
WEnd
;Func TerminateLP() ; This terminates the script upon pressing the hotkey defined above
; Exit
;EndFunc ;==>Terminate
Func stopThePresses()
$goOn = False
EndFunc ;==>stopThePresses
Func Dpaste()
Local $hDLL = DllOpen("user32.dll")
$s = ClipGet()
Sleep(700)
$sSplit = StringSplit($s, @CRLF, $STR_ENTIRESPLIT)
For $i = 1 To UBound($sSplit)-1
;Sleep(200)
$line = StringSplit($sSplit[$i], "")
For $j = 1 To UBound($line)-1
Send($line[$j])
if $goOn == False Then
ExitLoop(2)
EndIf
Next
Send("{DOWN}")
While 1
If _IsPressed("2D", $hDLL) Then
; Wait until key is released.
While _IsPressed("2D", $hDLL)
Sleep(50)
WEnd
ExitLoop
EndIf
Sleep(50)
WEnd
Next
$goOn = True
DllClose($hDLL)
EndFunc ;==>Dpaste
Func Lpaste()
$s = ClipGet()
Sleep(700)
$sSplit = StringSplit($s, @CRLF, $STR_ENTIRESPLIT)
For $i = 1 To UBound($sSplit)-1
Sleep(200)
$line = StringSplit($sSplit[$i], "")
For $j = 1 To UBound($line)-1
Send($line[$j])
if $goOn == False Then
ExitLoop(2)
EndIf
Next
Send("{DOWN}")
Sleep(200)
Next
$goOn = True
EndFunc ;==>Lpaste
Func Tpaste()
$s = ClipGet()
$sSplit = StringSplit($s, @TAB)
$t = ""
For $i = 1 To UBound($sSplit)-1
$t = $t & $sSplit[$i]
Next
ClipPut($t)
Sleep(500)
Send("^v")
Sleep(500)
ClipPut($s)
EndFunc ;==>Tpaste