开发者

How do I get properties from text document

开发者 https://www.devze.com 2023-02-12 05:19 出处:网络
I want to make an Applescript that gets a text from a text-document like this: property fooBar : [insert string from text document]

I want to make an Applescript that gets a text from a text-document like this:

property fooBar : [insert string from text document]

tell application "Terminal"
    set currentTab to do script "e开发者_如何学运维cho" & fooBar
end tell

How do I do this?


Although I don't quite understand exactly what you're trying to do, I think you're attempting to use the contents of a text document to set the title of a Terminal tab. If that's the case, this will do so, you don't need a call to do shell script.

property foo : missing value

set fileRef to open for access (alias "Aslan:Users:chuck:Desktop:file.txt")
set foo to read fileRef
close access fileRef

tell application "Terminal" to set custom title of selected tab of window 1 to foo

Note that if that's all you want to do, the property line isn't needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消