Post

Replies

Boosts

Views

Activity

AppleScript remove spaces from do shell script result
I am getting a count of files with a certain name extension in a directory chosen by the user like so:set fileCount to do shell script "find " & (quoted form of usrTarget) & " -name \"*.asd\" | wc -l"When the resulting number is printed in my confirmation dialog:set confirmDialog to display dialog "Found" & (fileCount) & " files with the name extension \".asd.\" Ready to delete? This action cannot be undone!" with icon file rxIcon buttons {"Abort", "Delete"} default button "Delete"The dialog works fine, but it keeps the spaces that are included in the output of the shell script. How would I go about removing those spaces from my "fileCount" variable for the sake of the dialog not looking weird? e.g "Found: 104 files with the name extension .asd." instead of"Found: 104 files with the name extension .asd."
2
0
479
May ’20
AppleScript changing enabled services in the extensions pref pane
I have a script that creates a new quick action for the touch bar based on a template. It all works great, except that the user must alway open system preferences after running the "create new" quick action to enable the newly created service in the extensions pref pane -> touch bar list. I would like to just add something that enables it automatically at the end of the script so it just shows up on the touch bar.I dug around a bit, I see that it's doable to change preferences like that but I havent been successful in finding the way for how the extensions pane is laid out.Thanks for the help.Running 10.15.4
0
0
320
May ’20
AppleScript distributing an icon with scripts
I want to distribute an icon that is used in my script dialogs like so:set rxIcon to (path to application support folder as string) & "RX Consulting:Resources:RXIcon.icns"set opType to display dialog "Would you like to consolidate, rename, or both?" with icon file rxIcon buttons {"Rename", "Consolidate", "Both"} default button "Both"On my machine, I just created a directory in application support and placed the icon there, which is the path in the script as you can see. Is that the appropriate place for something like this when building an installer pkg?
2
0
574
May ’20
AppleScript ensuring compatibility for a program with multiple versions
Hi friends.I am working on some scripts for a DAW, specifically Ableton live. This program has multiple versions e.g. "Standard" and "Suite."On my machine, here is a basic telltell application "Ableton Live 10 Suite" activate end tellWhen I first wrote this script it allowed me to type "Live" and auto corrected on run to "Ableton Live 10 Suite" (in automator) as seen above. I am planning on giving these away to other music makers that may or may not have the "Suite" version. These scripts will work regardless of the version of the app one has, so if I distribute them like this:tell application "Live" activate end tellCan I assume that it will work the same way it did on my machine? In the same area... I believe the process name is typically always just "Live" ...not the full app name. Would it be better to approach making sure the app is running and top that way?Here's a little snippet to maybe give you a better idea of how I'm using that basic tell block I mentioned earlier. This part is an ending dialog after a batch action is done with a bunch of keystokes in Ableton that allows the user to undo said batch action.Thanks in advance for any help.set undoTask to (text returned of theNumber) as integer if button returned of opType = "Rename" then set endMsg to display dialog "All done!" with icon file rxIcon buttons {"Undo", "Thanks!"} default button "Thanks!" if button returned of endMsg = "Undo" then tell application "Ableton Live 10 Suite" activate end tell tell application "System Events" repeat undoTask * 2 times delay 0.2 keystroke "z" using command down end repeat end tell end if else if button returned of opType = "Consolidate" then set endMsg to display dialog "All done!" with icon file rxIcon buttons {"Undo", "Thanks!"} default button "Thanks!" if button returned of endMsg = "Undo" then tell application "Ableton Live 10 Suite" activate end tell tell application "System Events" repeat undoTask * 2 times delay 0.2 keystroke "z" using command down end repeat end tell end if else if button returned of opType = "Both" then set endMsg to display dialog "All done!" with icon file rxIcon buttons {"Undo", "Thanks!"} default button "Thanks!" if button returned of endMsg = "Undo" then tell application "Ableton Live 10 Suite" activate end tell tell application "System Events" repeat undoTask * 2 times delay 0.2 keystroke "z" using command down end repeat end tell end if
9
0
1.5k
May ’20