将值作为参数传递给处理程序
pass value as argument into handler
将 list view
作为参数传递给函数的正确方法是什么?如果我在函数内部设置 view_type 它起作用,但如果我在函数外部设置它,它就不起作用。
#works
the_function()
on the_function()
tell application "finder"
set view_type to list view
set current view of window 1 to view_type
end tell
end the_function
#fails
set view_type to list view
the_function(view_type)
on the_function(view_type)
tell application "finder"
set current view of window 1 to view_type
end tell
end the_function
只有 Finder 知道“列表视图”是什么。
尝试:
tell application "Finder" to set view_type to list view
the_function(view_type)
on the_function(view_type)
tell application "Finder"
set current view of window 1 to view_type
end tell
end the_function
你也可以像这样棘手:
the_function("lsvw" as constant) # lsvw, clvw, flvw, or icnv .
on the_function(view_type)
tell application "Finder"
set current view of window 1 to view_type
end tell
end the_function
将 list view
作为参数传递给函数的正确方法是什么?如果我在函数内部设置 view_type 它起作用,但如果我在函数外部设置它,它就不起作用。
#works
the_function()
on the_function()
tell application "finder"
set view_type to list view
set current view of window 1 to view_type
end tell
end the_function
#fails
set view_type to list view
the_function(view_type)
on the_function(view_type)
tell application "finder"
set current view of window 1 to view_type
end tell
end the_function
只有 Finder 知道“列表视图”是什么。
尝试:
tell application "Finder" to set view_type to list view
the_function(view_type)
on the_function(view_type)
tell application "Finder"
set current view of window 1 to view_type
end tell
end the_function
你也可以像这样棘手:
the_function("lsvw" as constant) # lsvw, clvw, flvw, or icnv .
on the_function(view_type)
tell application "Finder"
set current view of window 1 to view_type
end tell
end the_function