applescript

Searching in Finder from Selection

梦想的初衷 提交于 2019-12-13 18:06:48
问题 Usually I get an excel spreadsheet with dozens of filenames, for which I then need to go and search individually. Spreadhseet Is there a way that I could simply: Select All filenames in e.g. row A of Excel, then Search for all these files on "This Mac" then Copy all found files into the New Folder on the Desktop So far I've tried the first part of searching and this is what i get :a) Automator with Variable. But the problem is, it only searches for 1 file from selection b) Automator with

AppleScript: Error thrown when trying to read UI elements enabled

倾然丶 夕夏残阳落幕 提交于 2019-12-13 17:47:00
问题 If I run the following from Terminal osascript -e 'tell application "System Events" to get UI elements enabled' I get "true" or "false" as expected But if I were to create a file with the following contents; #!/usr/bin/osascript on supportsAssistiveDevices() tell application "System Events" set isEnabled to UI elements enabled return isEnabled as boolean end tell end supportsAssistiveDevices log supportsAssistiveDevices() and run it via ./myfile , I get the following error; ./hasguiscript:87

Why Can't AppleScript make firstValue of hash into type reference in this test code?

我们两清 提交于 2019-12-13 17:15:20
问题 I am confused by AppleScript references... I almost never develop in AppleScript, and am having a very difficult time finding good documentation on how AppleScript handles references. The following code fails because AppleScript Can’t make firstValue of hash into type reference. : on run foo() end run on foo() set the hash to {firstValue:1, secondValue:2} set the hashRef to a reference to the hash return the firstValue of hashRef end foo But the following code works -- same code, but I am

Create an image annotation tool with AppleScript and Automator

拥有回忆 提交于 2019-12-13 16:44:35
问题 On Mac, is it possible to use AppleScript/Automator to show a preview of an image in the background, while the Automator app is running? I have hundreds of images to which I want to add meta data so that they can be displayed on a web site. My plan is to create a *.meta file with the same name as the original image, so that a PHP script can read in the meta data at the same time that it generates the URL for the image. I have created an AppleScript file (see below), which I have embedded in

OSX Photos, Applescript: loop through Moments?

好久不见. 提交于 2019-12-13 16:39:03
问题 I am very new to AppleScript but have worked extensively (for years) with other scripting languages, so not entirely new to the game. I have just sadly said goodbye to Aperture and imported my nearly 100K digital images into Photos (so I'm also brand new to Photos). I would like to make a sane structure for finding images, i.e. Folders named for Year (e.g. 2004) contain Folders named for Month (e.g. 05) contain Albums named for each day for which there are images (e.g. 2004-05-03) (yes this

Use applescript to resize a window in Xcode

本秂侑毒 提交于 2019-12-13 16:14:13
问题 This is one of my first times using Xcode/AppleScript in my life - so sorry if very stupid question. Anyway, I have a little test window under my MainMenu.xib file. I've set up a tab view with different buttons and things under each tab that have all sorts of random test functions (displaying dialogs, saying things, requesting passwords, etc.). In one tab, I want to have a lot of test content, but in another tab I only want a little. Is it possible, when you change tab, to have it resize the

How do you specify multiple AppleScript child elements of the same class?

谁说我不能喝 提交于 2019-12-13 16:02:02
问题 I'm adding Apple Event scripting to my application. I would like to be able to use both of the statements below on it: -- Every instance of MyObject in the app every MyObject -- Only the instances of MyObject the user has selected selected MyObjects These are relevant excerpts from of my sdef file: <dictionary> <suite ...> <class name="application" code="capp" description="Top-level scripting object" plural="applications" inherits="application"> <cocoa class="MyAppClass" /> <element type=

How to get and/or overwrite the minimum size of windows in Mac OSX

泄露秘密 提交于 2019-12-13 15:14:29
问题 I want to resize any window on my machine, which I accomplish with AppleScript, using GUI Scripting. The script looks similar to the following: tell application "System Events" set appProcess to the first process whose name is "Finder" set appWindow to the front window of appProcess set position of appWindow to {100, 100} set size of appWindow to {10, 10} end tell Even though I set the width and height to 10px, the Finder will resize to at least a width of 344px and a height of 236px. I

Remove preceding and trailing white spaces in string: AppleScript

ぐ巨炮叔叔 提交于 2019-12-13 14:22:34
问题 I'm trying to remove preceding and trailing white spaces in a string but the code I'm using isn't working... It still only works if I select a directory path without white spaces at the beginning or the end. What am I doing wrong? on run {input, parameters} set filePath to input set ASTID to AppleScript's AppleScript's text item delimiters set AppleScript's text item delimiters to space set unwantedSpaces to filePath's text items set a to 1 set b to (count unwantedSpaces) repeat while (a < b)

Monitoring Spotify track change in Applescript?

时间秒杀一切 提交于 2019-12-13 13:06:52
问题 I'm trying to figure out the best way via Spotify's Applescript library to detect a track change. So far, I've tried checking player position -- if it equals 0 it is a new track and the Growl notification appears again. (This didn't work mostly if someone started a song over, etc.) I'm wondering if the more plausible method is having an idle iTunes script running and checking the current track name for change every couple seconds. I'm worried this might be a bit of a hog memory-wise. I can't