Advertisement
Najeebsk

ALL-CODE-TESTER.ahk

Jan 2nd, 2022
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv
  2. #SingleInstance, Force
  3. SetTitleMatchMode, 2
  4. OnExit, GuiClose
  5. GuiShowFlag := 1
  6. Gui, Font, S12 CDefault Bold, Times New Roman
  7. Gui, Add, Edit, x22 y60 w640 h370 vTempCode WantCtrlA, Input code here
  8. Gui, Font, S24 CRed Bold, Times New Roman
  9. Gui, Add, Text, x92 y10 w490 h40 +Center, Najeeb Input Test Code
  10. Gui, Font, S12 CDefault Bold, Times New Roman
  11. Gui, Add, Button, x362 y435 w100 h30 gTestTempCode, Test AHK
  12. Gui, Add, Button, x462 y435 w100 h30 gTestBatch, Test Batch
  13. Gui, Add, Button, x562 y435 w100 h30 gTestAutoIt, Test AutoIt
  14. Gui, Add, Button, x262 y435 w100 h30 gTestVBS, Test VBS
  15. Gui, Add, Button, x123 y435 w100 h30 gEndTest, End TestCode
  16. Gui, Add, Button, x22 y435 w100 h30 gClearTempCode, Clear Code
  17. Gui, Show, x127 y87 h480 w680, RealTime Najeeb Code Tester
  18. Return
  19. $F1::
  20. KeyWait, F1, T.5
  21. If !ErrorLevel
  22. {
  23. Send, {F1}
  24. return
  25. }
  26. If (GuiShowFlag = 1)
  27. {
  28. Gui, Hide
  29. GuiShowFlag--
  30. }
  31. Else If (GuiShowFlag = 0)
  32. {
  33. Gui, Show
  34. GuiShowFlag++
  35. }
  36. KeyWait, F1
  37. return
  38. $F11::
  39. KeyWait, F11, T1
  40. If !ErrorLevel
  41. {
  42. Send, {F11}
  43. return
  44. }
  45. EndTest:
  46. PostMessage("Slave script", 1)
  47. TrayTip, Status:, Test code ended and deleted.
  48. KeyWait, F11
  49. return
  50. ClearTempCode:
  51. GuiControl,, TempCode,
  52. return
  53. GuiClose:
  54. PostMessage("Slave script", 1)
  55. ExitApp
  56. $F12::
  57. KeyWait, F12, T1
  58. If !ErrorLevel
  59. {
  60. Send, {F12}
  61. return
  62. }
  63. GuiControl,, TempCode,
  64. Sleep 200
  65. Clipsave := ClipboardAll
  66. Send, ^c
  67. GuiControl,, TempCode, %Clipboard%
  68. Clipboard := Clipsave
  69. TestTempCode:
  70. DetectHiddenWindows, On
  71. If Winexist("TempTestCode.ahk")
  72. {
  73. PostMessage("Slave script", 1)
  74. }
  75. DetectHiddenWindows, Off
  76. Gui, Submit, NoHide
  77. FileAppend,
  78. (
  79. #Persistent
  80. #SingleInstance, Force
  81. Progress, m2 b fs13 Y0 zh0 WMn700, Test script is running
  82. Gui 99: show, hide, Slave script ; hidden message receiver window
  83. OnMessage(0x1001,"ReceiveMessage")
  84. %TempCode%
  85. return
  86.  
  87. ReceiveMessage(Message) {
  88.    if Message = 1
  89.    ExitApp
  90. }
  91. ), %A_ScriptDir%\TempTestCode.ahk
  92. Run, %A_ProgramFiles%\AutoHotkey\AutoHotkey.exe "%A_ScriptDir%
  93.  
  94. \TempTestCode.ahk"
  95. Sleep, 100
  96. IfWinExist, ahk_class #32770
  97. {
  98. Sleep 20
  99. WinActivate, ahk_class #32770
  100. Clipsave := ClipboardAll
  101. Send, ^c
  102. CheckWin := Clipboard
  103. Clipboard := Clipsave
  104. IfInString, CheckWin, The program will exit.
  105. {
  106. IfExist, %A_ScriptDir%\TempTestCode.ahk
  107. FileDelete, %A_ScriptDir%\TempTestCode.ahk
  108. TrayTip, ERROR, Error executing the code properly
  109. return
  110. }
  111. }
  112. TrayTip, Status:, Test code is now running on your machine.
  113. return
  114. PostMessage(Receiver, Message) {
  115. oldTMM := A_TitleMatchMode, oldDHW := A_DetectHiddenWindows
  116. SetTitleMatchMode, 3
  117. DetectHiddenWindows, on
  118. PostMessage, 0x1001,%Message%,,, %Receiver% ahk_class AutoHotkeyGUI
  119. SetTitleMatchMode, %oldTMM%
  120. DetectHiddenWindows, %oldDHW%
  121. IfExist, %A_ScriptDir%\TempTestCode.*
  122. FileDelete, %A_ScriptDir%\TempTestCode.*
  123. }
  124. TestVBS:
  125. Gui, Submit, NoHide
  126. GuiControl,, TempCode, %Clipboard%
  127. Clipboard := Clipsave
  128. FileAppend, %TempCode%, TempTestCode.vbs
  129. Run, TempTestCode.vbs
  130. return
  131. TestBatch:
  132. Gui, Submit, NoHide
  133. GuiControl,, TempCode, %Clipboard%
  134. Clipboard := Clipsave
  135. FileAppend, %TempCode%, TempTestCode.bat
  136. Run, TempTestCode.bat
  137. return
  138. TestAutoIt:
  139. Gui, Submit, NoHide
  140. GuiControl,, TempCode, %Clipboard%
  141. Clipboard := Clipsave
  142. FileAppend, %TempCode%, TempTestCode.au3
  143. Run, TempTestCode.au3
  144. Return
  145. #R::Reload
  146. #S::Suspend
  147. #P::Pause
  148. ESC::ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement