Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

downingp

macrumors 6502a
Original poster
Jun 26, 2006
640
3
A few years ago, I setup an applescript to help me convert a FLAC file into Apple Lossless automatically which worked very well. Ever since I upgraded to OSX Mavericks, my script is no longer working. The "Max" program opens and inputs the FLAC files appropriately, but it never starts converting. Any ideas what could be going on?
Thanks.

The script is listed below:

Code:
tell application "Max" to activate

tell application "Max"
	convert theFile
end tell

delay 1

tell application "System Events"
	tell process "Max"
		click button "Convert" of toolbar of window "File Conversion"
		
		set encoderOpen to true
		repeat while encoderOpen is true
			try
				window "Encoder"
			on error
				set encoderOpen to false
			end try
		end repeat
		
	end tell
end tell
 
Last edited by a moderator:
Make sure AppleScript Editor is allowed to control your computer. Check System Preferences --> Security & Privacy --> Privacy tab.

This example worked for me on Mavericks with Max version 0.9.1 :

Code:
set theFile to choose file

tell application "Max" to activate

tell application "Max"
	convert theFile
end tell

delay 1

tell application "System Events"
	tell process "Max"
		click button "Convert" of toolbar 1 of window "File Conversion"
		
		set encoderOpen to true
		repeat while encoderOpen is true
			try
				window "Encoder"
			on error
				set encoderOpen to false
			end try
		end repeat
		
	end tell
end tell

Note : I've added the first line because your code uses variable theFile but it's not defined.
 

Attachments

  • Screen Shot 2013-10-26 at 04.43.24.png
    Screen Shot 2013-10-26 at 04.43.24.png
    106 KB · Views: 112
Make sure AppleScript Editor is allowed to control your computer. Check System Preferences --> Security & Privacy --> Privacy tab.

This example worked for me on Mavericks with Max version 0.9.1 :

Code:
set theFile to choose file

tell application "Max" to activate

tell application "Max"
	convert theFile
end tell

delay 1

tell application "System Events"
	tell process "Max"
		click button "Convert" of toolbar 1 of window "File Conversion"
		
		set encoderOpen to true
		repeat while encoderOpen is true
			try
				window "Encoder"
			on error
				set encoderOpen to false
			end try
		end repeat
		
	end tell
end tell

Note : I've added the first line because your code uses variable theFile but it's not defined.

I actually found the security feature just before you posted this. The problem now is the check mark doesn't stay checked for very long under "hazel" Any thoughts?
 
Make sure AppleScript Editor is allowed to control your computer. Check System Preferences --> Security & Privacy --> Privacy tab.

This example worked for me on Mavericks with Max version 0.9.1 :

Code:
set theFile to choose file

tell application "Max" to activate

tell application "Max"
	convert theFile
end tell

delay 1

tell application "System Events"
	tell process "Max"
		click button "Convert" of toolbar 1 of window "File Conversion"
		
		set encoderOpen to true
		repeat while encoderOpen is true
			try
				window "Encoder"
			on error
				set encoderOpen to false
			end try
		end repeat
		
	end tell
end tell

Note : I've added the first line because your code uses variable theFile but it's not defined.

I used hazel to automate my process as well. Do you use hazel by chance?
 
When I run the script within Applescript I get the following error:

System Events got an error: button "Convert" of toolbar of window "File Conversion" of process "Max" doesn’t understand the “click” message.

Do you get this error?
 
When I run the script within Applescript I get the following error:

System Events got an error: button "Convert" of toolbar of window "File Conversion" of process "Max" doesn’t understand the “click” message.

Do you get this error?

No error when using this :

Code:
click button "Convert" of toolbar 1 of window "File Conversion"

the error you're describing when using this :

Code:
click button "Convert" of toolbar of window "File Conversion"

Notice the difference e.g. toolbar 1. See my post #2.

Note : I've looked at Hazel and now I understand why you didn't declare theFile . Hazel uses theFile to refer to the file being processed.
 
No error when using this :

Code:
click button "Convert" of toolbar 1 of window "File Conversion"

the error you're describing when using this :

Code:
click button "Convert" of toolbar of window "File Conversion"

Notice the difference e.g. toolbar 1. See my post #2.

Note : I've looked at Hazel and now I understand why you didn't declare theFile . Hazel uses theFile to refer to the file being processed.

Despite that change, I still get the same error. The script does not understand "click"
 
Strange. It doesn't really help but here's a screenshot of the script after running it. As you can see in Events and Replies the button was clicked.
 

Attachments

  • Screen Shot 2013-10-31 at 03.22.37.png
    Screen Shot 2013-10-31 at 03.22.37.png
    147.4 KB · Views: 130
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.