Skip to content

Instantly share code, notes, and snippets.

@OKsign
Created April 2, 2019 15:16
Show Gist options
  • Save OKsign/0654a831d7827fa7b93402aaee0bbf4f to your computer and use it in GitHub Desktop.
Save OKsign/0654a831d7827fa7b93402aaee0bbf4f to your computer and use it in GitHub Desktop.
-- user input
set LowerCase to {"foobar", "to", "with", "in", "from", "and", "of", "by", "at"}
set UpperCase to {"atom", "vlc"}
set UpperLower to {"UMPlayer", "VideoSpec"}
-- end of user input
set aList to LowerCase & UpperCase & UpperLower
-- new list
set StartBlanket to {"(", "[", "<", "|", "{", "\""}
set EndBlanket to {")", "]", ">", "|", "}", "\""}
set igList to {"|", "&"} -- appended 2018-10-29_08.49.02
set ApostrophesList to {"'ve", "'s", "'d", "'re", "n't", "'ll", "'m", "o'clock", "s'"}
set prevTIDs to AppleScript's text item delimiters
tell application "System Events"
keystroke "c" using command down
delay 0.7
set CopT to (the clipboard as text)
end tell
set Lencopt to length of CopT
set AppleScript's text item delimiters to {" "}
set myText1 to ""
repeat with N from 1 to (count text item of CopT)
repeat with j from 1 to count ApostrophesList
if (text item N of CopT) ends with item j of ApostrophesList then
set textwithApostrophes to (text item N of CopT)
set go_textwithApostrophes to 1
exit repeat
else
set go_textwithApostrophes to 0
end if -- (text item N of CopT) ends with item j of ApostrophesList then
end repeat
-- do 'text' -- no spaces
if (last character of (text item N of CopT) ends with "'") and (first character of (text item N of CopT) starts with "'") then
set done_endstartQuote_text_noSpaces to 1
set targetText_endstartQuote_text to (text item N of CopT)
set endchar_endstartQuote_text to (length of (text item N of CopT)) - 1
set AppleScript's text item delimiters to prevTIDs
set dothisText_check_aList to ((characters 2 thru endchar_endstartQuote_text of targetText_endstartQuote_text) as string)
delay 0.02
if (length of dothisText_check_aList) is 1 then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
set aText to first character of (text item N of CopT) & Done_dothisText_check_aList & last character of (text item N of CopT)
end if -- (length of dothisText_check_aList) is 1 then
delay 0.02
if (length of dothisText_check_aList) > 1 then
if dothisText_check_aList is in aList then
delay 0.02
if LowerCase contains dothisText_check_aList then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:upper:] [:lower:] "
set aText to first character of (text item N of CopT) & Done_dothisText_check_aList & last character of (text item N of CopT)
end if
delay 0.02
if UpperCase contains dothisText_check_aList then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
set aText to first character of (text item N of CopT) & Done_dothisText_check_aList & last character of (text item N of CopT)
end if
delay 0.02
if UpperLower contains dothisText_check_aList then
delay 0.02
repeat with i from 1 to (count UpperLower)
if dothisText_check_aList is (item i of UpperLower) then
delay 0.02
set Done_dothisText_check_aList to (item i of UpperLower)
exit repeat
end if
end repeat
set aText to first character of (text item N of CopT) & Done_dothisText_check_aList & last character of (text item N of CopT)
end if
delay 0.02
else -- dothisText_check_aList is not in aList then -- targetText_endstartQuote_text -- (length of dothisText_check_aList) > 1
set Done_dothisText_check_aList to do shell script "echo " & character 1 of dothisText_check_aList & " | tr [:lower:] [:upper:]"
delay 0.02
repeat with x from 2 to (length of dothisText_check_aList)
set bText to do shell script "echo " & character x of dothisText_check_aList & " | tr [:upper:] [:lower:]"
set Done_dothisText_check_aList to Done_dothisText_check_aList & bText
end repeat
set aText to first character of (text item N of CopT) & Done_dothisText_check_aList & last character of (text item N of CopT)
end if -- if dothisText_check_aList is in aList then
end if -- if (length of dothisText_check_aList) > 1 then
else -- of if: (last character of (text item N of CopT) ends with "'") and (first character of (text item N of CopT) starts with "'")
set done_endstartQuote_text_noSpaces to 0
end if
delay 0.02
-- end - do 'text' -- no spaces
if go_textwithApostrophes is 1 then
set go_textwithApostrophes to 1
if character 1 of (text item N of CopT) is not in StartBlanket then
set AppleScript's text item delimiters to (item j of ApostrophesList)
set dothisText to (text item 1 of textwithApostrophes)
set AppleScript's text item delimiters to prevTIDs
if (length of dothisText) is 0 then -- o'clock
set aText to "O'Clock"
end if
if (length of dothisText) is 1 then
set Done_dothisText to do shell script "echo " & character 1 of dothisText & " | tr [:lower:] [:upper:]"
set aText to Done_dothisText & (item j of ApostrophesList)
end if -- (length of dothisText) is 1 then
delay 0.03
if (length of dothisText) > 1 then
if dothisText is in aList then -- in aList ?
delay 0.02
if LowerCase contains dothisText then
set Done_dothisText to do shell script "echo " & dothisText & " | tr [:upper:] [:lower:] "
set aText to Done_dothisText & (item j of ApostrophesList)
end if
delay 0.02
if UpperCase contains dothisText then
set Done_dothisText to do shell script "echo " & dothisText & " | tr [:lower:] [:upper:] "
set aText to Done_dothisText & (item j of ApostrophesList)
end if
delay 0.02
if UpperLower contains dothisText then
delay 0.02
repeat with i from 1 to (count UpperLower)
if dothisText is (item i of UpperLower) then
delay 0.02
set Done_dothisText to (item i of UpperLower)
exit repeat
end if
end repeat
set aText to Done_dothisText & (item j of ApostrophesList)
end if
else -- dothisText is NOT in aList then
delay 0.02
set Done_dothisText to do shell script "echo " & character 1 of dothisText & " | tr [:lower:] [:upper:]"
repeat with x from 2 to (length of dothisText)
set bText to do shell script "echo " & character x of dothisText & " | tr [:upper:] [:lower:]"
set Done_dothisText to Done_dothisText & bText
end repeat
set aText to Done_dothisText & (item j of ApostrophesList)
end if -- dothisText is in aList then
end if -- (length of dothisText) > 1 then
end if -- if character 1 of (text item N of CopT) is not in StartBlanket then
delay 0.02
if character 1 of (text item N of CopT) is in StartBlanket then
set go_textwithApostrophes to 1
set AppleScript's text item delimiters to (item j of ApostrophesList)
set dothisText to (text item 1 of textwithApostrophes)
set AppleScript's text item delimiters to prevTIDs
if (length of dothisText) is 1 then
set aText to character 1 of (text item N of CopT) & (item j of ApostrophesList)
end if -- (length of dothisText) is 1 then
if (length of dothisText) is 2 then -- character 1 of (text item N of CopT) is in StartBlanket
set dothisText_check_aList to ((character 2 of dothisText) as string)
if dothisText_check_aList is in aList then
delay 0.02
if LowerCase contains dothisText_check_aList then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:upper:] [:lower:] "
set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
end if
delay 0.02
if UpperCase contains dothisText_check_aList then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
end if
delay 0.02
if UpperLower contains dothisText_check_aList then
delay 0.02
repeat with i from 1 to (count UpperLower)
if dothisText_check_aList is (item i of UpperLower) then
delay 0.02
set Done_dothisText_check_aList to (item i of UpperLower)
exit repeat
end if
end repeat
set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
end if
else -- dothisText_check_aList is not in aList then - (length of dothisText) is 2
set Done_dothisText to do shell script "echo " & character 2 of dothisText & " | tr [:lower:] [:upper:]"
set aText to character 1 of (text item N of CopT) & Done_dothisText & (item j of ApostrophesList)
end if -- dothisText_check_aList is in aList then
end if -- if (length of dothisText) is 2 then
if (length of dothisText) > 2 then -- character 1 of (text item N of CopT) is in StartBlanket
set dothisText_check_aList to ((characters 2 thru (length of dothisText) of dothisText) as string)
if dothisText_check_aList is in aList then
delay 0.02
if LowerCase contains dothisText_check_aList then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:upper:] [:lower:] "
set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
end if
delay 0.02
if UpperCase contains dothisText_check_aList then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
end if
delay 0.02
if UpperLower contains dothisText_check_aList then
delay 0.02
repeat with i from 1 to (count UpperLower)
if dothisText_check_aList is (item i of UpperLower) then
delay 0.02
set Done_dothisText_check_aList to (item i of UpperLower)
exit repeat
end if
end repeat
set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
end if
else -- dothisText_check_aList is NOT in aList
set Done_dothisText to do shell script "echo " & character 2 of dothisText & " | tr [:lower:] [:upper:]"
repeat with x from 3 to (length of dothisText)
set bText to do shell script "echo " & character x of dothisText & " | tr [:upper:] [:lower:]"
set Done_dothisText to Done_dothisText & bText
end repeat
set aText to character 1 of (text item N of CopT) & Done_dothisText & (item j of ApostrophesList)
end if -- dothisText_check_aList is in aList then
end if -- (length of dothisText) > 2 then
end if -- if character 1 of (text item N of CopT) is in StartBlanket then
end if -- go_textwithApostrophes is 1 then
-- added - for script 27
-- Apostrophes + endblanket
-- set AppleScript's text item delimiters to {" "}
delay 0.3
if last character of (text item N of CopT) is in EndBlanket then
delay 0.02
if first character of (text item N of CopT) is not in StartBlanket then
delay 0.02
set targetText to (text item N of CopT)
delay 0.03
set AppleScript's text item delimiters to prevTIDs
set endchar_number to (length of targetText) - 1
set delete_EndBlanket_Text to (characters 1 thru endchar_number of targetText) as string
repeat with j from 1 to count ApostrophesList
if delete_EndBlanket_Text ends with item j of ApostrophesList then
set delete_EndBlanket_Text_Apostrophes to delete_EndBlanket_Text
set go_textwithApostrophes to 1
exit repeat
else
set go_textwithApostrophes to 0
end if
end repeat
if go_textwithApostrophes is 1 then -- if last character of (text item N of CopT) is in EndBlanket then
set AppleScript's text item delimiters to item j of ApostrophesList
set dothisText_check_aList to text item 1 of delete_EndBlanket_Text_Apostrophes -- firefox's) >> firefox
set AppleScript's text item delimiters to " " -- added - can't get text item
if (length of dothisText_check_aList) is 0 then -- o'clock
set aText to "O'Clock" & (last character of targetText)
end if
if (length of dothisText_check_aList) is 1 then
set Done_dothisText_check_aList to do shell script "echo " & character 1 of dothisText_check_aList & " | tr [:lower:] [:upper:]"
set aText to Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
end if
if (length of dothisText_check_aList) > 1 then
if dothisText_check_aList is in aList then -- in aList
delay 0.02
if LowerCase contains dothisText_check_aList then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:upper:] [:lower:] "
set aText to Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
end if
delay 0.02
if UpperCase contains dothisText_check_aList then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
set aText to Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
end if
delay 0.02
if UpperLower contains dothisText_check_aList then
delay 0.02
repeat with i from 1 to (count UpperLower)
if dothisText_check_aList is (item i of UpperLower) then
delay 0.02
set Done_dothisText_check_aList to (item i of UpperLower)
exit repeat
end if
end repeat
set aText to Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
end if
else -- dothisText_check_aList is NOT in aList then
delay 0.03
set Done_dothisText_check_aList to do shell script "echo " & character 1 of dothisText_check_aList & " | tr [:lower:] [:upper:]"
repeat with x from 2 to (length of dothisText_check_aList)
delay 0.02
set bText to do shell script "echo " & character x of dothisText_check_aList & " | tr [:upper:] [:lower:]"
set Done_dothisText_check_aList to Done_dothisText_check_aList & bText
end repeat
set aText to Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
end if -- if dothisText_check_aList is in aList then
end if -- if (length of dothisText_check_aList) > 1 then
end if -- if go_textwithApostrophes is 1 -- if last character of (text item N of CopT) is in EndBlanket then
end if -- if first character of (text item N of CopT) is not in StartBlanket then
end if -- if last character of (text item N of CopT) is in EndBlanket then
-- end - added - for script 27
-- for script 27
-- startblanket & textwithApostrophes & endblanket
delay 0.02
if last character of (text item N of CopT) is in EndBlanket then
delay 0.02
if first character of (text item N of CopT) is in StartBlanket then
delay 0.02
set targetText to (text item N of CopT)
delay 0.03
set AppleScript's text item delimiters to prevTIDs
set endchar_number to (length of targetText) - 1
set delete_StartEndBlanket_Text to (characters 2 thru endchar_number of targetText) as string
repeat with j from 1 to count ApostrophesList
if delete_StartEndBlanket_Text ends with item j of ApostrophesList then
set delete_StartEndBlanket_Text_Apostrophes to delete_StartEndBlanket_Text
set go_textwithApostrophes to 1
exit repeat
else
set go_textwithApostrophes to 0
end if
end repeat
if go_textwithApostrophes is 1 then
set AppleScript's text item delimiters to (item j of ApostrophesList)
set dothisText_check_aList to text item 1 of delete_StartEndBlanket_Text_Apostrophes
delay 0.02
set AppleScript's text item delimiters to " " -- added - can't get text item
if (length of dothisText_check_aList) is 0 then -- o'clock
set aText to "O'Clock" & (last character of targetText)
end if
if (length of dothisText_check_aList) is 1 then
set Done_dothisText_check_aList to do shell script "echo " & character 1 of dothisText_check_aList & " | tr [:lower:] [:upper:]"
set aText to (first character of targetText) & Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
end if
if (length of dothisText_check_aList) > 1 then
if dothisText_check_aList is in aList then -- in aList
delay 0.02
if LowerCase contains dothisText_check_aList then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:upper:] [:lower:] "
set aText to (first character of targetText) & Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
end if
delay 0.02
if UpperCase contains dothisText_check_aList then
set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
set aText to (first character of targetText) & Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
end if
delay 0.02
if UpperLower contains dothisText_check_aList then
delay 0.02
repeat with i from 1 to (count UpperLower)
if dothisText_check_aList is (item i of UpperLower) then
delay 0.02
set Done_dothisText_check_aList to (item i of UpperLower)
exit repeat
end if
end repeat
set aText to (first character of targetText) & Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
end if
else -- dothisText_check_aList is NOT in aList then
delay 0.03
set Done_dothisText_check_aList to do shell script "echo " & character 1 of dothisText_check_aList & " | tr [:lower:] [:upper:]"
repeat with x from 2 to (length of dothisText_check_aList)
delay 0.02
set bText to do shell script "echo " & character x of dothisText_check_aList & " | tr [:upper:] [:lower:]"
set Done_dothisText_check_aList to Done_dothisText_check_aList & bText
end repeat
set aText to (first character of targetText) & Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
end if -- if dothisText_check_aList is in aList then
end if -- if (length of dothisText_check_aList) > 1 then
end if
end if
end if
-- end - startblanket & textwithApostrophes & endblanket
-- end - for script 27
delay 0.5
set AppleScript's text item delimiters to {" "}
if go_textwithApostrophes is 0 or done_endstartQuote_text_noSpaces is 0 then
delay 0.03
if (text item N of CopT) is not in aList then
delay 0.05
-- length > 2
if length of (text item N of CopT) is greater than 2 then
-- add fix 83.3
-- SlashText - word with one Slash (ab/cd) is supported
if (text item N of CopT) contains "/" then
if character 1 of (text item N of CopT) is not "/" then
set sepText to (text item N of CopT)
repeat with x from 1 to length of sepText
if character x of sepText is "/" then
set posSlash to x
exit repeat
end if
end repeat
set numCharEndSlashText to posSlash - 1
set EndSlashText to ""
repeat with x from 1 to numCharEndSlashText
set EndSlashText to EndSlashText & character x of sepText
end repeat
set StartSlashText to ""
repeat with x from (posSlash + 1) to length of sepText
set StartSlashText to StartSlashText & character x of sepText
end repeat
delay 0.02
repeat 1 times
if LowerCase contains EndSlashText then
delay 0.02
set slashText1 to do shell script "echo " & EndSlashText & " | tr [:upper:] [:lower:] "
exit repeat
end if
delay 0.02
if UpperCase contains EndSlashText then
delay 0.02
set slashText1 to do shell script "echo " & EndSlashText & " | tr [:lower:] [:upper:] "
exit repeat
end if
if UpperLower contains EndSlashText then
delay 0.02
repeat with i from 1 to (count UpperLower)
if EndSlashText is item i of UpperLower then
delay 0.02
set slashText1 to item i of UpperLower
exit repeat
end if
end repeat
else -- EndSlashText is not in aList
set slashText1 to do shell script "echo " & character 1 of EndSlashText & " | tr [:lower:] [:upper:]"
repeat with x from 2 to (length of EndSlashText)
set bText to do shell script "echo " & character x of EndSlashText & " | tr [:upper:] [:lower:]"
set slashText1 to slashText1 & bText
end repeat
end if
end repeat -- repeat 1 times
repeat 1 times
delay 0.02
if LowerCase contains StartSlashText then
set slashText2 to do shell script "echo " & StartSlashText & " | tr [:upper:] [:lower:] "
exit repeat
end if
delay 0.02
if UpperCase contains StartSlashText then
delay 0.02
set slashText2 to do shell script "echo " & StartSlashText & " | tr [:lower:] [:upper:] "
exit repeat
end if
delay 0.02
if UpperLower contains StartSlashText then
repeat with i from 1 to (count UpperLower)
delay 0.02
if StartSlashText is item i of UpperLower then
delay 0.02
set slashText2 to item i of UpperLower
exit repeat
end if
end repeat
else -- StartSlashText is not in aList
set slashText2 to do shell script "echo " & character 1 of StartSlashText & " | tr [:lower:] [:upper:]"
repeat with x from 2 to (length of StartSlashText)
set bText to do shell script "echo " & character x of StartSlashText & " | tr [:upper:] [:lower:]"
set slashText2 to slashText2 & bText
end repeat
end if
end repeat -- repeat 1 times
set aText to slashText1 & "/" & slashText2
end if
end if
-- end add fix 83.3
delay 0.05
if character 1 of (text item N of CopT) is in StartBlanket then
delay 0.05
if last character of (text item N of CopT) is in EndBlanket then
delay 0.02
-- change add - fix 83.3 InBlanketText - (text item N of CopT) is not in aList
set sepText to (text item N of CopT)
set InBlanketText to ""
repeat with x from 2 to (length of sepText) - 1
set InBlanketText to InBlanketText & character x of sepText
end repeat
repeat 1 times
delay 0.02
if LowerCase contains InBlanketText then
delay 0.02
set aText to do shell script "echo " & InBlanketText & " | tr [:upper:] [:lower:] "
set aText to character 1 of (text item N of CopT) & aText & last character of sepText
exit repeat
end if
delay 0.02
if UpperCase contains InBlanketText then
delay 0.02
set aText to do shell script "echo " & InBlanketText & " | tr [:lower:] [:upper:] "
set aText to character 1 of (text item N of CopT) & aText & last character of sepText
exit repeat
end if
if UpperLower contains InBlanketText then
delay 0.02
repeat with i from 1 to (count UpperLower)
if InBlanketText is item i of UpperLower then
delay 0.02
set aText to item i of UpperLower
set aText to character 1 of (text item N of CopT) & aText & last character of sepText
exit repeat
end if
end repeat
else -- StartBlanketText is not in aList
if (text item N of CopT) does not contain "'" then -- added for s27
set aText to do shell script "echo " & character 2 of sepText & " | tr [:lower:] [:upper:]"
repeat with x from 3 to (length of sepText) - 1
set bText to do shell script "echo " & character x of sepText & " | tr [:upper:] [:lower:]"
set aText to aText & bText
end repeat
set aText to character 1 of sepText & aText & last character of sepText
end if
end if
end repeat -- repeat 1 times
-- end change add - fix 83.3 InBlanketText - (text item N of CopT) is not in aList
end if
-- add fix 83.3
if last character of (text item N of CopT) is not in EndBlanket then
set sepText to (text item N of CopT)
set StartBlanketText to ""
repeat with x from 2 to length of sepText
set StartBlanketText to StartBlanketText & character x of sepText
end repeat
repeat 1 times
if LowerCase contains StartBlanketText then
delay 0.02
set aText to do shell script "echo " & StartBlanketText & " | tr [:upper:] [:lower:] "
set aText to character 1 of (text item N of CopT) & aText
exit repeat
end if
delay 0.02
if UpperCase contains StartBlanketText then
delay 0.02
set aText to do shell script "echo " & StartBlanketText & " | tr [:lower:] [:upper:] "
set aText to character 1 of (text item N of CopT) & aText
exit repeat
end if
if UpperLower contains StartBlanketText then
delay 0.02
repeat with i from 1 to (count UpperLower)
if StartBlanketText is item i of UpperLower then
delay 0.02
set aText to item i of UpperLower
set aText to character 1 of (text item N of CopT) & aText
exit repeat
end if
end repeat
else -- StartBlanketText is not in aList
if (text item N of CopT) does not contain "'" then -- added for s27
set aText to do shell script "echo " & character 2 of sepText & " | tr [:lower:] [:upper:]"
repeat with x from 3 to length of sepText
set bText to do shell script "echo " & character x of sepText & " | tr [:upper:] [:lower:]"
set aText to aText & bText
end repeat
set aText to character 1 of sepText & aText
end if -- added for s27
end if
end repeat -- repeat 1 times
end if -- last character of (text item N of CopT) is not in EndBlanket
-- end add fix 83.3
end if -- character 1 of (text item N of CopT) is in StartBlanket
-- add if StartBlanket
if character 1 of (text item N of CopT) is not in StartBlanket then
delay 0.02
-- add fix 83.3
if last character of (text item N of CopT) is not in EndBlanket then
if (text item N of CopT) does not contain "/" and (text item N of CopT) does not contain "'" then
set targetText_NoSlash to (text item N of CopT) -- added for script 27
-- end add fix 83.3
set aText to do shell script "echo " & character 1 of targetText_NoSlash & " | tr [:lower:] [:upper:]"
repeat with x from 2 to length of targetText_NoSlash
delay 0.5
set bText to do shell script "echo " & character x of targetText_NoSlash & " | tr [:upper:] [:lower:]"
set aText to aText & bText
end repeat
end if
end if
-- add fix 83.3
if last character of (text item N of CopT) is in EndBlanket then
set sepText to (text item N of CopT)
set EndBlanketText to ""
repeat with x from 1 to (length of sepText) - 1
set EndBlanketText to EndBlanketText & character x of sepText
end repeat
repeat 1 times
if LowerCase contains EndBlanketText then
delay 0.02
set aText to do shell script "echo " & EndBlanketText & " | tr [:upper:] [:lower:] "
set aText to aText & last character of sepText
exit repeat
end if
delay 0.02
if UpperCase contains EndBlanketText then
delay 0.02
set aText to do shell script "echo " & EndBlanketText & " | tr [:lower:] [:upper:] "
set aText to aText & last character of sepText
exit repeat
end if
if UpperLower contains EndBlanketText then
delay 0.02
repeat with i from 1 to (count UpperLower)
if EndBlanketText is item i of UpperLower then
delay 0.02
set aText to item i of UpperLower
set aText to aText & last character of sepText
exit repeat
end if
end repeat
else -- EndBlanketText is not in aList
if (text item N of CopT) does not contain "'" then -- added for s27
set aText to do shell script "echo " & character 1 of sepText & " | tr [:lower:] [:upper:]"
repeat with x from 2 to ((length of sepText) - 1)
set bText to do shell script "echo " & character x of sepText & " | tr [:upper:] [:lower:]"
set aText to aText & bText
end repeat
set aText to aText & last character of sepText
end if -- if (text item N of CopT) does not contain "'" then -- added for s27
end if
end repeat -- repeat 1 times
end if -- last character of (text item N of CopT) is in EndBlanket
-- end add fix 83.3
end if -- character 1 of (text item N of CopT) is not in StartBlanket
end if -- length > 2
-- length = 1
if length of (text item N of CopT) is 1 then
if (text item N of CopT) is item 1 of igList then -- changed 2018-10-29_08.46.11
set aText to "|"
else
-- added 2018-10-29_08.46.11
if (text item N of CopT) is item 2 of igList then
set aText to "&"
-- end added 2018-10-29_08.46.11
else
set aText to do shell script "echo " & (text item N of CopT) & " | tr [:lower:] [:upper:]"
end if
end if
end if
-- add fix 83.3 spaces
if length of (text item N of CopT) is 0 then
if (text item N of CopT) is "" then
set aText to ""
end if
end if
-- end add fix 83.3 spaces
-- length = 2
if length of (text item N of CopT) is equal to 2 then
delay 0.02
-- add fix 83.3
if character 1 of (text item N of CopT) is in StartBlanket then
set sepText to (text item N of CopT)
set StartBlanketText to character 2 of sepText
repeat 1 times
if LowerCase contains StartBlanketText then
delay 0.02
set aText to do shell script "echo " & StartBlanketText & " | tr [:upper:] [:lower:] "
set aText to character 1 of (text item N of CopT) & aText
exit repeat
end if
delay 0.02
if UpperCase contains StartBlanketText then
delay 0.02
set aText to do shell script "echo " & StartBlanketText & " | tr [:lower:] [:upper:] "
set aText to character 1 of (text item N of CopT) & aText
exit repeat
end if
if UpperLower contains StartBlanketText then
delay 0.02
repeat with i from 1 to (count UpperLower)
if StartBlanketText is item i of UpperLower then
delay 0.02
set aText to item i of UpperLower
set aText to character 1 of (text item N of CopT) & aText
exit repeat
end if
end repeat
else -- StartBlanketText is not in aList
if (text item N of CopT) does not contain "'" then -- added for s27
set aText to do shell script "echo " & character 2 of sepText & " | tr [:lower:] [:upper:]"
set aText to character 1 of sepText & aText
end if
end if
end repeat -- repeat 1 times
end if -- character 1 of (text item N of CopT) is in StartBlanket
if last character of (text item N of CopT) is in EndBlanket then
set sepText to (text item N of CopT)
set EndBlanketText to character 1 of sepText
repeat 1 times
if LowerCase contains EndBlanketText then
delay 0.02
set aText to do shell script "echo " & EndBlanketText & " | tr [:upper:] [:lower:] "
set aText to aText & last character of sepText
exit repeat
end if
delay 0.02
if UpperCase contains EndBlanketText then
delay 0.02
set aText to do shell script "echo " & EndBlanketText & " | tr [:lower:] [:upper:] "
set aText to aText & last character of sepText
exit repeat
end if
if UpperLower contains EndBlanketText then
delay 0.02
repeat with i from 1 to (count UpperLower)
if EndBlanketText is item i of UpperLower then
delay 0.02
set aText to item i of UpperLower
set aText to aText & last character of sepText
exit repeat
end if
end repeat
else -- EndBlanketText is not in aList
if (text item N of CopT) does not contain "'" then -- added for s27
set aText to do shell script "echo " & character 1 of sepText & " | tr [:lower:] [:upper:]"
set aText to aText & last character of sepText
end if
end if
end repeat -- repeat 1 times
end if -- last character of (text item N of CopT) is in EndBlanket
if last character of (text item N of CopT) is not in EndBlanket then
delay 0.02
if character 1 of (text item N of CopT) is not in StartBlanket then
set aText to do shell script "echo " & character 1 of (text item N of CopT) & " | tr [:lower:] [:upper:]"
set bText to do shell script "echo " & character 2 of (text item N of CopT) & " | tr [:upper:] [:lower:]"
set aText to aText & bText
end if
end if
-- end add fix 83.3
end if -- length = 2
end if -- (text item N of CopT) is not in aList then
end if -- go_textwithApostrophes is 0 then
-- added - for script 27
if go_textwithApostrophes is 0 or done_endstartQuote_text_noSpaces is 0 then
-- end - added - for script 27
if LowerCase contains (text item N of CopT) then
if character 1 of (text item N of CopT) is not in StartBlanket then
delay 0.02
set aText to do shell script "echo " & text item N of CopT & " | tr [:upper:] [:lower:] "
end if
end if
delay 0.02
if UpperCase contains (text item N of CopT) then
if character 1 of (text item N of CopT) is not in StartBlanket then
delay 0.02
set aText to do shell script "echo " & text item N of CopT & " | tr [:lower:] [:upper:] "
end if
end if
if UpperLower contains (text item N of CopT) then
delay 0.02
set Fitem to text item N of CopT
repeat with i from 1 to (count UpperLower)
if Fitem is item i of UpperLower then
delay 0.02
set aText to item i of UpperLower
exit repeat
end if
end repeat
end if
end if -- go_textwithApostrophes is 0 then
delay 0.02
set myText1 to myText1 & aText & " "
end repeat
set the clipboard to myText1
delay 0.2
tell application "System Events"
keystroke "v" using command down
delay 0.02
key code 51
delay 0.02
repeat Lencopt times
key code 123 using shift down
delay 0.01
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment