OS X 10.5 için herhangi bir uygulamanın Yardım menüsündeki Arama kutusuna odaklanan bir komut dosyası var. Anahtar bir kombinasyona sahibim ve Spotlight gibi, senaryoyu çalıştırdığımda açılmasını istiyorum. Bu yüzden, arama kutusunun zaten yazmaya odaklanmış olup olmadığını tespit etmek istiyorum ve eğer öyleyse, Yardım menüsünü tıklamak yerine Esc yazın.El kitabında, bir menü öğesinin seçilip/odaklandığını nasıl anlarım?
tell application "System Events"
tell (first process whose frontmost is true)
set helpMenuItem to menu bar item "Help" of menu bar 1
click helpMenuItem
end tell
end tell
Ve böyle bir şey düşünüyorum: o şimdi haliyle Burada
scripttell application "System Events"
tell (first process whose frontmost is true)
set helpMenuItem to menu bar item "Help" of menu bar 1
set searchBox to menu item 1 of menu of helpMenuItem
if (searchBox's focused) = true then
key code 53 -- type esc
else
click helpMenuItem
end if
end tell
end tell
... ama bu hatayı alıyorum:
Can’t get focused of {menu item 1 of menu "Help" of menu bar item "Help" of menu bar 1 of application process "Script Editor" of application "System Events"}.
Arama kutunun zaten odaklanmış olup olmadığını algılamak için komut dosyamı alabilmemin bir yolu var mı?
Ben working around it benim sorun çözüldü. Yine de bir menü öğesinin seçilip seçilmediğini nasıl kontrol edeceğimi bilmiyorum, bu yüzden bu konuyu açık bırakacağım.
'searchField'ın odaklandığı doğruysa, o zaman .. bu gerçekten apple script sözdizimi mi? bir kesme işareti ekleyerek? – abbood