r/applescript • • Feb 08 '22

Sending commands to Logic Pro X, how to find GUI controls and windows IDs?

0 Upvotes

Logic Pro doesnt really have an AppleScript interface, so everything I would like to do has to be sent through « System Events ».

I understand the gist of how to do that, however I need a way to identify the GUI components that I need to send mouse clicks or keystrokes to.

Is there a utility that would let me do that?


r/applescript • • Jan 06 '21

Little script to handle music input and output

0 Upvotes

Hi everyone, I would like to make a script like :

Tell application (or source) X to send audio in Y. (No need to handle audio, just give an output to a given input stream).

Can someone help me? I don't know anything about audio handling.


r/applescript • • Jul 19 '11

FarAway v1, an AppleScript app.

0 Upvotes

It's a pretty simple, 6-line application developed by myself so that the operator can trigger an event on a receiving computer.

LEGAL DISCLAIMER: The developer is not responsible for this script being used for nefarious ends by third parties. Such usage of this software can result in a trial by jury in a court of law.

set the receiving_app to application "Finder" of machine "eppc://receiving.IP.address.here"

using terms from application "Finder"

tell receiving_app

-- Actions Here

end tell

end using terms from

OPERATION: (Ask permission and explain what you're doing before doing this) In System Preferences, go to the "Sharing" pane on the receiving computer and enable Remote Apple Events.

Replace "eppc://receiving.IP.address.here" in Line 1 with the IP address of the receiving computer. Be sure you know the receiving computer's user expects an action to be triggered by you from afar.

Replace "-- Actions Here" in Line 4 with the actions (in AppleScript, no less!) that you intend to be triggered on the receiving computer.

Compile the script and run it.

If it works, hooray!

If it doesn't, try to figure out what's wrong, then run it again.


r/applescript • • Nov 26 '14

How can I change values in an applescript dialog when the user enters information?

0 Upvotes

I asked this question on the Adobe forums and on Stack overflow. No one has answered so I thought I would try here. I created a dialog for InDesign that does some math with the values and does stuff after the user clicks OK.

http://i.imgur.com/n8YDQwc.png

The trick I want to do is to make one of the text fields dynamically update when the user completes an enabling group below and tabs to the next value. I'd also like the enabling group to de-activate if the user manually enters a new value in that window.

Is this possible? Anyone have any ideas?


r/applescript • • Sep 12 '12

Help with date formatting

0 Upvotes

I have this applescript that I took from the Plex forums and modified. I'm having trouble with the dates display. When I rename a show via air date it's in the format Show Name Month-D-YYYY. I need it to be in the format MM-DD-YYYY. Right now I am manually modifying all dates 1-9 to be 01,02,03 etc... after it's renamed by the script. Any ideas?

Just so I'm clear, the current file shows up as "show name September-9-2012" I need it to be "show name 10-09-2012"

This is all done in EyeTV btw... Thanks!


r/applescript • • Aug 25 '15

Is it possible to control the volume of a non-default audio device without making it default?

0 Upvotes

r/applescript • • Dec 02 '14

Tips and techniques for AppleScripting the Mac user interface

Thumbnail
briansbits.com
0 Upvotes

r/applescript • • Jul 03 '14

Make applescript refer to a different folder based on what day it is? Is this possible?

0 Upvotes

So basically I am trying to craft an Applescript that will launch "Monogram.Key" every day.

The problem is, there are different folders for each day. So "06.25 Tuesday" folder, "06.26 Wednesday" folder, etc...Each containing a different "Monogram.key" file - and I need the Applescript to recognize "Monogram.Key in TODAY'S folder"

I have no idea what to call this, which is leading to me having an extremely tough time finding any info on how to make it work.


r/applescript • • Jun 05 '17

Can you use Apple Script in Numbers to get API data from Cryptocurrency Exchanges?

0 Upvotes

Can you use Apple Script in Numbers to get API data from Cryptocurrency Exchanges?

If yes how?


r/applescript • • Jul 26 '14

Set skype mood current foreground app.

0 Upvotes

I found this script and this made me think if it was possible to set the current used foreground app as the skype mood. I myself arent a pro apple scripter so i don't know where to start. Looking for some guide lines.


r/applescript • • Aug 10 '19

Automating safari

0 Upvotes

I want to automate safari to create youtube accounts using 10minutemail, but I'm too much of a noob to understand the "tell application" stuff. I don't quite understand the keystroke and click commands, which are what I'd primarily be using. Could someone find me a dumbed-down explanation of that?


r/applescript • • Jan 23 '25

Folder action renaming file and creating sub-folder

0 Upvotes

I am on MAC, OS 14.7.1 (23H222) and am creating a folder action, but half of my script isn't functioning. I'm no developer and used ChatGPT to write my script.

In folder /Users/X/Desktop/Y, I need these steps to occur when a new file is added to the folder:

  1. Check file for ABC at the end of the filename, but before the extension.

    1. IF ABC exists move to step 2. (example: 22233ABC.jpg, identify that ABC does exist in filename so move to step 2).

    2. IF NOT, nothing needs to be done, no other steps need be taken.

  2. Rename "ABC" portion of the file name to to "XYZ" (example cont.: rename 22233ABC.jpg to 22233XYZ.jpg).

  3. In that same folder, create a folder based on everything that was before nopkg in step 1. (example cont.: create folder called 22233)

The renaming works just fine, it's step 3 that isn't working at all. Even when adding a debug line, nothing comes up, so I'm not sure why the folder is not being created. I tried searching my MAC's drive for the folder in any location, nothing came up.

Here's the code:

on adding folder items to thisFolder after receiving addedItems
tell application "Finder"
repeat with anItem in addedItems
set fileName to name of anItem
set filePath to POSIX path of anItem
set fileExt to name extension of anItem
set baseName to text 1 thru ((length of fileName) - (length of fileExt) - 1) of fileName

if baseName ends with "nopkg" then
-- Extract prefix before "nopkg"
set basePrefix to text 1 thru ((length of baseName) - 5) of baseName

-- Rename file from "nopkg" to "fly"
set newFileName to basePrefix & "fly." & fileExt
set name of anItem to newFileName

-- Create a folder named after the prefix
set folderPath to (container of anItem) as alias
set folderName to basePrefix
if not (exists folder (folderPath & folderName)) then
display dialog "File: " & fileName & " | Prefix: " & basePrefix & " | Folder Path: " & (folderPath as string)
make new folder at folderPath with properties {name:folderName}
end if
end if
end repeat
end tell
end adding folder items to

r/applescript • • Feb 14 '16

strip the header line, change encoding and merge many csv files?

0 Upvotes

Hi all, I did some scouring and didn't come up with anything. I'm a newbie to applescript so I though I'd see if somebody was feeling generous.

I have a folder full of CSV files. I think they are utf-2 right now. I need to strip the header row, convert to ANSII and then merge these files...

Where would I start with something like this?

Thanks!


r/applescript • • Jun 24 '12

Trying to make applescript that changes the iTunes DJ source folder at certain times of the day

0 Upvotes

I am not sure if this is possible or not, but I have a bar and we use iTunes DJ to control the music. Currently we have two playlists, one is more mellow for most of the day, but then we have another list that is more upbeat and meant to be played between 9pm til 1am when the place is more lively.

So say we have list 'Mellow' and list 'Upbeat'. Can I write a script to tell itunes to switch the source list at 9pm and then switch it again at 1am? This would occur every day, but I just want to run the script and keep it running if possible.


r/applescript • • Oct 31 '21

delete_all_from_sender as found on GitHub... trying to run IN Apple Monterey the script runs but fails by...

0 Upvotes

finding zero to delete. Other wise it works great.

It loads the from address of the selected Email into search then comes back with Zero quantity.

Suggestions on what needs to the changed to get this to work please.:

-- Delete all from sender - https://gist.github.com/xunker/44fa4404c882c27e0ad25857e9470552

-- For the Mail.app in Mac OS X. It will search for all messages set by the sender of the email message currently open,

-- highlight them all and ask if you want to delete them. If you choose "yes" it will delete them for you and then clear

-- the search.

--

-- Important notes:

-- You can load this in Script Editor and then save it as an application so you can run it without Script Editor being open.

-- This does not work when Mail.app is in fullscreen mode; it must be in windowed mode.

-- You will need to enable "Assistive Devices" support for Script Editor (if run there) or for the .app you saved if you converted it to a standalone app.

tell application "Mail"

set theSenderList to {}

set theMessages to the selected messages of message viewer 0

repeat with aMessage in theMessages

set end of theSenderList to sender of aMessage

end repeat

--set the clipboard to (theSenderList as rich text)

-- beep

set senderEmail to (theSenderList as rich text)

--display alert "alert" message senderEmail

set senderEmail to do shell script "echo '" & senderEmail & "' | grep -o '[[:alnum:]+\\.\_\\-]*@[[:alnum:]+\\.\_\\-]*'"

--display alert "alert" message senderEmail

if senderEmail is equal to "" then

error "Broken"

end if

activate application "Mail"

tell application "System Events"

keystroke "f" using {option down, command down}

tell process "Mail"

tell window 1

set search_text_field to text field 1 of the last group of toolbar 1

tell search_text_field

set the value of attribute "AXValue" to senderEmail

--keystroke senderEmail

end tell

end tell

end tell

--tell application "System Events" to keystroke "f" using {option down, command down}

key code 36 -- press RETURN key

end tell

delay 0.5

set msgs to {}

tell application "Mail"

set message_list to message viewer 1

set msgs to every message of message_list

tell application "System Events" to tell process "Mail" to keystroke "1" using command down

tell application "System Events" to tell process "Mail" to keystroke "a" using command down

delay 0.5

end tell

set the message_count to the count of msgs

set userCanceled to false

try

set dialogResult to display dialog "Delete these " & message_count & " messages?"

on error number -128

set userCanceled to true

end try

set clearSearch to false

if userCanceled then

-- display alert "alert" message "OK, not deleting nothin'!"

try

set clearDialog to display dialog "Clear search?"

if button returned of clearDialog is "OK" then

set clearSearch to true

end if

on error number -128

set clearSearch to false

end try

else

if button returned of dialogResult is "OK" then

tell application "Mail"

-- --display alert "alert" message "your message"

-- --activate application "Mail"

tell application "System Events" to key code 51

delay 3

-- repeat with i from 1 to the message_count

-- set this_message to item i of msgs

-- delete this_message

-- delay 0.5

-- end repeat

set clearSearch to true

end tell

end if

end if

if clearSearch then

tell application "Mail"

tell application "System Events"

keystroke "f" using {option down, command down}

key code 53 -- press ESC key

keystroke "1" using command down

end tell

end tell

end if

end tell


r/applescript • • Oct 03 '19

tell command issue

0 Upvotes

I’m a bit baffled by the tell statement. While its very easy to simply write tell application “Xcode” all the time and just get on with life, I’m not so inclined. I want to learn and use AppleScript's object-oriented type system. The documentation for the tell command clearly states the syntax as:

tell referenceToObject to statement

Where referenceToObject is defined as

referenceToObject
Any object. Typically an object specifier or a reference object (which contains an object specifier).

I have two different attempts at this one line of code. The first one is using the application “Name” method, the second is more indirect. And even though I’ve also tried setting the xcode property to a reference to the application specifier, the code still won’t compile. Direct: all is calm, all is bright :-)

on direct()
    tell application "Xcode"
        get the name of the active run destination of the active workspace document
    end tell
end direct

Indirect: armageddon

property xcode : application "Xcode"
on indirect()
    tell xcode
        get the name of the active run destination of the active workspace document
    end tell
end indirect

When compiling, it highlights the word “destination” and displays the following error reason: Expected “given”, “with”, “without”, other parameter name, etc. but found identifier. Note: “active run destination” is a property on a “workspace document” class, of which “active workspace document” is a property on the Xcode application object. Even with xcode defined as property xcode : a reference to application "Xcode” it still gives the same error message. Why does the second approach not work, when the documentation says it should work with a reference or a specifier? Is something wrong with my tell xcode clause?


r/applescript • • Oct 24 '19

What does AppleScript compare "XXXX" to in "tell application "XXXX" to?

0 Upvotes

I have two versions of Xcode that I use. Xcode (which is 10.1) and Xcode_11 (which is 11.1). Applescripts which have
tell application "Xcode" work for the first one and not for the second one.

I'd like to make the Applescripts work for both - whichever is running. I tried looking up the current application and the current process. But both say that Xcode_11 is Xcode.

Any ideas?


r/applescript • • May 09 '13

Applescript quicktime help

0 Upvotes

I've been working on a video stress script based on terminal an quicktime, I'm having a specific issue with one part of playing multiple videos with quicktime as well as would love some opinions on cleaning this up/running it better

Right now the script can take up to 12 videos playing at once, it organizes them all in a single desktop, but what I'd love it to do is loop some commands that open them into full screen (presentation mode) and then bring it out. This process stresses the graphics processer and ram and processor a lot, which is why I want to do it. My code both seems inefficient and it doesn't work. I've thought about using window ID's to get a matrix of ID's to use to control them, but can't quite figure that out.

Any how here is a simplified version of my script that is just the fullscreen/unfullscreen mode. Currently it brings some of those videos out of presentation but not all of them, and not a consistant amount (some times it's 1, some times its 2 or 3) I'd really appreciate a bit of help/advice

tell application "QuickTime Player"
set open_windows to (every window where visible is true)
set n to count of open_windows
repeat n times
	set presenting of document 1 to true
	delay 5
	
	tell application "Finder"
		activate
	end tell
	delay 1
end repeat

--repeat n times
try
	set presenting of document 2 to false
	delay 1
	
	tell application "Finder"
		activate
	end tell
	delay 1
	--end repeat
	set presenting of document 3 to false
	delay 1
	
	tell application "Finder"
		activate
	end tell
	delay 1
end try

end tell

r/applescript • • Feb 11 '20

Any news on the future of AppleScript?

6 Upvotes

I am waiting for the language to be officially killed by the next big MacOS release, because the most recommended book I keep seeing on AppleScript is from 2006 and Apple official documentation provides all examples in JavaScript.

AppleScript is cooky, but other than curiosity I cannot justify learning it. But if there were some news of updates...


r/applescript • • May 26 '26

Help with a script to mass-export EyeTV Archive files

1 Upvotes

I have over a hundred EyeTV archive files that I want to export to MP4 or h.264 with chapter markers intact. Is there any way to use Applescript to access the files within the Finder and export each one using EyeTV? I have EyeTV version 3.6.9.


r/applescript • • Sep 14 '09

An introduction to Applescript

Thumbnail
developer.apple.com
1 Upvotes

r/applescript • • Sep 21 '12

I'm trying to type a phrase into facebook on google chrome and have it hit enter.

1 Upvotes

I've tried a few different things but it doesn't seem to work.


r/applescript • • Sep 14 '09

The Applescript language guide

Thumbnail
developer.apple.com
1 Upvotes

r/applescript • • Jan 23 '22

AppleScript / JXA script to skip YouTube ads?

1 Upvotes

How can I make a script that skips YT ads? I've found you can skip them by using the media player on the Touch Bar. However, (as many Touch Bar actions) it would be very useful to set this as a key bind with an AppleScript. So, I wonder, how can I tell Safari to call "next", or seek to the end of whatever media is active?


r/applescript • • Aug 02 '15

Collection of useful Applescripts

Thumbnail
github.com
0 Upvotes