2016-09-23 52 views
1

我需要一个查看当前活动查找程序窗口路径并检查pahth是否包含名称的脚本。如果找到某个名字,那么另一个变量应该改为别的。Applescript:检查活动的查找程序窗口路径是否包含特定的名称以更改var

告诉应用程序 “发现者” 集currentDirectory所瞄准Finder窗口1 年底告诉 集myVar的,以 “东西” 集myVar2为 “XXX”

如果currentDirectory所包含myVar的接盘myVar2为“别的东西“

回答

0

请试试这个代码,让我知道它是否适合你:

set myVar1 to "Users" 
set myVar2 to "2" 
set myVar3 to "3" 

tell application "Finder" 
    set thePath to (POSIX path of (target of window 1 as alias)) 
    if thePath contains myVar1 then 
     set myVar2 to myVar3 
    end if 
end tell 
相关问题