Advertisement
tabnation

AutoIT intro 1

Apr 15th, 2021
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None
  1. HotKeySet("+d", "HotKeyPressed1")
  2. HotKeySet("s", "HotKeyPressed2")
  3. While 1
  4. Sleep(10)
  5. WEnd
  6.  
  7. Func HotKeyPressed1()
  8. Run("control.exe main.cpl") ; Opens the Mouse Properties Control Panel applet
  9. Sleep(3000)
  10. WinWaitActive("Mouse Properties") ; Waits for the window to open
  11. Sleep(3000) ; (Optional) Pauses 3 seconds so you can watch the script work
  12. Send("!s{ENTER}") ; Types ALT+s then presses the Enter key
  13. EndFunc
  14.  
  15. Func HotKeyPressed2()
  16. Send("{SHIFTDOWN}")
  17. MouseClick("LEFT")
  18. Send("{SHIFTUP}")
  19. EndFunc
  20.  
  21. CODE2:
  22. ; This script types Hello World in a Word document.
  23. ; Before running this script, open Word and save the file as hello.docx (or hello.doc).
  24. ; The names must be in lower case to match the script.
  25.  
  26. HotKeySet("+f", "HotKeyPressed1")
  27. HotKeySet("+g", "HotKeyPressed2")
  28. While 1
  29. Sleep(10)
  30. WEnd
  31.  
  32. Func HotKeyPressed1()
  33. Opt("WinTitleMatchMode", 2) ; Configures AutoIt to find a search term in any part of the window title
  34. WinActivate("testing") ; Activates the Word window with hello.docx (or hello.doc) in any part of the title bar
  35. WinWaitActive("testing") ; Waits for the window to be the active window
  36. Send("Hello World") ; Types Hello World
  37. EndFunc ;to stop script from closing
  38.  
  39. Func HotKeyPressed2()
  40. Opt("WinTitleMatchMode", 2)
  41. ;Run ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe https://google.com​")`
  42. ShellExecute("chrome.exe", "https://google.com​ --new-window --start-fullscreen")
  43. sleep (5000)
  44. Send("tab nation autohotkey{ENTER}")
  45. sleep (5000)
  46. WinClose("tab nation")
  47. MsgBox(0, "title here", "Chrome window has been closed",)
  48. EndFunc ;to stop script from closing
Advertisement
RAW Paste Data Copied
Advertisement