-- 重置Studio 3T display dialog"重置Studio 3T,请先导出链接信息,重置后链接信息会丢失。已导出请选择Next。"with title "Reset 3T" buttons { "Cancel" , "Next" } default button 2with icon 1 giving up after10 if button returned ofresultis"Next"then my reset3T() endif -- 重置后需重启系统生效 on reset3T() set folderPaths to {"~/Library/Preferences/3t.*", "~/.3T", "~/.cache/ftuwWNWoJl-STeZhVGHKkQ--"} set separator tolinefeed-- 换行符
set concatenatedString to"请先关闭Studio 3T" & separator set concatenatedString to"将删除以下文件夹:" & separator repeatwith aPath in folderPaths set concatenatedString to concatenatedString & aPath & separator endrepeat
-- 清除最后一个换行符 iflengthof concatenatedString > lengthof separator then set concatenatedString totext1thru -((lengthof separator) + 1) of concatenatedString endif
display dialog concatenatedString with title "Reset 3T" buttons { "Cancel" , "Reset" } default button 2with icon 1 giving up after10 if button returned ofresultis"Reset"then repeatwith aPath in folderPaths try do shell script"rm -rf " & aPath with administrator privileges endtry endrepeat display dialog"重置完成,需重启系统生效,重启之前不要打开Studio3T,是否重启系统?"with title "Reset 3T" buttons { "Restart later", "OK" } default button 1with icon 1 giving up after10 if button returned ofresultis"OK"then do shell script"sudo shutdown -r now"with administrator privileges endif endif end reset3T