Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

AppleScript Programming/Advanced Code List/Hide Application

From Wikibooks, open books for an open world
<AppleScript Programming |Advanced Code List

Sometimes, your script will need to do something that doesn't have an AppleEvent defined to accomplish the task. In this case, you may be able to script the task anyway by going through the graphical user-interface (GUI), using a technique calledGUI Scripting.

For example, to hide frontmost application, you can do the following:

tellapplication"System Events"tokeystroke"h"usingcommanddown

Then, to hide all background programs:

tellapplication"System Events"tokeystroke"h"using{commanddown,optiondown}

But when you want to hide aspecific application that is at background, it gets more tricky:

tellapplication"System Events"totellprocess"Safari"tosetvisibletofalse

Safari is just an example here.

I use iKey to run this script once Adium is deactivated:

tellapplication"Adium"setvCountertocounteverywindowifvCounter<2thentellapplication"System Events"totellprocess"Adium"tosetvisibletofalseendtell

Shortly explained, it hides Adium if there is only one window (like, buddy-list) open.

Next Page: 
Home: AppleScript Programming/Advanced Code List
Retrieved from "https://en.wikibooks.org/w/index.php?title=AppleScript_Programming/Advanced_Code_List/Hide_Application&oldid=4521244"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp