Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.10 KB | None | 0 0
  1. -- user input
  2. set LowerCase to {"foobar", "to", "with", "in", "from", "and", "of", "by", "at"}
  3. set UpperCase to {"atom", "vlc"}
  4. set UpperLower to {"UMPlayer", "VideoSpec"}
  5. -- end of user input
  6. set aList to LowerCase & UpperCase & UpperLower
  7. -- new list
  8. set StartBlanket to {"(", "[", "<", "|", "{", "\""}
  9. set EndBlanket to {")", "]", ">", "|", "}", "\""}
  10. set igList to {"|", "&"} -- appended 2018-10-29_08.49.02
  11. set ApostrophesList to {"'ve", "'s", "'d", "'re", "n't", "'ll", "'m", "o'clock", "s'"}
  12. set prevTIDs to AppleScript's text item delimiters
  13. tell application "System Events"
  14. keystroke "c" using command down
  15. delay 0.7
  16. set CopT to (the clipboard as text)
  17. end tell
  18. set Lencopt to length of CopT
  19. -- added - 27.2
  20. if CopT contains "_" then
  21. set Go_Underscore to 1
  22. set listposUnderscore to {}
  23. repeat with i from 1 to Lencopt
  24. if character i of CopT is "_" then
  25. copy i to the end of listposUnderscore
  26. end if
  27. end repeat
  28. set prevTIDs to AppleScript's text item delimiters
  29. set AppleScript's text item delimiters to the "_" -- search _
  30. set the item_list to every text item of CopT -- original text
  31. set AppleScript's text item delimiters to the " " -- replace
  32. set CopT to the item_list as string
  33. set AppleScript's text item delimiters to prevTIDs
  34. else
  35. set Go_Underscore to 0
  36. end if
  37. -- end - added - 27.2
  38. set AppleScript's text item delimiters to {" "}
  39. set myText1 to ""
  40. repeat with N from 1 to (count text item of CopT)
  41. repeat with j from 1 to count ApostrophesList
  42. if (text item N of CopT) ends with item j of ApostrophesList then
  43. set textwithApostrophes to (text item N of CopT)
  44. set go_textwithApostrophes to 1
  45. exit repeat
  46. else
  47. set go_textwithApostrophes to 0
  48. end if -- (text item N of CopT) ends with item j of ApostrophesList then
  49. end repeat
  50. -- do 'text' -- no spaces
  51. if (last character of (text item N of CopT) ends with "'") and (first character of (text item N of CopT) starts with "'") then --con
  52. set done_endstartQuote_text_noSpaces to 1
  53. set targetText_endstartQuote_text to (text item N of CopT)
  54. set endchar_endstartQuote_text to (length of (text item N of CopT)) - 1
  55. set AppleScript's text item delimiters to prevTIDs
  56. set dothisText_check_aList to ((characters 2 thru endchar_endstartQuote_text of targetText_endstartQuote_text) as string)
  57.  
  58. if (length of dothisText_check_aList) is 1 then
  59. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
  60. set aText to first character of (text item N of CopT) & Done_dothisText_check_aList & last character of (text item N of CopT)
  61. end if -- (length of dothisText_check_aList) is 1 then
  62.  
  63. if (length of dothisText_check_aList) > 1 then
  64. if dothisText_check_aList is in aList then
  65.  
  66. if LowerCase contains dothisText_check_aList then
  67. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:upper:] [:lower:] "
  68. set aText to first character of (text item N of CopT) & Done_dothisText_check_aList & last character of (text item N of CopT)
  69. end if
  70.  
  71. if UpperCase contains dothisText_check_aList then
  72. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
  73. set aText to first character of (text item N of CopT) & Done_dothisText_check_aList & last character of (text item N of CopT)
  74. end if
  75.  
  76. if UpperLower contains dothisText_check_aList then
  77. -- delay 0.02
  78. repeat with i from 1 to (count UpperLower)
  79. if dothisText_check_aList is (item i of UpperLower) then
  80. -- delay 0.02
  81. set Done_dothisText_check_aList to (item i of UpperLower)
  82. exit repeat
  83. end if
  84. end repeat
  85. set aText to first character of (text item N of CopT) & Done_dothisText_check_aList & last character of (text item N of CopT)
  86. end if
  87.  
  88. else -- dothisText_check_aList is not in aList then -- targetText_endstartQuote_text -- (length of dothisText_check_aList) > 1
  89. set Done_dothisText_check_aList to do shell script "echo " & character 1 of dothisText_check_aList & " | tr [:lower:] [:upper:]"
  90.  
  91. repeat with x from 2 to (length of dothisText_check_aList)
  92. set bText to do shell script "echo " & character x of dothisText_check_aList & " | tr [:upper:] [:lower:]"
  93. set Done_dothisText_check_aList to Done_dothisText_check_aList & bText
  94. end repeat
  95. set aText to first character of (text item N of CopT) & Done_dothisText_check_aList & last character of (text item N of CopT)
  96. end if -- if dothisText_check_aList is in aList then
  97. end if -- if (length of dothisText_check_aList) > 1 then
  98. else -- of if: (last character of (text item N of CopT) ends with "'") and (first character of (text item N of CopT) starts with "'")
  99. set done_endstartQuote_text_noSpaces to 0
  100. end if
  101.  
  102. -- end - do 'text' -- no spaces
  103. if go_textwithApostrophes is 1 then
  104. set go_textwithApostrophes to 1
  105. if character 1 of (text item N of CopT) is not in StartBlanket then
  106. set AppleScript's text item delimiters to (item j of ApostrophesList)
  107. set dothisText to (text item 1 of textwithApostrophes)
  108. set AppleScript's text item delimiters to prevTIDs
  109. if (length of dothisText) is 0 then -- o'clock
  110. set aText to "O'Clock"
  111. end if
  112. if (length of dothisText) is 1 then
  113. set Done_dothisText to do shell script "echo " & character 1 of dothisText & " | tr [:lower:] [:upper:]"
  114. set aText to Done_dothisText & (item j of ApostrophesList)
  115. end if -- (length of dothisText) is 1 then
  116. -- delay 0.03
  117. if (length of dothisText) > 1 then
  118. if dothisText is in aList then -- in aList ?
  119. -- delay 0.02
  120. if LowerCase contains dothisText then
  121. set Done_dothisText to do shell script "echo " & dothisText & " | tr [:upper:] [:lower:] "
  122. set aText to Done_dothisText & (item j of ApostrophesList)
  123. end if
  124. -- delay 0.02
  125. if UpperCase contains dothisText then
  126. set Done_dothisText to do shell script "echo " & dothisText & " | tr [:lower:] [:upper:] "
  127. set aText to Done_dothisText & (item j of ApostrophesList)
  128. end if
  129. -- delay 0.02
  130. if UpperLower contains dothisText then
  131.  
  132. repeat with i from 1 to (count UpperLower)
  133. if dothisText is (item i of UpperLower) then
  134. -- delay 0.02
  135. set Done_dothisText to (item i of UpperLower)
  136. exit repeat
  137. end if
  138. end repeat
  139. set aText to Done_dothisText & (item j of ApostrophesList)
  140. end if
  141. else -- dothisText is NOT in aList then
  142.  
  143. set Done_dothisText to do shell script "echo " & character 1 of dothisText & " | tr [:lower:] [:upper:]"
  144. repeat with x from 2 to (length of dothisText)
  145. set bText to do shell script "echo " & character x of dothisText & " | tr [:upper:] [:lower:]"
  146. set Done_dothisText to Done_dothisText & bText
  147. end repeat
  148. set aText to Done_dothisText & (item j of ApostrophesList)
  149. end if -- dothisText is in aList then
  150. end if -- (length of dothisText) > 1 then
  151. end if -- if character 1 of (text item N of CopT) is not in StartBlanket then
  152.  
  153. if character 1 of (text item N of CopT) is in StartBlanket then
  154. set go_textwithApostrophes to 1
  155. set AppleScript's text item delimiters to (item j of ApostrophesList)
  156. set dothisText to (text item 1 of textwithApostrophes)
  157. set AppleScript's text item delimiters to prevTIDs
  158. if (length of dothisText) is 1 then
  159. set aText to character 1 of (text item N of CopT) & (item j of ApostrophesList)
  160. end if -- (length of dothisText) is 1 then
  161. if (length of dothisText) is 2 then -- character 1 of (text item N of CopT) is in StartBlanket
  162. set dothisText_check_aList to ((character 2 of dothisText) as string)
  163. if dothisText_check_aList is in aList then
  164. -- delay 0.02
  165. if LowerCase contains dothisText_check_aList then
  166. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:upper:] [:lower:] "
  167. set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
  168. end if
  169. -- delay 0.02
  170. if UpperCase contains dothisText_check_aList then
  171. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
  172. set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
  173. end if
  174. -- delay 0.02
  175. if UpperLower contains dothisText_check_aList then
  176. -- delay 0.02
  177. repeat with i from 1 to (count UpperLower)
  178. if dothisText_check_aList is (item i of UpperLower) then
  179. -- delay 0.02
  180. set Done_dothisText_check_aList to (item i of UpperLower)
  181. exit repeat
  182. end if
  183. end repeat
  184. set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
  185. end if
  186. else -- dothisText_check_aList is not in aList then - (length of dothisText) is 2
  187. set Done_dothisText to do shell script "echo " & character 2 of dothisText & " | tr [:lower:] [:upper:]"
  188. set aText to character 1 of (text item N of CopT) & Done_dothisText & (item j of ApostrophesList)
  189. end if -- dothisText_check_aList is in aList then
  190. end if -- if (length of dothisText) is 2 then
  191. if (length of dothisText) > 2 then -- character 1 of (text item N of CopT) is in StartBlanket
  192. set dothisText_check_aList to ((characters 2 thru (length of dothisText) of dothisText) as string)
  193. if dothisText_check_aList is in aList then
  194. -- delay 0.02
  195. if LowerCase contains dothisText_check_aList then
  196. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:upper:] [:lower:] "
  197. set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
  198. end if
  199. -- delay 0.02
  200. if UpperCase contains dothisText_check_aList then
  201. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
  202. set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
  203. end if
  204. -- delay 0.02
  205. if UpperLower contains dothisText_check_aList then
  206. -- delay 0.02
  207. repeat with i from 1 to (count UpperLower)
  208. if dothisText_check_aList is (item i of UpperLower) then
  209. -- delay 0.02
  210. set Done_dothisText_check_aList to (item i of UpperLower)
  211. exit repeat
  212. end if
  213. end repeat
  214. set aText to character 1 of (text item N of CopT) & Done_dothisText_check_aList & (item j of ApostrophesList)
  215. end if
  216. else -- dothisText_check_aList is NOT in aList
  217. set Done_dothisText to do shell script "echo " & character 2 of dothisText & " | tr [:lower:] [:upper:]"
  218. repeat with x from 3 to (length of dothisText)
  219. set bText to do shell script "echo " & character x of dothisText & " | tr [:upper:] [:lower:]"
  220. set Done_dothisText to Done_dothisText & bText
  221. end repeat
  222. set aText to character 1 of (text item N of CopT) & Done_dothisText & (item j of ApostrophesList)
  223. end if -- dothisText_check_aList is in aList then
  224. end if -- (length of dothisText) > 2 then
  225. end if -- if character 1 of (text item N of CopT) is in StartBlanket then
  226. end if -- go_textwithApostrophes is 1 then
  227. -- added - for script 27
  228. -- Apostrophes + endblanket
  229. -- set AppleScript's text item delimiters to {" "}
  230. -- delay 0.02
  231. if last character of (text item N of CopT) is in EndBlanket then
  232. -- delay 0.02
  233. if first character of (text item N of CopT) is not in StartBlanket then
  234. -- delay 0.02
  235. set targetText to (text item N of CopT)
  236. -- delay 0.03
  237. set AppleScript's text item delimiters to prevTIDs
  238. set endchar_number to (length of targetText) - 1
  239. set delete_EndBlanket_Text to (characters 1 thru endchar_number of targetText) as string
  240. repeat with j from 1 to count ApostrophesList
  241. if delete_EndBlanket_Text ends with item j of ApostrophesList then
  242. set delete_EndBlanket_Text_Apostrophes to delete_EndBlanket_Text
  243. set go_textwithApostrophes to 1
  244. exit repeat
  245. else
  246. set go_textwithApostrophes to 0
  247. end if
  248. end repeat
  249. if go_textwithApostrophes is 1 then -- if last character of (text item N of CopT) is in EndBlanket then
  250. set AppleScript's text item delimiters to item j of ApostrophesList
  251. set dothisText_check_aList to text item 1 of delete_EndBlanket_Text_Apostrophes -- firefox's) >> firefox
  252. set AppleScript's text item delimiters to " " -- added - can't get text item
  253. if (length of dothisText_check_aList) is 0 then -- o'clock
  254. set aText to "O'Clock" & (last character of targetText)
  255. end if
  256. if (length of dothisText_check_aList) is 1 then
  257. set Done_dothisText_check_aList to do shell script "echo " & character 1 of dothisText_check_aList & " | tr [:lower:] [:upper:]"
  258. set aText to Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
  259. end if
  260. if (length of dothisText_check_aList) > 1 then
  261. if dothisText_check_aList is in aList then -- in aList
  262. -- delay 0.02
  263. if LowerCase contains dothisText_check_aList then
  264. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:upper:] [:lower:] "
  265. set aText to Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
  266. end if
  267. -- delay 0.02
  268. if UpperCase contains dothisText_check_aList then
  269. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
  270. set aText to Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
  271. end if
  272. -- delay 0.02
  273. if UpperLower contains dothisText_check_aList then
  274. -- delay 0.02
  275. repeat with i from 1 to (count UpperLower)
  276. if dothisText_check_aList is (item i of UpperLower) then
  277. -- delay 0.02
  278. set Done_dothisText_check_aList to (item i of UpperLower)
  279. exit repeat
  280. end if
  281. end repeat
  282. set aText to Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
  283. end if
  284. else -- dothisText_check_aList is NOT in aList then
  285. -- delay 0.03
  286. set Done_dothisText_check_aList to do shell script "echo " & character 1 of dothisText_check_aList & " | tr [:lower:] [:upper:]"
  287. repeat with x from 2 to (length of dothisText_check_aList)
  288. -- delay 0.02
  289. set bText to do shell script "echo " & character x of dothisText_check_aList & " | tr [:upper:] [:lower:]"
  290. set Done_dothisText_check_aList to Done_dothisText_check_aList & bText
  291. end repeat
  292. set aText to Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
  293. end if -- if dothisText_check_aList is in aList then
  294. end if -- if (length of dothisText_check_aList) > 1 then
  295. end if -- if go_textwithApostrophes is 1 -- if last character of (text item N of CopT) is in EndBlanket then
  296. end if -- if first character of (text item N of CopT) is not in StartBlanket then
  297. end if -- if last character of (text item N of CopT) is in EndBlanket then
  298. -- end - added - for script 27
  299. -- for script 27
  300. -- startblanket & textwithApostrophes & endblanket
  301. -- delay 0.02
  302. if last character of (text item N of CopT) is in EndBlanket then
  303. -- delay 0.02
  304. if first character of (text item N of CopT) is in StartBlanket then
  305. -- delay 0.02
  306. set targetText to (text item N of CopT)
  307. -- delay 0.03
  308. set AppleScript's text item delimiters to prevTIDs
  309. set endchar_number to (length of targetText) - 1
  310. set delete_StartEndBlanket_Text to (characters 2 thru endchar_number of targetText) as string
  311. repeat with j from 1 to count ApostrophesList
  312. if delete_StartEndBlanket_Text ends with item j of ApostrophesList then
  313. set delete_StartEndBlanket_Text_Apostrophes to delete_StartEndBlanket_Text
  314. set go_textwithApostrophes to 1
  315. exit repeat
  316. else
  317. set go_textwithApostrophes to 0
  318. end if
  319. end repeat
  320. if go_textwithApostrophes is 1 then
  321. set AppleScript's text item delimiters to (item j of ApostrophesList)
  322. set dothisText_check_aList to text item 1 of delete_StartEndBlanket_Text_Apostrophes
  323. -- delay 0.02
  324. set AppleScript's text item delimiters to " " -- added - can't get text item
  325. if (length of dothisText_check_aList) is 0 then -- o'clock
  326. set aText to "O'Clock" & (last character of targetText)
  327. end if
  328. if (length of dothisText_check_aList) is 1 then
  329. set Done_dothisText_check_aList to do shell script "echo " & character 1 of dothisText_check_aList & " | tr [:lower:] [:upper:]"
  330. set aText to (first character of targetText) & Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
  331. end if
  332. if (length of dothisText_check_aList) > 1 then
  333. if dothisText_check_aList is in aList then -- in aList
  334. -- delay 0.02
  335. if LowerCase contains dothisText_check_aList then
  336. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:upper:] [:lower:] "
  337. set aText to (first character of targetText) & Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
  338. end if
  339. -- delay 0.02
  340. if UpperCase contains dothisText_check_aList then
  341. set Done_dothisText_check_aList to do shell script "echo " & dothisText_check_aList & " | tr [:lower:] [:upper:] "
  342. set aText to (first character of targetText) & Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
  343. end if
  344. -- delay 0.02
  345. if UpperLower contains dothisText_check_aList then
  346. -- delay 0.02
  347. repeat with i from 1 to (count UpperLower)
  348. if dothisText_check_aList is (item i of UpperLower) then
  349. -- delay 0.02
  350. set Done_dothisText_check_aList to (item i of UpperLower)
  351. exit repeat
  352. end if
  353. end repeat
  354. set aText to (first character of targetText) & Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
  355. end if
  356. else -- dothisText_check_aList is NOT in aList then
  357. -- delay 0.03
  358. set Done_dothisText_check_aList to do shell script "echo " & character 1 of dothisText_check_aList & " | tr [:lower:] [:upper:]"
  359. repeat with x from 2 to (length of dothisText_check_aList)
  360. -- delay 0.02
  361. set bText to do shell script "echo " & character x of dothisText_check_aList & " | tr [:upper:] [:lower:]"
  362. set Done_dothisText_check_aList to Done_dothisText_check_aList & bText
  363. end repeat
  364. set aText to (first character of targetText) & Done_dothisText_check_aList & (item j of ApostrophesList) & (last character of targetText)
  365. end if -- if dothisText_check_aList is in aList then
  366. end if -- if (length of dothisText_check_aList) > 1 then
  367. end if
  368. end if
  369. end if
  370. -- end - startblanket & textwithApostrophes & endblanket
  371. -- end - for script 27
  372. -- delay 0.03
  373. set AppleScript's text item delimiters to {" "}
  374. if go_textwithApostrophes is 0 or done_endstartQuote_text_noSpaces is 0 then
  375. -- delay 0.03
  376. if (text item N of CopT) is not in aList then
  377. -- delay 0.05
  378. -- length > 2
  379. if length of (text item N of CopT) is greater than 2 then
  380. -- add fix 83.3
  381. -- SlashText - word with one Slash (ab/cd) is supported
  382. if (text item N of CopT) contains "/" then
  383. if character 1 of (text item N of CopT) is not "/" then
  384. set sepText to (text item N of CopT)
  385. repeat with x from 1 to length of sepText
  386. if character x of sepText is "/" then
  387. set posSlash to x
  388. exit repeat
  389. end if
  390. end repeat
  391. set numCharEndSlashText to posSlash - 1
  392. set EndSlashText to ""
  393. repeat with x from 1 to numCharEndSlashText
  394. set EndSlashText to EndSlashText & character x of sepText
  395. end repeat
  396. set StartSlashText to ""
  397. repeat with x from (posSlash + 1) to length of sepText
  398. set StartSlashText to StartSlashText & character x of sepText
  399. end repeat
  400. -- delay 0.02
  401. repeat 1 times
  402. if LowerCase contains EndSlashText then
  403. -- delay 0.02
  404. set slashText1 to do shell script "echo " & EndSlashText & " | tr [:upper:] [:lower:] "
  405. exit repeat
  406. end if
  407. -- delay 0.02
  408. if UpperCase contains EndSlashText then
  409. -- delay 0.02
  410. set slashText1 to do shell script "echo " & EndSlashText & " | tr [:lower:] [:upper:] "
  411. exit repeat
  412. end if
  413. if UpperLower contains EndSlashText then
  414. -- delay 0.02
  415. repeat with i from 1 to (count UpperLower)
  416. if EndSlashText is item i of UpperLower then
  417. -- delay 0.02
  418. set slashText1 to item i of UpperLower
  419. exit repeat
  420. end if
  421. end repeat
  422. else -- EndSlashText is not in aList
  423. set slashText1 to do shell script "echo " & character 1 of EndSlashText & " | tr [:lower:] [:upper:]"
  424. repeat with x from 2 to (length of EndSlashText)
  425. set bText to do shell script "echo " & character x of EndSlashText & " | tr [:upper:] [:lower:]"
  426. set slashText1 to slashText1 & bText
  427. end repeat
  428. end if
  429. end repeat -- repeat 1 times
  430. repeat 1 times
  431. -- delay 0.02
  432. if LowerCase contains StartSlashText then
  433. set slashText2 to do shell script "echo " & StartSlashText & " | tr [:upper:] [:lower:] "
  434. exit repeat
  435. end if
  436. -- delay 0.02
  437. if UpperCase contains StartSlashText then
  438. -- delay 0.02
  439. set slashText2 to do shell script "echo " & StartSlashText & " | tr [:lower:] [:upper:] "
  440. exit repeat
  441. end if
  442. -- delay 0.02
  443. if UpperLower contains StartSlashText then
  444. repeat with i from 1 to (count UpperLower)
  445. -- delay 0.02
  446. if StartSlashText is item i of UpperLower then
  447. -- delay 0.02
  448. set slashText2 to item i of UpperLower
  449. exit repeat
  450. end if
  451. end repeat
  452. else -- StartSlashText is not in aList
  453. set slashText2 to do shell script "echo " & character 1 of StartSlashText & " | tr [:lower:] [:upper:]"
  454. repeat with x from 2 to (length of StartSlashText)
  455. set bText to do shell script "echo " & character x of StartSlashText & " | tr [:upper:] [:lower:]"
  456. set slashText2 to slashText2 & bText
  457. end repeat
  458. end if
  459. end repeat -- repeat 1 times
  460. set aText to slashText1 & "/" & slashText2
  461. end if
  462. end if
  463. -- end add fix 83.3
  464. -- delay 0.05
  465. if character 1 of (text item N of CopT) is in StartBlanket then
  466. -- delay 0.05
  467. if last character of (text item N of CopT) is in EndBlanket then
  468. -- delay 0.02
  469. -- change add - fix 83.3 InBlanketText - (text item N of CopT) is not in aList
  470. set sepText to (text item N of CopT)
  471. set InBlanketText to ""
  472. repeat with x from 2 to (length of sepText) - 1
  473. set InBlanketText to InBlanketText & character x of sepText
  474. end repeat
  475. repeat 1 times
  476. -- delay 0.02
  477. if LowerCase contains InBlanketText then
  478. -- delay 0.02
  479. set aText to do shell script "echo " & InBlanketText & " | tr [:upper:] [:lower:] "
  480. set aText to character 1 of (text item N of CopT) & aText & last character of sepText
  481. exit repeat
  482. end if
  483. -- delay 0.02
  484. if UpperCase contains InBlanketText then
  485. -- delay 0.02
  486. set aText to do shell script "echo " & InBlanketText & " | tr [:lower:] [:upper:] "
  487. set aText to character 1 of (text item N of CopT) & aText & last character of sepText
  488. exit repeat
  489. end if
  490. if UpperLower contains InBlanketText then
  491. -- delay 0.02
  492. repeat with i from 1 to (count UpperLower)
  493. if InBlanketText is item i of UpperLower then
  494. -- delay 0.02
  495. set aText to item i of UpperLower
  496. set aText to character 1 of (text item N of CopT) & aText & last character of sepText
  497. exit repeat
  498. end if
  499. end repeat
  500. else -- StartBlanketText is not in aList
  501. if (text item N of CopT) does not contain "'" then -- added for s27
  502. set aText to do shell script "echo " & character 2 of sepText & " | tr [:lower:] [:upper:]"
  503. repeat with x from 3 to (length of sepText) - 1
  504. set bText to do shell script "echo " & character x of sepText & " | tr [:upper:] [:lower:]"
  505. set aText to aText & bText
  506. end repeat
  507. set aText to character 1 of sepText & aText & last character of sepText
  508. end if
  509. end if
  510. end repeat -- repeat 1 times
  511. -- end change add - fix 83.3 InBlanketText - (text item N of CopT) is not in aList
  512. end if
  513. -- add fix 83.3
  514. if last character of (text item N of CopT) is not in EndBlanket then
  515. set sepText to (text item N of CopT)
  516. set StartBlanketText to ""
  517. repeat with x from 2 to length of sepText
  518. set StartBlanketText to StartBlanketText & character x of sepText
  519. end repeat
  520. repeat 1 times
  521. if LowerCase contains StartBlanketText then
  522. -- delay 0.02
  523. set aText to do shell script "echo " & StartBlanketText & " | tr [:upper:] [:lower:] "
  524. set aText to character 1 of (text item N of CopT) & aText
  525. exit repeat
  526. end if
  527. -- delay 0.02
  528. if UpperCase contains StartBlanketText then
  529. -- delay 0.02
  530. set aText to do shell script "echo " & StartBlanketText & " | tr [:lower:] [:upper:] "
  531. set aText to character 1 of (text item N of CopT) & aText
  532. exit repeat
  533. end if
  534. if UpperLower contains StartBlanketText then
  535. -- delay 0.02
  536. repeat with i from 1 to (count UpperLower)
  537. if StartBlanketText is item i of UpperLower then
  538. -- delay 0.02
  539. set aText to item i of UpperLower
  540. set aText to character 1 of (text item N of CopT) & aText
  541. exit repeat
  542. end if
  543. end repeat
  544. else -- StartBlanketText is not in aList
  545. if (text item N of CopT) does not contain "'" then -- added for s27
  546. set aText to do shell script "echo " & character 2 of sepText & " | tr [:lower:] [:upper:]"
  547. repeat with x from 3 to length of sepText
  548. set bText to do shell script "echo " & character x of sepText & " | tr [:upper:] [:lower:]"
  549. set aText to aText & bText
  550. end repeat
  551. set aText to character 1 of sepText & aText
  552. end if -- added for s27
  553. end if
  554. end repeat -- repeat 1 times
  555. end if -- last character of (text item N of CopT) is not in EndBlanket
  556. -- end add fix 83.3
  557. end if -- character 1 of (text item N of CopT) is in StartBlanket
  558. -- add if StartBlanket
  559. if character 1 of (text item N of CopT) is not in StartBlanket then
  560. -- delay 0.02
  561. -- add fix 83.3
  562. if last character of (text item N of CopT) is not in EndBlanket then
  563. if (text item N of CopT) does not contain "/" and (text item N of CopT) does not contain "'" then
  564. set targetText_NoSlash to (text item N of CopT) -- added for script 27
  565. -- end add fix 83.3
  566. set aText to do shell script "echo " & character 1 of targetText_NoSlash & " | tr [:lower:] [:upper:]"
  567. repeat with x from 2 to length of targetText_NoSlash
  568. -- delay 0.02
  569. set bText to do shell script "echo " & character x of targetText_NoSlash & " | tr [:upper:] [:lower:]"
  570. set aText to aText & bText
  571. end repeat
  572. end if
  573. end if
  574. -- add fix 83.3
  575. if last character of (text item N of CopT) is in EndBlanket then
  576. set sepText to (text item N of CopT)
  577. set EndBlanketText to ""
  578. repeat with x from 1 to (length of sepText) - 1
  579. set EndBlanketText to EndBlanketText & character x of sepText
  580. end repeat
  581. repeat 1 times
  582. if LowerCase contains EndBlanketText then
  583. -- delay 0.02
  584. set aText to do shell script "echo " & EndBlanketText & " | tr [:upper:] [:lower:] "
  585. set aText to aText & last character of sepText
  586. exit repeat
  587. end if
  588. -- delay 0.02
  589. if UpperCase contains EndBlanketText then
  590. -- delay 0.02
  591. set aText to do shell script "echo " & EndBlanketText & " | tr [:lower:] [:upper:] "
  592. set aText to aText & last character of sepText
  593. exit repeat
  594. end if
  595. if UpperLower contains EndBlanketText then
  596. -- delay 0.02
  597. repeat with i from 1 to (count UpperLower)
  598. if EndBlanketText is item i of UpperLower then
  599. -- delay 0.02
  600. set aText to item i of UpperLower
  601. set aText to aText & last character of sepText
  602. exit repeat
  603. end if
  604. end repeat
  605. else -- EndBlanketText is not in aList
  606. if (text item N of CopT) does not contain "'" then -- added for s27
  607. set aText to do shell script "echo " & character 1 of sepText & " | tr [:lower:] [:upper:]"
  608. repeat with x from 2 to ((length of sepText) - 1)
  609. set bText to do shell script "echo " & character x of sepText & " | tr [:upper:] [:lower:]"
  610. set aText to aText & bText
  611. end repeat
  612. set aText to aText & last character of sepText
  613. end if -- if (text item N of CopT) does not contain "'" then -- added for s27
  614. end if
  615. end repeat -- repeat 1 times
  616. end if -- last character of (text item N of CopT) is in EndBlanket
  617. -- end add fix 83.3
  618. end if -- character 1 of (text item N of CopT) is not in StartBlanket
  619. end if -- length > 2
  620. -- length = 1
  621. if length of (text item N of CopT) is 1 then
  622. if (text item N of CopT) is item 1 of igList then -- changed 2018-10-29_08.46.11
  623. set aText to "|"
  624. else
  625. -- added 2018-10-29_08.46.11
  626. if (text item N of CopT) is item 2 of igList then
  627. set aText to "&"
  628. -- end added 2018-10-29_08.46.11
  629. else
  630. set aText to do shell script "echo " & (text item N of CopT) & " | tr [:lower:] [:upper:]"
  631. end if
  632. end if
  633. end if
  634. -- add fix 83.3 spaces
  635. if length of (text item N of CopT) is 0 then
  636. if (text item N of CopT) is "" then
  637. set aText to ""
  638. end if
  639. end if
  640. -- end add fix 83.3 spaces
  641. -- length = 2
  642. if length of (text item N of CopT) is equal to 2 then
  643. -- delay 0.02
  644. -- add fix 83.3
  645. if character 1 of (text item N of CopT) is in StartBlanket then
  646. set sepText to (text item N of CopT)
  647. set StartBlanketText to character 2 of sepText
  648. repeat 1 times
  649. if LowerCase contains StartBlanketText then
  650. -- delay 0.02
  651. set aText to do shell script "echo " & StartBlanketText & " | tr [:upper:] [:lower:] "
  652. set aText to character 1 of (text item N of CopT) & aText
  653. exit repeat
  654. end if
  655. -- delay 0.02
  656. if UpperCase contains StartBlanketText then
  657. -- delay 0.02
  658. set aText to do shell script "echo " & StartBlanketText & " | tr [:lower:] [:upper:] "
  659. set aText to character 1 of (text item N of CopT) & aText
  660. exit repeat
  661. end if
  662. if UpperLower contains StartBlanketText then
  663. -- delay 0.02
  664. repeat with i from 1 to (count UpperLower)
  665. if StartBlanketText is item i of UpperLower then
  666. -- delay 0.02
  667. set aText to item i of UpperLower
  668. set aText to character 1 of (text item N of CopT) & aText
  669. exit repeat
  670. end if
  671. end repeat
  672. else -- StartBlanketText is not in aList
  673. if (text item N of CopT) does not contain "'" then -- added for s27
  674. set aText to do shell script "echo " & character 2 of sepText & " | tr [:lower:] [:upper:]"
  675. set aText to character 1 of sepText & aText
  676. end if
  677. end if
  678. end repeat -- repeat 1 times
  679. end if -- character 1 of (text item N of CopT) is in StartBlanket
  680. if last character of (text item N of CopT) is in EndBlanket then
  681. set sepText to (text item N of CopT)
  682. set EndBlanketText to character 1 of sepText
  683. repeat 1 times
  684. if LowerCase contains EndBlanketText then
  685. -- delay 0.02
  686. set aText to do shell script "echo " & EndBlanketText & " | tr [:upper:] [:lower:] "
  687. set aText to aText & last character of sepText
  688. exit repeat
  689. end if
  690. -- delay 0.02
  691. if UpperCase contains EndBlanketText then
  692. -- delay 0.02
  693. set aText to do shell script "echo " & EndBlanketText & " | tr [:lower:] [:upper:] "
  694. set aText to aText & last character of sepText
  695. exit repeat
  696. end if
  697. if UpperLower contains EndBlanketText then
  698. -- delay 0.02
  699. repeat with i from 1 to (count UpperLower)
  700. if EndBlanketText is item i of UpperLower then
  701. -- delay 0.02
  702. set aText to item i of UpperLower
  703. set aText to aText & last character of sepText
  704. exit repeat
  705. end if
  706. end repeat
  707. else -- EndBlanketText is not in aList
  708. if (text item N of CopT) does not contain "'" then -- added for s27
  709. set aText to do shell script "echo " & character 1 of sepText & " | tr [:lower:] [:upper:]"
  710. set aText to aText & last character of sepText
  711. end if
  712. end if
  713. end repeat -- repeat 1 times
  714. end if -- last character of (text item N of CopT) is in EndBlanket
  715. if last character of (text item N of CopT) is not in EndBlanket then
  716. -- delay 0.02
  717. if character 1 of (text item N of CopT) is not in StartBlanket then
  718. set aText to do shell script "echo " & character 1 of (text item N of CopT) & " | tr [:lower:] [:upper:]"
  719. set bText to do shell script "echo " & character 2 of (text item N of CopT) & " | tr [:upper:] [:lower:]"
  720. set aText to aText & bText
  721. end if
  722. end if
  723. -- end add fix 83.3
  724. end if -- length = 2
  725. end if -- (text item N of CopT) is not in aList then
  726. end if -- go_textwithApostrophes is 0 then
  727. -- added - for script 27
  728. if go_textwithApostrophes is 0 or done_endstartQuote_text_noSpaces is 0 then
  729. -- end - added - for script 27
  730. if LowerCase contains (text item N of CopT) then
  731. if character 1 of (text item N of CopT) is not in StartBlanket then
  732. -- delay 0.02
  733. set aText to do shell script "echo " & text item N of CopT & " | tr [:upper:] [:lower:] "
  734. end if
  735. end if
  736. -- delay 0.02
  737. if UpperCase contains (text item N of CopT) then
  738. if character 1 of (text item N of CopT) is not in StartBlanket then
  739. -- delay 0.02
  740. set aText to do shell script "echo " & text item N of CopT & " | tr [:lower:] [:upper:] "
  741. end if
  742. end if
  743. if UpperLower contains (text item N of CopT) then
  744. -- delay 0.02
  745. set Fitem to text item N of CopT
  746. repeat with i from 1 to (count UpperLower)
  747. if Fitem is item i of UpperLower then
  748. -- delay 0.02
  749. set aText to item i of UpperLower
  750. exit repeat
  751. end if
  752. end repeat
  753. end if
  754. end if -- go_textwithApostrophes is 0 then
  755. -- delay 0.02
  756. set myText1 to myText1 & aText & " "
  757. end repeat
  758. if Go_Underscore is 0 then -- added - 27.2
  759. set the clipboard to myText1
  760. end if -- end - added - 27.2
  761. if Go_Underscore is 1 then
  762. set myText2 to characters of myText1 -- make list of chars
  763.  
  764. repeat with i from 1 to count listposUnderscore
  765. set item (item i of listposUnderscore) of myText2 to "_"
  766. end repeat
  767.  
  768. set astid to AppleScript's text item delimiters
  769. set AppleScript's text item delimiters to ""
  770. set myText3 to myText2 as text
  771. set AppleScript's text item delimiters to astid
  772. set the clipboard to myText3
  773. end if
  774. delay 0.2
  775. tell application "System Events"
  776. keystroke "v" using command down
  777. delay 0.02
  778. key code 51
  779. delay 0.02
  780. repeat Lencopt times
  781. key code 123 using shift down
  782. delay 0.01
  783. end repeat
  784. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement