Post

Replies

Boosts

Views

Activity

Reply to Use Automator to delete folders with specific names
The Get Specified Finder Items action will only return those items, and the Get Selected Finder Items action returns the current selection in the front Finder window. Your workflow isn't getting anything to move, unless there happens to be a current FInder selection. You would need to do something like use Get Folder Contents on the specified folder(s), and then filter those items for folder names. You may also be able to use Find Finder Items to combine the getting and filtering actions. To see what a specific action is returning, you can view its result.
Oct ’24
Reply to Shortcuts app in macOS has no logic
Actions are designed to perform a specific task, which is usually general-purpose in nature. They do what they do. I don't know what you did before to get windows moved, but your posted sample workflow isn't going to work at all. Take a look at the action info, which specifies what the input and output will be. Opening files returns files (not windows), and the window actions require a window (not an image) to resize or move, which isn't specified anywhere. Also note that there isn't a line connecting the actions, which indicates they aren't compatible (there isn't anything to convert the action's input/output). You would need to do something like open the files in Preview, wait a little bit to let them open, then have the Find Windows action filter for Preview windows. From there, you would need to loop through the windows, resizing and moving as desired, but now you are fighting what Shortcuts was designed to be (like a graphical shell script), and might as well use something more designed for the task, like a 3rd party action or scripting. Shortcuts (and Automator) have their purpose, but they aren't really designed for much beyond batch workflows without some help.
Oct ’24
Reply to Shortcuts app in macOS has no logic
Automator and Shortcuts built-in actions are general-purpose in nature, based mostly on existing shell utilities or common functions, or a developer was generous and decided to include some to support their application. There are tiling and window moving scripts out there (various scripting forums, GitHub, etc), but you would need to graft them into your specific workflow (Run AppleScript, Run Shell script, etc). Other options would be to find 3rd-party actions or make your own, although manipulating the UI is a pain no matter what you use.
Oct ’24
Reply to Applescript text item delimiters not working
The usual approach would be to save whatever the existing delimiters are, set the delimiters to what you want to use, split the string into a list of its text items, restore the previous delimiters, and then just use the list. You are continually splitting the string to get each piece, so all it would take is for the delimiters to get changed/reset somewhere else in the bigger script for the text items to be different the next time you split the string. Another option would be to try using the words of the string.
Oct ’24
Reply to Applescript: window API handler crashing in split view
OK, I am getting a few different errors, but the problem seems to be that for whatever reason (looks like a bug), when you initially click in the window or use the divider or history, the window accessibility properties are not getting set up. Clicking the window again gets things set up, but until then the "front" window doesn't have any properties for the script to use, such as selected tab, so trying to use that throws an error. Unfortunately, this also prevents targeting the window by name, id, tty, etc, so I haven't found a workaround other than to click the window a couple of times before running the script. A command line tool to do the clicking could probably be used, but you would need to get information about the "front" window to get the bounds to click into, which would most likely be way more involved than what you are doing now.
Aug ’24
Reply to AppleScript, Do Shell. How do I write the "test" command to the "script editor"?
This is one of those situations where learning some basics instead of having others do everything helps. The posted script just has some quoting issues - either escape the double quotes for use in the string, or use single quotes since the shell also understands those. The corrected script would be: set myFile to choose file -- choose a package or or try `choose folder` to select a folder set theCommand to "(test -d " & quoted form of POSIX path of myFile & " && echo 'is a dir') || (set status 0; echo 'not a dir') ; 2>&1" return do shell script theCommand
Jun ’24
Reply to translation project only uses first and last items in a Numbers cell range
It is only translating the first and last items because in the getCellRangeValues handler, that is all that the words of cellRange list contains. You would need to get the individual cell elements of the range and use those in the repeat statement to get the in between cell references, for example: repeat with cellRef in cells of range cellRange of tbl set end of cellValues to value of cellRef end repeat
Mar ’24
Reply to Speeding Up Code
You can speed it up a bit more by not bothering with the check for a window, as just getting the windows will always return a list and avoid the duplication in getting windows. Better yet, you can usually reduce overhead by having an application do as much as possible with any given call, for example: tell application "System Events" set foregroundApps to (processes whose background only is false) repeat with anApp in foregroundApps set minimizedWindows to (windows of anApp where value of attribute "AXMinimized" is true) repeat with aWindow in minimizedWindows tell aWindow to set value of attribute "AXMinimized" to false end repeat end repeat end tell In this example you can go even further by doing something like getting the (windows of (processes whose background only is false) where value of attribute "AXMinimized" is true), but there are diminishing returns for increased noise and the performance of complex expressions depends a bit on the particular application.
Sep ’23