Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- app: MouseTools | /usr/bin/MouseTools
- -- user options
- set bookmark to "off" -- "on" or "off", to run script set bookmark to "off"
- set text_continue_reading to "off" -- "on" or "off"
- set instruction to "on" -- "on" or "off"
- -- end of user options
- -- get name of active app
- tell application "System Events"
- set activeApp to (get name of first process where it is frontmost)
- end tell
- -- get name of active window
- tell application "System Events"
- tell process activeApp
- set mywinname to get title of front window
- end tell
- end tell
- set list_done to {}
- -------------------------------------------------------
- -- Paste above.
- -------------------------------------------------------
- if bookmark is "off" then
- set countDone to count list_done
- if countDone = 1 or countDone > 1 then
- display notification "Done!" with title "Script 31"
- return
- else
- 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")
- if bookmark_not_found_then_set_bookmark is "1" then
- set bookmark to "on"
- else
- return
- end if
- end if
- end if
- if bookmark is "on" and text_continue_reading is "off" then
- if instruction is "on" then
- display dialog "1. Select Text.
- 2. Click This Window.
- 3. Place Mouse Pointer on The Middle of Slider and Hit Return." with title "Script 31"
- end if
- tell application "System Events"
- tell process activeApp
- set frontmost to true
- delay 0.5
- end tell
- end tell
- tell application "System Events"
- set the clipboard to ""
- delay 0.4
- keystroke "c" using command down
- delay 0.7
- set CopT to (the clipboard as text)
- end tell
- -- fix "
- set prevTIDs to AppleScript's text item delimiters
- set AppleScript's text item delimiters to the "\"" -- search %20
- set the item_list to every text item of CopT -- original text
- set AppleScript's text item delimiters to the "\\\"" -- replace
- set CopT to the item_list as string
- set AppleScript's text item delimiters to prevTIDs
- set curTime to do shell script "date +%Y-%m-%d_%H.%M.%S"
- -- mouse pos
- set curmousepos to do shell script "MouseTools -location"
- set prevTIDs to AppleScript's text item delimiters
- set AppleScript's text item delimiters to the return
- set x_mousepos to text item 1 of curmousepos
- set y_mousepos to text item 2 of curmousepos
- set AppleScript's text item delimiters to prevTIDs
- -- end - mouse pos
- -- fix "
- set prevTIDs to AppleScript's text item delimiters
- set AppleScript's text item delimiters to the "\"" -- search %20
- set the item_list to every text item of mywinname -- original text
- set AppleScript's text item delimiters to the "\\\"" -- replace
- set mywinname to the item_list as string
- set AppleScript's text item delimiters to prevTIDs
- tell application "System Events"
- set ppp to get position of window 1 of process activeApp
- delay 0.03
- set sss to get size of window 1 of process activeApp
- delay 0.02
- set pos1 to (item 1 of ppp)
- set pos2 to (item 2 of ppp)
- set siz1 to (item 1 of sss)
- set siz2 to (item 2 of sss)
- set code_user to "-- " & curTime & " - Page: " & mywinname & "
- if " & "\"" & mywinname & "\"" & " is mywinname and " & "\"" & activeApp & "\"" & " is activeApp and bookmark is \"off\" then
- tell application \"System Events\"
- repeat 30 times
- key code 126
- end repeat
- set position of window 1 of process activeApp to {" & pos1 & ", " & pos2 & "}
- delay 0.03
- set size of window 1 of process activeApp to {" & siz1 & ", " & siz2 & "}
- do shell script \"MouseTools -x " & x_mousepos & " -y " & y_mousepos & "\"
- delay 0.3
- do shell script \"MouseTools -leftClickNoRelease\"
- delay 0.1
- do shell script \"MouseTools -releaseMouse\"
- delay 0.5
- display dialog " & "\"" & CopT & "...\"" & " with title " & "\"" & "Continue Reading - Script 31" & "\"" & "
- copy \"done\" to the end of list_done
- end tell
- end if
- -- END
- "
- delay 0.5
- set the clipboard to code_user
- delay 0.1
- display dialog "Done!" with title "Code for User - Script 31"
- return
- end tell
- end if -- bookmark is "on" and text_continue_reading is "off" then
- if bookmark is "on" and text_continue_reading is "on" then
- set user_text to the text returned of (display dialog "Continue Reading" default answer "" with title "Script 31")
- if instruction is "on" then
- display dialog "Place Mouse Pointer on The Middle of Slider and Hit Return." with title "Script 31"
- end if
- -- fix "
- set prevTIDs to AppleScript's text item delimiters
- set AppleScript's text item delimiters to the "\"" -- search %20
- set the item_list to every text item of user_text -- original text
- set AppleScript's text item delimiters to the "\\\"" -- replace
- set user_text to the item_list as string
- set AppleScript's text item delimiters to prevTIDs
- set curTime to do shell script "date +%Y-%m-%d_%H.%M.%S"
- -- mouse pos
- set curmousepos to do shell script "MouseTools -location"
- set prevTIDs to AppleScript's text item delimiters
- set AppleScript's text item delimiters to the return
- set x_mousepos to text item 1 of curmousepos
- set y_mousepos to text item 2 of curmousepos
- set AppleScript's text item delimiters to prevTIDs
- -- end - mouse pos
- -- fix "
- set prevTIDs to AppleScript's text item delimiters
- set AppleScript's text item delimiters to the "\"" -- search %20
- set the item_list to every text item of mywinname -- original text
- set AppleScript's text item delimiters to the "\\\"" -- replace with space (" ")
- set mywinname to the item_list as string
- set AppleScript's text item delimiters to prevTIDs
- tell application "System Events"
- set ppp to get position of window 1 of process activeApp
- delay 0.03
- set sss to get size of window 1 of process activeApp
- delay 0.02
- set pos1 to (item 1 of ppp)
- set pos2 to (item 2 of ppp)
- set siz1 to (item 1 of sss)
- set siz2 to (item 2 of sss)
- set code_user to "-- " & curTime & " - Page: " & mywinname & "
- if " & "\"" & mywinname & "\"" & " is mywinname and " & "\"" & activeApp & "\"" & " is activeApp and bookmark is \"off\" then
- tell application \"System Events\"
- repeat 30 times
- key code 126
- end repeat
- set position of window 1 of process activeApp to { " & pos1 & ", " & pos2 & "}
- delay 0.03
- set size of window 1 of process activeApp to {" & siz1 & ", " & siz2 & "}
- do shell script \"MouseTools -x " & x_mousepos & " -y " & y_mousepos & "\"
- delay 0.3
- do shell script \"MouseTools -leftClickNoRelease\"
- delay 0.1
- do shell script \"MouseTools -releaseMouse\"
- delay 0.5
- display dialog " & "\"" & user_text & "...\"" & " with title " & "\"" & "Continue Reading - Script 31" & "\"" & "
- copy \"done\" to the end of list_done
- end tell
- end if
- -- END
- "
- delay 0.5
- set the clipboard to code_user
- delay 0.1
- display dialog "Done!" with title "Code for User - Script 31"
- end tell
- end if -- bookmark is "on" and text_continue_reading is "on" then
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement