Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. !^+v::
  3. Sleep 50
  4. SendSafe("+{F4}")  ; Instead of this line and the next few lines, you should use the hotkey that opens the web console or browser console. And test whether it opens with the input thingy in focus.
  5. WinWait, Scratchpad, , 2
  6. If ErrorLevel
  7. {
  8.     Msgbox No Scratchpad found.
  9.     Return
  10. }
  11.  
  12.  
  13. ClipboardSwapping = 1
  14. Old := clipboardall
  15. Clipboard =
  16. (  ;js  
  17.   // your Javascript goes here
  18. )
  19.  
  20. SendSafe("^v")
  21. SendSafe("^r")
  22. Sleep 200
  23. SendSafe("^z")
  24. SendSafe("!{F4}")
  25.  
  26. Clipboard := Old
  27. Sleep 100
  28. ClipboardSwapping = 0
  29. Return
  30.  
  31.  
  32. SendSafe(Key){
  33.     static SendSafeActive := 0
  34.     ; FileAppend, % "================= " SendSafe "`n", *
  35.     ; If (SendSafe_ActiveKey)
  36.         ; FileAppend, % A_LineNumber S:  endSafe_ActiveKey " is still active.`n", *
  37.     While GetKeyState("Control")
  38.        or GetKeyState("Alt")
  39.        or GetKeyState("Shift")
  40.        or GetKeyState("LWin")
  41.        or GetKeyState("RWin")
  42.        or (SendSafeActive = 1)
  43.     {
  44.         Sleep 20
  45.         If ( A_Index > 50) {  ; Wait for 1 second, then give up
  46.             Soundbeep 300, 100
  47.             Soundbeep 150, 500
  48.             Return
  49.         }
  50.     }
  51.     SendSafeActive := 1
  52.     Send % Key
  53.     SendSafeActive := 0
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement