最近看过此主题的会员

查看: 374|回复: 0

[杂谈/讨论] 【字符替换】用-替换空格等

[复制链接]

97

主题

1023

积分

134 小时

在线时间

版主

Rank: 7Rank: 7Rank: 7Rank: 7

举世无双百里挑一攻无不克先锋旗帜优秀新人

发表于 2019-3-15 10:12:18 | 显示全部楼层 |阅读模式

[AppleScript] 纯文本查看 复制代码
tell application "System Events"
	--⌘C
	--⌘V
	key code 8 using command down
	set the_text to the clipboard
	--replace spaces
	repeat with replacement_ref in ¬
		{{"-", " "}, {"&", "&"}, {"<", "<"}, {">", ">"}, {"\"", """}}
		set {search_text, replacement_text} to replacement_ref
		set AppleScript's text item delimiters to search_text
		set temp_list to every text item of the_text
		set AppleScript's text item delimiters to replacement_text
		set the_text to temp_list as text
	end repeat
	set the clipboard to the_text
	--⌘V
	key code 9 using command down
end tell


suliveevil.github.io
www.better365.club/?fromuid=18
https://github.com/suliveevil/BetterAndBetter
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表