Watching Folders
- Organizer and idea spaces enhancements such as zooming both split views simultaneously; sorting idea spaces by descending title; new Organizer headings and font cleanup. Curio Standard now includes Automatic Backups, which was formally a Pro-only feature. (Pro supports per-project backup customizations.) Major performance and technical improvements.
- Aug 20, 2015 Introduced with OS X Lion, the Launchpad on your Mac allows you to organize and manage your installed applications just like you would on an iPad or iPhone. Launchpad also allows you to see apps currently downloading from the Mac App Store, and you can delete apps from it.
- Arranging windows on Mac OS X is tedious and imprecise. Even after dragging, pulling, and, re-dragging windows, you end up with inefficient use of your available screen real estate. SizeUp will help you quickly resize and position your windows to make optimal use of.
Chronos LC, the folks behind the StickBrain product for Mac OS X, has unveiled a new product tailored to Apple's new operating system: Personal Organizer 4.0, which integrates a calendar, address.
The ability to watch folders and take action on incoming items is a powerful automation technique that enables the creation of fully unattended workflows. A watched folder might be used, for example, to watermark incoming photos, convert them to PDF, and email them to clients for review. Many companies set up script servers—dedicated robot machines that watch folders and process detected items, allowing employees to offload tedious and repetitious work in order to focus on other important tasks.
In OS X, there are two primary ways to set up scripting-based watched folders: folder actions and stay open script apps.
Using Folder Actions to Watch Folders
Folder actions is a feature in OS X that lets you connect scripts to folders on your Mac. A folder action script includes one or more event handlers that run in response to certain events, such as opening, closing, or adding items to the connected folder. With folder actions, you can create automated workflows that:
Notify you when new files and folders arrive in a folder
Notify you when existing files and folders are removed from a folder
Perform processing of newly detected files and folders
Initiate any automated task when a new file or folder is detected
Adjust or reset the view properties of a folder’s window when it’s opened, closed, or resized
Write a Folder Action Script
The event handlers supported by folder actions are defined in the Standard Additions scripting addition that comes with OS X. They are:
Folder event | Event handler | Parameters |
---|---|---|
Items—files or folders—are added to the folder |
|
|
Items are removed from the folder |
|
|
The folder is opened in a new Finder window |
|
|
The window of a folder is closed |
|
|
The window of a folder is moved |
|
|
Create a Script Editor document.
Add one or more folder action event handlers to the document.
Save the document as a compiled script to one of the following folders:
/Library/Scripts/Folder Action Scripts/
—The script can be used by any user.~/Library/Scripts/Folder Action Scripts/
—The script can be used by the current user only.
The following examples demonstrate how to use different folder action event handlers.
APPLESCRIPT
Listing 18-1AppleScript: Example of theopening folder
event handlerMac Os X Applescript Organizer Software Downloads
on opening folder theAttachedFolder
-- Get the name of the attached folder
tell application 'Finder'
set theName to name of theAttachedFolder
-- Display an alert indicating that the folder was opened
activate
display alert 'Attention!' message 'The folder ' & (quoted form of theName) & ' was opened.'
end tell
end opening folder
APPLESCRIPT
Listing 18-2AppleScript: Example of theclosing folder window for
event handleron closing folder window for theAttachedFolder
-- Get the name of the attached folder
tell application 'Finder'
set theName to name of theAttachedFolder
-- Display an alert indicating that the folder was closed
activate
display alert 'Attention!' message 'The folder ' & (quoted form of theName) & ' was closed.'
end tell
end closing folder window for
APPLESCRIPT
Listing 18-3AppleScript: Example of theadding folder items to
event handleron adding folder items to theAttachedFolder after receiving theNewItems
-- Get the name of the attached folder
tell application 'Finder'
set theName to name of theAttachedFolder
-- Count the new items
set theCount to length of theNewItems
-- Display an alert indicating that the new items were received
activate
display alert 'Attention!' message (theCount & ' new items were detected in folder ' & (quoted form of theName) & '.' as string)
-- Loop through the newly detected items
repeat with anItem in theNewItems
-- Process the current item
-- Move the current item to another folder so it's not processed again in the future
end repeat
end tell
end adding folder items to
APPLESCRIPT
Listing 18-4AppleScript: Example of theremoving folder items from
event handleron removing folder items from theAttachedFolder after losing theRemovedItems
-- Get the name of the attached folder
tell application 'Finder'
set theName to name of theAttachedFolder
-- Count the removed items
set theCount to length of theRemovedItems
-- Display an alert indicating that items were removed
activate
display alert 'Attention!' message (theCount & ' items were removed from folder ' & (quoted form of theName) & '.' as string)
-- Loop through the removed items, performing any additional tasks
repeat with anItem in theRemovedItems
-- Process the current item
end repeat
end tell
end removing folder items from
Attaching a Folder Action Script to a Folder
A folder action script must be connected to a folder in order to use it. This is done with Folder Actions Setup, an app that’s launched from the Finder’s contextual menu.
Control-click the folder in Finder.
Choose Folder Actions Setup from the contextual menu.
The Folder Actions Setup app launches, the folder is automatically added to the Folders with Actions list, and you’re prompted to select a script.
Choose a script to connect to the folder and click Attach.
Make sure the Enable Folder Actions checkbox is selected, as well as the On checkboxes next to the folder.
Once the script and folder are connected, the folder action event handlers in the script should run when the corresponding actions occur.
Note
Folder Actions Setup can also be used to disable or remove folder action scripts and watched folders.
The Folder Actions Setup app itself resides in /System/Library/CoreServices/
.
Watching Folders Using an Idle Loop and a Stay Open Script App
Although folder actions provide efficient folder watching capabilities, some scripters prefer to implement customized folder watching workflows that provide more control over the folder watching process. This is typically done by creating a stay-open script with an idle
handler that checks a folder at regular intervals for new items to process. Listing 18-5 demonstrates an idle
handler-based script that watches an Input folder on the Desktop.
Mac Os X Applescript
APPLESCRIPT
Listing 18-5AppleScript: Watch a folder for files using an idle loopon idle
-- Locate the folder to watch
set theFolder to locateAndCreateFolder(path to desktop folder, 'Input')
-- Watch the folder
watchFolder(theFolder)
-- Delay 2 minutes before checking the folder again
return 120
end idle
on watchFolder(theFolder)
-- Check for files in the folder
tell application 'Finder'
set theFilesToProcess to every file of theFolder
end tell
-- Stop if there are no files to process
if theFilesToProcess = {} then return
-- Locate an output folder
set theOutputFolder to locateAndCreateFolder(path to desktop folder, 'Output')
repeat with aFile in theFilesToProcess
-- Process the current file
-- Move the current file to the output folder so it doesn't get processed again
tell application 'Finder'
move aFile to theOutputFolder
end tell
end repeat
end watchFolder
-- Locate a folder, creating it if it doesn't exist
on locateAndCreateFolder(theParentFolder, theFolderName)
tell application 'Finder'
if ((folder theFolderName of theParentFolder) exists) = false then make new folder at theParentFolder with properties {name:theFolderName}
return (folder theFolderName of theParentFolder) as alias
end tell
end locateAndCreateFolder
Folder Watching Best Practices
Regardless of what method you use for folder watching, follow these best practices to produce an efficient and reliable workflow:
Wait for items to finish writing to disk before processing them.
Move processed items to an output folder so the same items aren’t detected and processed a second time.
Handle errors gracefully, such as by moving problematic items to an error folder so other processing can proceed.
Bring dialogs and alerts to the front so they’re visible and can be addressed.
Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2016-06-13
Operating system | Mac OS X 10.7 Lion or later |
---|---|
Website | support.apple.com/kb/HT4689?viewlocale=ru_RU&locale=en_US |
Mission Control, formerly Dashboard, Exposé, and Spaces, is a feature of the Mac OS Xoperating system. Dashboard, Exposé, and Spaces were combined together and renamed Mission Control in 2011 with the release of Mac OS X 10.7 Lion. Exposé was first previewed on June 23, 2003 at the Apple Worldwide Developers Conference as a feature of the then forthcoming Mac OS X 10.3 Panther.[1]
Mission Control allows a user to do the following:
- View all open application windows
- View all open application windows of a specific application
- Hide all application windows and show the desktop
- Manage application windows across multiple monitors
- Manage application windows across multiple virtual desktops
Usage[edit]
Exposé and Mission Control include three separate features for organizing windows and open applications:
- All windows
- Shows all open and unhidden windows and desktops shrinking their appearance so they all fit on a single screen. On newer Mac keyboards, this is activated from the F3 key, or F9 on older keyboards. On Apple's Magic Mouse or multi-touch trackpads, this can be activated by pulling up on the trackpad with three or four fingers. Mission Control redesigned this feature extensively to show all running desktops.
- Application windows
- Also called 'App Exposé'. Shows all open and minimized windows for the currently active application. During this mode, the user can choose a window to switch to by using mouse or keyboard, or cycle through windows of different applications by pressing the tab key. This can be activated by pulling down with three or four fingers on a trackpad, the F10 key on older keyboards, by pressing Control + F3 on newer Apple aluminium and Macbook keyboards, or by right-clicking the app's icon on the dock and selecting 'Show all windows'. On OS X Snow Leopard. App Exposé can be activated by clicking and holding the application's icon in the dock.
- Desktop
- Moves all windows off the screen, with just the edges of the windows visible at the side of the screen, giving the user clear access to the desktop and any icons on it. This can be activated by pressing CommandF3 on newer Apple aluminum and Macbook keyboards, the F11 key on older keyboards. On a trackpad, it can be selected by placing four fingers on the trackpad and pulling them away from each other.
In the first two cases, after Mission Control is activated, the user can select any window by clicking on it or selecting it with arrow keys and pressing Enter. Exposé then deactivates, leaving the selected window in the foreground. Using Apple Mighty Mouse, it is possible to select a window using the Scroll Ball, by scrolling in the direction of that window.
The keyboard shortcuts used for activating Exposé can be customized to be any of the function keys, the shift, control, option or command key, the fn key on Mac laptops, or even a mouse button on multiple-button mice (including Apple Mighty Mouse).
Different features of Mission Control can also be activated by moving the mouse to a 'hot corner' of the desktop. This system is off by default; it can be enabled from System Preferences.
Changes in Mission Control[edit]
When Exposé first premiered in 2003, it could be controlled using the F9, F10 and F11 keys.
The Exposé shortcut keys were moved to the F3 key to make room for the 'rewind', 'play/pause' and 'fast forward' keys. On Mac keyboards made after 2004, Exposé can be activated by using the F3 key or in combination with the command key, or on the trackpad of Macbooks supporting multi-touch interface. (However, F9, F10 and F11 can still be used for controlling Exposé with the function modifier key, or by enabling the 'Use all F1, F2, etc. keys as standard function keys' setting.)
On Mac OS X 10.6 Snow Leopard, Exposé featured a new organized grid view and allowed users to activate Exposé from the Dock.
In Mac OS X 10.7 Lion, some features of Dashboard, Exposé, and Spaces were incorporated into Mission Control. This gave an overview of all running applications just like 'All windows' but grouped windows from the same application, and added a display of Spaces. Desktop view and application window view were retained, the latter under the name of App Exposé, and could be accessed through gestures on multi-touch trackpads.
Some users criticised Mission Control in Mac OS X 10.7 Lion for not offering an unobscured 'Exposé' view of all the windows in single workspace: windows of the same application are always hidden in bundles. This issue was fixed in Mac OS X 10.8 Mountain Lion, however, with a checkbox in the System Preference pane allowing a user to choose whether to group windows of the same application. Some features of Exposé and Spaces from OS X 10.6 Snow Leopard did not return, however: it does not show the names of the windows displayed, nor does it return the added functionality provided by Mac OS X 10.5 Leopard multiple desktops feature, known as 'Spaces,' which allowed users to drag and drop windows between desktops with a single click, and also allowed for larger thumbnail previews of each desktop in a 2D grid when in use.[2]
Undocumented features[edit]
The 'blob' is a hidden and undocumented interface to Exposé that was discovered by a member of the MacNN forums.[3] When clicked, it enables the 'Application Windows' mode. When Option+clicked, it enables the 'All Windows' mode.
Another undocumented feature of Exposé is for the show desktop function. It places all the open windows in a small box on the screen that can be moved to anywhere on the screen.[4] This function has some bugs, after exiting the show desktop mode, the foremost window will not have a shadow and the user will not be able to move the window. However, this is easily fixed by using the show all function. It also had another bug that causes an area of screen the width of the minimised preview to become unresponsive to mouse clicks requiring the windowserver to be restarted.
Using the Shift key, Mission Control can be activated in slow motion, as can Dashboard and the minimise effect and several other animations. This is the same effect that was demonstrated by Steve Jobs during the unveiling of Exposé during the 2003 Worldwide Developers Conference.[5][6]
Similar applications[edit]
Similar effects are used on other operating systems.
Microsoft Windows 2.0 first introduced a window switcher in 1990. Using Alt+Tab ↹, users could see a flattened view of all open windows. Every version of Windows since then has also provided this window switching functionality. Vista and Windows 7 provide an additional feature called Windows Flip 3D, which has a broadly similar purpose. Flip 3D allows a user to flip through all open windows with a three-dimensional perspective. A downside to this method is that the front-most window covers a significant portion of the other windows, unlike Exposé. On the other hand, this allows the user to see the contents of the front-most window, while this can be difficult in Exposé, especially if the user has a large number of windows open. Vista's Desktop Window Manager exposes a public API that allows any application to access the same thumbnail representations that Flip3D uses, and so there are a number of third party add-ons that are able to provide Exposé-like functionality in Vista. A very few third party applications, such as the Emcee Desktop Organizer, provide Mission Control-like organization of similar windows into visual 'stacks,' or support Windows 8's 'Immersive' Apps. Windows 10 adds a very similar feature called Task View which also includes multiple-desktop support.
Microsoft's Intellipoint Software for Microsoft Mice has a feature similar to Exposé[7] as it also works with live images of windows, rather than static representations. Additionally, several freeware Windows applications exist to emulate the functionality of Exposé.
Compiz and KWin are compositing window managers for systems using the X Window System. Both include plugins similar to Exposé - the scale plugin in Compiz and the present windows effect in KWin. Skippy also performs similar functions to Exposé.
Starting with version 3.0, the GNOME desktop environment has gained a new mode called 'Overview', which is used to launch applications and manage workspaces. In this mode, windows are scaled and arranged in an Exposé-like fashion for quick switching.
For Classic or Legacy Macintosh systems, the free Finder Workspaces[8] offers functionality similar to Spaces.
Chrome OS has a window overview mode[9] that shows a thumbnail of all open windows, available by pressing the 'window switcher' key or swiping up with 3 fingers on the trackpad. Windows in overview mode can be closed by clicking an associated close button, or selected by clicking on the window thumbnail, which also closes overview mode and brings the selected window to the foreground.
See also[edit]
References[edit]
- ^'Apple Previews Mac OS X 10.3 'Panther''. Apple Press Release Library. June 23, 2003. Retrieved August 19, 2006.
- ^Caolo, Dave (July 20, 2012). 'OS X Lion and Mission Control'. The Unofficial Apple Weblog. AOL. Retrieved April 11, 2012.
- ^sandsl (October 9, 2003). 'wvous: 'Hidden' Dock Feature'. MacNN forums. Retrieved August 20, 2006.
- ^[1] Tutorial at macosxhints.com
- ^'OS X Panther - Expose'. YouTube. September 7, 2007.
- ^Pogue, David (2011). OS X Lion: The Missing Manual. O'Reilly Media. p. 176. ISBN9781449397494.
- ^'Instant Viewer'. Archived from the original on March 6, 2011.
- ^'Finder Workspaces 2.2'. Archived from the original on March 19, 2014.
- ^'The New Overview Feature in Chrome OS'. OMG! Chrome!.