text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set selectables to selection | Select Grep.applescript |
if selection as alias is equal to pwdAlias then set selectables to {} | Select Grep.applescript |
set query to text returned of dr | Select Grep.applescript |
if query = "" then return | Select Grep.applescript |
tell me to set matches to do shell script ("/usr/bin/grep -liE " & quoted form of query & " " & quoted form of pwd & "*") | Select Grep.applescript |
repeat with matchpath in paragraphs of matches | Select Grep.applescript |
set posixmatch to matchpath as POSIX file | Select Grep.applescript |
set fileinfo to info for posixmatch without size | Select Grep.applescript |
if visible of fileinfo then set end of selectables to posixmatch | Select Grep.applescript |
select every item of selectables | Select Grep.applescript |
display alert "Could not make selection (" & errNum & "):" message errMsg as critical | Select Grep.applescript |
My workaround solution for a wider "downloads window" (naturally hiding vital information in longer | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
file names, e.g. *.otrkey files) uses applescript to directly ACCESS "Downloads.plist", and places | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
a link in Safari's favorites bar: | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
First you save these scripts into "~/Library/Scripts/Folder action scripts/" folder, next you attach them | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
(context menu: configure folder actions) to a new "Folder1" somewhere deep down on your Mac. | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
To activate them, you will address a (meaningless) dummy "Folder2" inside "Folder1" thru this bookmark: | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
file:///Path/to/first/Folder1/Folder2 [place link in your favorites bar!] | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
Now, what happens: | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
- The clicked-on toolbar link will open "Folder1" because the called upon "Folder2" is inside. | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
- Thus BOTH attached scripts are launched, #-1 closing the bookmarked "Folder2" window... | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
- ... next ordering "System Events" to get all of Safari's "DownloadEntryPath" items. | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
- These paths are shortened to name plus parent-folder and collected into a "dialog alert". | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
- (Waiting for "dialog window":) #-2 script immediately on pop-up moves it to the top-right. | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
Let's get started - these two applescripts are needed to run the show: | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
on opening folder this_folder | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
tell application "Finder" to close front window | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set the plist_path to "~/Library/Safari/Downloads.plist" | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set the plist_file to property list file plist_path | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set downloadItems to property list items of property list item ¬ | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
"DownloadHistory" of plist_file | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set DL_display to "" | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set AppleScript's text item delimiters to {"/"} | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
repeat with i from 1 to number of items in downloadItems | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set DL_item to (get text items -2 thru -1 of ((value of ¬ | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
property list item "DownloadEntryPath" of property ¬ | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
list item i of property list item 1 of plist_file) as string)) | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set DL_display to DL_display & return & "[" & ¬ | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
text item 1 of DL_item & ":]" & return & text item 2 of ¬ | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
DL_item & return | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
tell application "Finder" to display dialog DL_display as string ¬ | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
buttons {"Close"} default button 1 | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
end opening folder | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
Here's the 2nd "folder action script" to "Folder1" that moves your "dialog" to the right/top: | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set screenRgt to bounds of the window of desktop | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set rightEdge to (item 3 of screenRgt) - 425 | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
tell application "System Events" to tell process "Finder" | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
repeat while not (exists window "Recent downloads") | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
end repeat -- wait for "dialog window" ! | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set position of window "Recent downloads" to {rightEdge, 61} | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
I was really astonished how "tell application" or "tell process" or even "tell application process" each | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
triggered quite different behaviours in the scripts. I admit to not yet quite understanding the "whys" ... | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
but I'm slowly getting a "feeling" for applescript ... | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
(Next I'll look into AppleScriptObjC -Shane Stanley's- and what else can be tweaked with that.) | How%202-%20APPLE%20Safari%20download%20window%20with%20full%20names%20(AppleScript%20Sys-Events%20etc.).txt |
set window_list to every window | toggle_camera.applescript |
set found to false | toggle_camera.applescript |
set index_window to 0 | toggle_camera.applescript |
repeat with the_window in window_list | toggle_camera.applescript |
set index_window to index_window + 1 | toggle_camera.applescript |
set tab_list to every tab in the_window | toggle_camera.applescript |
set index_tab to 0 | toggle_camera.applescript |
repeat with the_tab in tab_list | toggle_camera.applescript |
set index_tab to index_tab + 1 | toggle_camera.applescript |
set the_title to the title of the_tab | toggle_camera.applescript |
if the_title is "Google Hangouts" then | toggle_camera.applescript |
set button_action to execute the_tab javascript "document.querySelector('div[role=\"button\"][data-tooltip*=\"camera\"]').getAttribute(\"aria-label\")" | toggle_camera.applescript |
execute the_tab javascript "var el = document.querySelector('div[role=\"button\"][data-tooltip*=\"camera\"]'); el.dispatchEvent(new MouseEvent('mousedown')); el.dispatchEvent(new MouseEvent('mouseup')); el.dispatchEvent(new MouseEvent('mouseout'));" | toggle_camera.applescript |
say button_action | toggle_camera.applescript |
display notification button_action with title "Google Hangouts" | toggle_camera.applescript |
found = true | toggle_camera.applescript |
if found is true then | toggle_camera.applescript |
revealDocument() | Reveal Document copy 4.applescript |
on revealDocument() | Reveal Document copy 4.applescript |
tell application "OmniOutliner" | Reveal Document copy 4.applescript |
set theDocument to document 1 | Reveal Document copy 4.applescript |
set theFile to file of theDocument | Reveal Document copy 4.applescript |
reveal theFile | Reveal Document copy 4.applescript |
end revealDocument | Reveal Document copy 4.applescript |
keystroke "w" using {command down} | clear.applescript |
A few simple ASObjC scripts demonstrating the usage of various Cocoa classes. These should be saved and run as stay-open applications, since GUI elements need to be run on the main thread, although many* can be run from the **Script Editor** or **Script Debugger** (and adjusted for **Xcode**, of course). Care should be taken when running from an editor though, as programmatically created objects such as windows and menu items can be added to the current editor instance, in which case they will be kept until they are explicitly removed or the editor is quit. | README copy.md |
* *OpenPanel - an NSOpenPanel with an accessory view. | README copy.md |
* NSApplication, NSOpenPanel, NSMenu, NSBox, NSButton, NSDictionary | README copy.md |
* *Sheets - shows an alert sheet (with a help sheet) over the main window. ASObjC does not support blocks, so you are limited to the (somewhat buggy) deprecated method. There are some third-party Objective-C categories supporting completionHandler blocks available for use in an Xcode project. | README copy.md |
* NSWindow, NSAlert, NSButton | README copy.md |
* *StatusBarTimer - a status bar menu item showing the time that a specified application is active. | README copy.md |
* NSStatusBar, NSMenu, NSWorkspace notifications, NSTimer, NSMutableAttributedString, NSDictionary, NSFont, NSColor. | README copy.md |
* *TimerDisplay - similar to StatusbarTimer, but displays a general-purpose timer in a floating window and / or a status bar menu item. | README copy.md |
* NSWindow, NSStatusBar, NSMenu, NSTimer, NSTextField, NSMutableAttributedString, NSDictionary, NSFont, NSColor. | README copy.md |
* *AlertLib - an NSAlert library. Performs an NSAlert with optional TextField, ComboBox, CheckBox, or RadioButton accessory views. Can be used as a script library. | README copy.md |
* NSAlert, NSTextField, NSSecureTextField, NSComboBox, NSButton, NSTimer, NSBox, NSMutableDictionary, NSImage. | README copy.md |
* *Popover - shows a popover at a button when it is clicked. | README copy.md |
* NSWindow, NSButton, NSTextField, NSView,NSViewController, NSPopover, NSFont, NSColor | README copy.md |
These are also examples using AppleScriptObjC, but use other Cocoa classes that can be run directly from the **Script Editor** or **Script Debugger** without any main thread issues. | README copy.md |
* OverlayImage - overlay one image over another. The example puts an image or application icon onto a copy of the system's generic folder icon. | README copy.md |
* NSData, NSImage, NSBitmapImageRep | README copy.md |
* tags - a set of handlers in an example that adds or removes file tags. | README copy.md |
* NSOrderedSet, NSURL, NSDictionary | README copy.md |
* FinderTags - gets all of the Finder's tags and their label colors. Works with old and new plist locations (uses the `sqlite3` shell utility to read the database in current OS versions). | README copy.md |
* NSDictionary, NSData, NSPropertyListSerialization | README copy.md |
* JSON - conversion of a list/record to/from a JSON string. | README copy.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.