If I use the Finder, I can’t click into the Finder – uncool.
I would like to alter a script (application bundle) on the desktop without changing the name to ‘back.app’ – that would be very cool.
property mytitle : "Comfirmation"
property mytitle00 : "iBackground Scripts"
property mytitleIII : "Error"
tell application "Finder"
set home_path to home as Unicode text
set home_path to (home_path & "Desktop") -- I tried different ways of settting the path but no go!
if (exists file "back.app:Contents:Info.plist" of folder home_path) then
display dialog "Want to make your script a background app?\r\rIf the script is already a background app, you\rcan reverse that by clicking the \"No\" button." buttons {"Quit", "No", "Yes"} ¬
default button 3 cancel button "Quit" with title mytitle00
if the button returned of the result is "Yes" then
do shell script "defaults write ~/Desktop/back.app/Contents/Info LSUIElement 1"
display dialog "Your script has been set as a background app.\rNow you can rename it correctly." buttons {"OK"} ¬
default button 1 cancel button "OK" with title mytitle
return 1
else
if the button returned of the result is "No" then
do shell script "defaults write ~/Desktop/back.app/Contents/Info LSUIElement 0"
display dialog "Your script is no longer a background app.\rNow you can rename it correctly." buttons {"OK"} ¬
default button 1 cancel button "OK" with title mytitle
end if
end if
else
if (exists item "back.app" of folder home_path) then
display dialog "The script on your Desktop named: back.app\rappears to be PowerPC." buttons {"Quit"} ¬
default button 1 cancel button "Quit" with title mytitleIII
else
display dialog "There doesn't appear to be an application bundle\ron your Desktop named: back.app" buttons {"Quit"} ¬
default button 1 cancel button "Quit" with title mytitleIII
end if
end if
end tell
Hi Tom,
I’m not entirely sure what you mean but if it’s that you can’t use the finder because a dialog is active then try replacing your display dialog with:
tell me to display dialog "Want to make your script a background app?
If the script is already a background app, you
can reverse that by clicking the \"No\" button." buttons {"Quit", "No", "Yes"}
property mytitle : "Comfirmation"
property mytitle00 : "iBackground Scripts"
property mytitleIII : "Error"
set home_path to path to desktop as text
set backApp to home_path & "back.app"
if checkExists(backApp & ":Contents:Info.plist") then
display dialog "Want to make your script a background app?
If the script is already a background app, you
can reverse that by clicking the \"No\" button." buttons {"Quit", "No", "Yes"} ¬
default button 3 cancel button "Quit" with title mytitle00
if the button returned of the result is "Yes" then
do shell script "defaults write " & quoted form of (POSIX path of backApp & "/Contents/Info LSUIElement") & " 1"
display dialog "Your script has been set as a background app.
Now you can rename it correctly." buttons {"OK"} ¬
default button 1 cancel button "OK" with title mytitle
return 1
else
if the button returned of the result is "No" then
do shell script "defaults write " & quoted form of (POSIX path of backApp & "/Contents/Info LSUIElement") & " 0"
display dialog "Your script is no longer a background app.
Now you can rename it correctly." buttons {"OK"} ¬
default button 1 cancel button "OK" with title mytitle
end if
end if
else
if checkExists(backApp) then
display dialog "The script on your Desktop named: back.app
appears to be PowerPC." buttons {"Quit"} ¬
default button 1 cancel button "Quit" with title mytitleIII
else
display dialog "There doesn't appear to be an application bundle
on your Desktop named: back.app" buttons {"Quit"} ¬
default button 1 cancel button "Quit" with title mytitleIII
end if
end if
on checkExists(f)
try
f as alias
return true
on error
return false
end try
end checkExists