Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.72 KB | None | 0 0
  1. -- app: MouseTools | /usr/bin/MouseTools
  2. -- user options
  3. set bookmark to "off" -- "on" or "off", to run script set bookmark to "off"
  4. set text_continue_reading to "off" -- "on" or "off"
  5. set instruction to "on" -- "on" or "off"
  6. -- end of user options
  7.  
  8. -- get name of active app
  9. tell application "System Events"
  10. set activeApp to (get name of first process where it is frontmost)
  11. end tell
  12. -- get name of active window
  13. tell application "System Events"
  14. tell process activeApp
  15. set mywinname to get title of front window
  16. end tell
  17. end tell
  18.  
  19.  
  20. set list_done to {}
  21. -------------------------------------------------------
  22.  
  23.  
  24.  
  25. -- Paste above.
  26. -------------------------------------------------------
  27. if bookmark is "off" then
  28. set countDone to count list_done
  29. if countDone = 1 or countDone > 1 then
  30. display notification "Done!" with title "Script 31"
  31. return
  32. else
  33. set bookmark_not_found_then_set_bookmark to the text returned of (display dialog "Bookmark Not Found | Set Bookmark = 1" default answer "" with title "Script 31")
  34. if bookmark_not_found_then_set_bookmark is "1" then
  35. set bookmark to "on"
  36. else
  37. return
  38.  
  39. end if
  40.  
  41. end if
  42. end if
  43.  
  44. if bookmark is "on" and text_continue_reading is "off" then
  45. if instruction is "on" then
  46. display dialog "1. Select Text.
  47. 2. Click This Window.
  48. 3. Place Mouse Pointer on The Middle of Slider and Hit Return." with title "Script 31"
  49. end if
  50. tell application "System Events"
  51. tell process activeApp
  52. set frontmost to true
  53. delay 0.5
  54. end tell
  55. end tell
  56. tell application "System Events"
  57.  
  58. set the clipboard to ""
  59. delay 0.4
  60. keystroke "c" using command down
  61. delay 0.7
  62. set CopT to (the clipboard as text)
  63. end tell
  64. -- fix "
  65. set prevTIDs to AppleScript's text item delimiters
  66. set AppleScript's text item delimiters to the "\"" -- search %20
  67. set the item_list to every text item of CopT -- original text
  68. set AppleScript's text item delimiters to the "\\\"" -- replace
  69. set CopT to the item_list as string
  70. set AppleScript's text item delimiters to prevTIDs
  71. set curTime to do shell script "date +%Y-%m-%d_%H.%M.%S"
  72. -- mouse pos
  73. set curmousepos to do shell script "MouseTools -location"
  74. set prevTIDs to AppleScript's text item delimiters
  75. set AppleScript's text item delimiters to the return
  76. set x_mousepos to text item 1 of curmousepos
  77. set y_mousepos to text item 2 of curmousepos
  78. set AppleScript's text item delimiters to prevTIDs
  79. -- end - mouse pos
  80.  
  81.  
  82. -- fix "
  83. set prevTIDs to AppleScript's text item delimiters
  84. set AppleScript's text item delimiters to the "\"" -- search %20
  85. set the item_list to every text item of mywinname -- original text
  86. set AppleScript's text item delimiters to the "\\\"" -- replace
  87. set mywinname to the item_list as string
  88. set AppleScript's text item delimiters to prevTIDs
  89. tell application "System Events"
  90. set ppp to get position of window 1 of process activeApp
  91. delay 0.03
  92. set sss to get size of window 1 of process activeApp
  93. delay 0.02
  94. set pos1 to (item 1 of ppp)
  95. set pos2 to (item 2 of ppp)
  96. set siz1 to (item 1 of sss)
  97. set siz2 to (item 2 of sss)
  98. set code_user to "-- " & curTime & " - Page: " & mywinname & "
  99. if " & "\"" & mywinname & "\"" & " is mywinname and " & "\"" & activeApp & "\"" & " is activeApp and bookmark is \"off\" then
  100. tell application \"System Events\"
  101. repeat 30 times
  102. key code 126
  103. end repeat
  104. set position of window 1 of process activeApp to {" & pos1 & ", " & pos2 & "}
  105. delay 0.03
  106. set size of window 1 of process activeApp to {" & siz1 & ", " & siz2 & "}
  107. do shell script \"MouseTools -x " & x_mousepos & " -y " & y_mousepos & "\"
  108. delay 0.3
  109. do shell script \"MouseTools -leftClickNoRelease\"
  110. delay 0.1
  111. do shell script \"MouseTools -releaseMouse\"
  112. delay 0.5
  113. display dialog " & "\"" & CopT & "...\"" & " with title " & "\"" & "Continue Reading - Script 31" & "\"" & "
  114. copy \"done\" to the end of list_done
  115. end tell
  116. end if
  117. -- END
  118.  
  119. "
  120. delay 0.5
  121. set the clipboard to code_user
  122. delay 0.1
  123. display dialog "Done!" with title "Code for User - Script 31"
  124. return
  125. end tell
  126. end if -- bookmark is "on" and text_continue_reading is "off" then
  127.  
  128. if bookmark is "on" and text_continue_reading is "on" then
  129. set user_text to the text returned of (display dialog "Continue Reading" default answer "" with title "Script 31")
  130. if instruction is "on" then
  131. display dialog "Place Mouse Pointer on The Middle of Slider and Hit Return." with title "Script 31"
  132. end if
  133. -- fix "
  134. set prevTIDs to AppleScript's text item delimiters
  135. set AppleScript's text item delimiters to the "\"" -- search %20
  136. set the item_list to every text item of user_text -- original text
  137. set AppleScript's text item delimiters to the "\\\"" -- replace
  138. set user_text to the item_list as string
  139. set AppleScript's text item delimiters to prevTIDs
  140. set curTime to do shell script "date +%Y-%m-%d_%H.%M.%S"
  141. -- mouse pos
  142. set curmousepos to do shell script "MouseTools -location"
  143. set prevTIDs to AppleScript's text item delimiters
  144. set AppleScript's text item delimiters to the return
  145. set x_mousepos to text item 1 of curmousepos
  146. set y_mousepos to text item 2 of curmousepos
  147. set AppleScript's text item delimiters to prevTIDs
  148. -- end - mouse pos
  149.  
  150. -- fix "
  151. set prevTIDs to AppleScript's text item delimiters
  152. set AppleScript's text item delimiters to the "\"" -- search %20
  153. set the item_list to every text item of mywinname -- original text
  154. set AppleScript's text item delimiters to the "\\\"" -- replace with space (" ")
  155. set mywinname to the item_list as string
  156. set AppleScript's text item delimiters to prevTIDs
  157. tell application "System Events"
  158. set ppp to get position of window 1 of process activeApp
  159. delay 0.03
  160. set sss to get size of window 1 of process activeApp
  161. delay 0.02
  162. set pos1 to (item 1 of ppp)
  163. set pos2 to (item 2 of ppp)
  164. set siz1 to (item 1 of sss)
  165. set siz2 to (item 2 of sss)
  166. set code_user to "-- " & curTime & " - Page: " & mywinname & "
  167. if " & "\"" & mywinname & "\"" & " is mywinname and " & "\"" & activeApp & "\"" & " is activeApp and bookmark is \"off\" then
  168. tell application \"System Events\"
  169. repeat 30 times
  170. key code 126
  171. end repeat
  172. set position of window 1 of process activeApp to { " & pos1 & ", " & pos2 & "}
  173. delay 0.03
  174. set size of window 1 of process activeApp to {" & siz1 & ", " & siz2 & "}
  175. do shell script \"MouseTools -x " & x_mousepos & " -y " & y_mousepos & "\"
  176. delay 0.3
  177. do shell script \"MouseTools -leftClickNoRelease\"
  178. delay 0.1
  179. do shell script \"MouseTools -releaseMouse\"
  180. delay 0.5
  181. display dialog " & "\"" & user_text & "...\"" & " with title " & "\"" & "Continue Reading - Script 31" & "\"" & "
  182. copy \"done\" to the end of list_done
  183. end tell
  184. end if
  185. -- END
  186.  
  187. "
  188. delay 0.5
  189. set the clipboard to code_user
  190. delay 0.1
  191. display dialog "Done!" with title "Code for User - Script 31"
  192. end tell
  193. end if -- bookmark is "on" and text_continue_reading is "on" then
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement