Forums | MacLife
You are not logged in.
#1 2009-04-09 12:27 pm
- albertaurus
- Member
- Registered: 2009-04-09
- Posts: 4
Logic Express 8 and Applescript
Hello All,
I am a real newbie to Logic Express and Applescript, ( literally started 2 Saturdays ago ) but look forward to the joys, trials and tribulations. Just bought the Sal Soghoian book, and its already dog-eared.
I am very familiar with other audio programs and basic programming.
I am presently working on a project that uses Logic Express to provide an 8 zone multitrack audio playback scenario, that is to say playing a randomly selected audio track from a list of 10-12 audio montages each of 2 minute duration.
Trigger is from a Passive Infrared Detector, using Indigo automation software to trigger an Applescript.
Logic Express is not scriptable except via GUI Scripting ( According to the Applescript Book by Sal Soghoian)
So far, I have been not had any success in the use of GUI scripting on Logic Express 8.
Specifically, the following script :
-------------------------------------------------------------------------
activate application "Logic Express"
tell application "System Events"
>>tell process "Logic Express"
>>>> delay 1
>>>> tell button 11 of window 1 to perform action "AXPress"
>>end tell
>> tell process "Logic Express"
>>>>delay 1
>>>>tell button 6 of window 1 to perform action "AXPress"
>>end tell
end tell
--------------------------------------------------------------------------------------
Button 11 is the "return to beginning"button
Button 6 is the "play" button
the delay command slows things down so I can observe the Logic Express 8 window to see the commands being executed.
What happens is that the application opens, it becomes the frontmost app, and I can see the actual buttons changing color on the Logic Express window indicating buttons are pressed, but nothing happens - playback does not start.
Manually Clicking the button with the mouse starts playback, but not with the script ?
Am I misunderstanding something here ? or is Logic Express really not scriptable by GUI scripting ?
Any help would be greatly appreciated. ( Please be gentle on this Newbie )
Best Regards
albertaurus
Model: MBPro, 2.5Ghz Intel Core 2 Duo, 4GigRam, 200G HD
AppleScript: Script Editor 2.2.1
Browser: Safari 525.27.1
Operating System: Mac OS X (10.5)
Offline
#2 2009-04-09 1:19 pm
- TheMouthOfSauron
- Member
- From: The Pas, MB, Canada
- Registered: 2002-02-25
- Posts: 659
Re: Logic Express 8 and Applescript
I see you posted something similar over at MacScripter, which is a good place to ask questions like this. GUI Scripting is often hit-and-miss. I'm not an audio guy so pardon my ignorance but since you're just playing the tracks does it have to be done in Logic Express? Could you substitute some other player that is scriptable such as iTunes or Quicktime Player?
EDIT: You might want to try something like this:
Code:
tell application "System Events" to tell application "Logic Express 8"
set frontmost to true
delay 1
click button 11 of window 1
delay 1
click button 6 of window 1
end tellI don't have Logic Express, so I can't test this.
Last edited by TheMouthOfSauron (2009-04-09 1:32 pm)
"Infinity is not a number! Infinity simply describes the way in which this [function] does not exist."
-Alex Chigogidze
Offline
#3 2009-04-09 3:08 pm
- albertaurus
- Member
- Registered: 2009-04-09
- Posts: 4
Re: Logic Express 8 and Applescript
First off, many thanks for the quick reply.
Unfortunately ITunes and Quicktime player do not playback anything other than stereo 2 ch . As to multichannel audio, unless its encoded in 6 ch AAC ( as in a movie surround track ) you will not get more than 2 ch audio as well. However I will try your suggested script.
albertaurus
Offline
#4 2009-04-09 4:26 pm
- albertaurus
- Member
- Registered: 2009-04-09
- Posts: 4
Re: Logic Express 8 and Applescript
Well, I tried your suggested script, and I get error messages.
" System events got an error : can't set application process "Logic Express 8" to true "
However, I do appreciate the suggestion. and I will keep trying and dig deeper into Applescript and Logic Express
Thanks
albertaurus
Offline
#5 2009-04-09 4:33 pm
- TheMouthOfSauron
- Member
- From: The Pas, MB, Canada
- Registered: 2002-02-25
- Posts: 659
Re: Logic Express 8 and Applescript
Try this version:
Code:
tell application "System Events" to tell process "Logic Express"
set frontmost to true
delay 1
click button 11 of window 1
delay 1
click button 6 of window 1
end tellLast edited by TheMouthOfSauron (2009-04-09 4:47 pm)
"Infinity is not a number! Infinity simply describes the way in which this [function] does not exist."
-Alex Chigogidze
Offline
#6 2009-04-09 6:18 pm
- albertaurus
- Member
- Registered: 2009-04-09
- Posts: 4
Re: Logic Express 8 and Applescript
Second try provided this message :
"System Events got an error : can't set process "Logic Express" to true. "
Thanks again for the suggestion. Still working on different approaches on my end as well.
Best regards,
albertaurus
Offline
#7 2009-04-09 11:20 pm
- TheMouthOfSauron
- Member
- From: The Pas, MB, Canada
- Registered: 2002-02-25
- Posts: 659
Re: Logic Express 8 and Applescript
Well, the syntax from your original post and mine from post #5 seem to work fine in other apps, so maybe this is a problem with Logic Express. The only other thing I can suggest is, if there are keyboard commands for these actions, you can do something like in the following example:
Code:
tell application "System Events"
activate application "System Preferences"
delay 1
keystroke "l" using command down
end tell"Infinity is not a number! Infinity simply describes the way in which this [function] does not exist."
-Alex Chigogidze
Offline
#8 2009-04-10 9:48 am
- mrreet2001
- Member

- From: NW Ohio
- Registered: 2005-05-25
- Posts: 4335
- Website
Re: Logic Express 8 and Applescript
albertaurus wrote:
First off, many thanks for the quick reply.
Unfortunately ITunes and Quicktime player do not playback anything other than stereo 2 ch . As to multichannel audio, unless its encoded in 6 ch AAC ( as in a movie surround track ) you will not get more than 2 ch audio as well. However I will try your suggested script.
albertaurus
It looks like QT will play multitrack to me. 
o you think great video deserves great audio? We do, too. And QuickTime 7 Player delivers truly outstanding multi-channel audio. In fact, it provides you with up to 24 channels of audio. So if you watch a movie that offers surround sound, you’ll be amazed at the heightened audio experience you’ll enjoy from your Mac or PC and your surround-sound speakers. A really good sport, QuickTime 7 Player supports a wide-range of industry-standard audio formats, including AIFF, WAV, MOV, MP4 (AAC only), CAF and AAC/ADTS.
2.66Ghz QuadCore-Nehalem w/24"LED CD ---2.2Ghz BlackMB---15" 2.4Ghz MBP(work)
Dual 2.3Ghz G5 (4G Ram, 2x 250G HD)(10.5 server)--- 400Mhz G4 PM (10.4 Server)
1.5GHz Powerbook---1.6Ghz G5 iMac
"So he fels down in a poisoning gas."
Offline
