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

MacMaster1000

macrumors newbie
Original poster
Jul 24, 2014
7
0
Private!
Code:
try
	set suCALLapp to the result of the application
        set APPn to the result of the application
if suCALLapp is "1" then
	display dialog "You need  to activate Superuser. Activate?" buttons {"OK"} default button 1
	tell APPn
		do shell script "cd /Applications/Superuser/Needed;mkfile 1b confirmFILE.conf"
		activate
	end tell

on error the error_message number the error_number

	if suCALLapp is "0" then
	display dialog "Will you like to activate Superuser?" buttons {"Yes", "No"} default button 2
	if the button returned of the result is "" then
		do shell script "cd /Applications/Superuser/Needed;mkfile 1b confirmFILE.conf"
	else
		-- action for 2nd button goes here
	end if
end try
The code above in Apple Script form is not working.
The code is supposed to do the following (for people that don't know):
Code:
"try set suCALLapp to the result of the application 
set APPn to the result of the application" is trying to get result that is called from app
"if suCALLapp is "1" then
	display dialog "You need  to activate Superuser. Activate?" buttons {"OK"} default button 1
	tell APPn
		do shell script "cd /Applications/Superuser/Needed;mkfile 1b confirmFILE.conf"
		activate
	end tell" checks for result by app & if true prompts for activate
"on error the error_message number the error_number

	if suCALLapp is "0" then
	display dialog "Will you like to activate Superuser?" buttons {"Yes", "No"} default button 2
	if the button returned of the result is "" then
		do shell script "cd /Applications/Superuser/Needed;mkfile 1b confirmFILE.conf"
	else
		-- action for 2nd button goes here
	end if
end try"
is called when result is false (broken part :( ).
Help!!!

Garret Stand

download ↓
 

Attachments

  • Superuser.zip
    19.3 KB · Views: 58
Last edited by a moderator:
You're missing a few end if lines. Try this:

Code:
try
	set suCALLapp to the result of the application
	set APPn to the result of the application
	if suCALLapp is "1" then
		display dialog "You need  to activate Superuser. Activate?" buttons {"OK"} default button 1
		tell APPn
			do shell script "cd /Applications/Superuser/Needed;mkfile 1b confirmFILE.conf"
			activate
		end tell
	end if
	
on error the error_message number the error_number
	
	if suCALLapp is "0" then
		display dialog "Will you like to activate Superuser?" buttons {"Yes", "No"} default button 2
		if the button returned of the result is "" then
			do shell script "cd /Applications/Superuser/Needed;mkfile 1b confirmFILE.conf"
		else
			-- action for 2nd button goes here
		end if
	end if
end try
 
You'll get much more informative error messages if you comment out those try ...on error ... end try structures until everything is pretty much working as planned.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.