I am confused, this AppleScript works just fine when run from Script Editor and the first time I run it on a new system but then the second time opened as an application it just go through the first couple dialogs and then doesn’t work. Any ideas? It doesn’t seem to have anything to do with app signing because the app still opens.
http://reference.StudioPrime.com/forums/steinberg/SP_Cubendo_Search.app.zip
(*
# DESCRIPTION #
This application is intended to help users find answers quicker by searching forums and multiple Steingber manuals when using Cubase and/or Nuendo.
*)
property factor : 1 -- Change the factor to a bigger number if your computer needs more time to process
property extraShortDelay : 0.25 * factor
property shortDelay : 0.5 * factor
property mediumDelay : 1.5 * factor
property longDelay : 3 * factor
property extraLongDelay : 5 * factor
property CubaseSevenManual : "Macintosh HD:Applications:Cubase 7.5.app:Contents:documentation:Operation_Manual.pdf"
property CubaseSevenPointFiveNewFeatures : "Macintosh HD:Applications:Cubase 7.5.app:Contents:documentation:New_Features.pdf"
property pluginsManual : "Macintosh HD:Applications:Cubase 7.5.app:Contents:documentation:Plug-in_Reference.pdf"
property NuendoSixManual : "Macintosh HD:Applications:Nuendo 6.5.app:Contents:documentation:Operation_Manual.pdf"
property google : "http://google.com"
property steinbergForum : "http://www.steinberg.net/forums/search.php"
property googleSteinbergForum : "https://www.google.com/?gws_rd=ssl#q=site:steinberg.net%2Fforums+"
property macosxAudio : "http://www.macosxaudio.com/forums/viewforum.php?f=28"
property gearslutz : "http://www.gearslutz.com/board/search.php?f=317&tab=forum"
set thePrefix to "Cubendo Search: "
set searchCubendo to ""
set theIcon to note
display dialog thePrefix & "
Please enter a word or phrase to search for Cubendo help in a few manuals and forums. " default answer searchCubendo with icon theIcon
set searchCubendo to text returned of result
set the clipboard to searchCubendo
display dialog "Would you like to search the forums and the manuals?" buttons {"Yes", "Just Manuals", "Just Forums"} default button 1 with icon note
set the button_pressed to the button returned of the result
if the button_pressed is "Yes" then
closeSafariWindows()
holdOn()
searchAllForums()
searchManuals()
else if the button_pressed is "Just Manuals" then
holdOn()
searchManuals()
else
closeSafariWindows()
holdOn()
searchAllForums()
end if
------------------------------------------------------------
on holdOn()
set holdOn to say "Be sure to wait until search is complete"
end holdOn
------------------------------------------------------------
on closeSafariWindows()
try
set dialogAnswer to display dialog ¬
"Would you like to close every Safari window before starting your search?" buttons {"Yes", "No", "Cancel"} ¬
default button "No" with icon note
if button returned of dialogAnswer is "Yes" then
tell application "Safari"
activate
close every window
end tell
else
-- your code for No goes here
end if
on error number -128 -- userCanceledErr
-- your code for Cancel goes here
end try
end closeSafariWindows
------------------------------------------------------------
on searchAllForums()
tell application "Safari"
activate
open location google
delay mediumDelay
tell application "System Events"
keystroke "site:steinberg.net/forums "
delay mediumDelay
keystroke "v" using {command down}
delay mediumDelay
tell application "System Events" to key code 36 --return
delay mediumDelay
end tell
end tell
-----
tell application "Safari"
activate
open location steinbergForum
delay longDelay
tell application "System Events"
keystroke "v" using {command down}
delay mediumDelay
tell application "System Events" to key code 36 --Return
delay (delay shortDelay)
end tell
end tell
-----
delay mediumDelay
tell application "Safari"
activate
open location macosxAudio
delay longDelay
tell application "System Events"
tell application "System Events" to key code 48 --Tab
delay shortDelay
tell application "System Events" to key code 48 --Tab
delay shortDelay
tell application "System Events" to key code 48 --Tab
delay shortDelay
keystroke "v" using {command down}
delay shortDelay
tell application "System Events" to key code 36 --Return
end tell
end tell
delay mediumDelay
-----
tell application "Safari"
activate
open location google
delay longDelay
tell application "System Events"
keystroke "site:http://www.gearslutz.com/board/cubase-7-nuendo-6 "
delay mediumDelay
keystroke "v" using {command down}
delay shortDelay
tell application "System Events" to key code 36 --return
delay shortDelay
end tell
end tell
delay mediumDelay
-----
tell application "Safari"
activate
open location gearslutz
delay mediumDelay
tell application "System Events"
keystroke "v" using {command down}
delay shortDelay
tell application "System Events" to key code 36 --return
delay shortDelay
end tell
end tell
end searchAllForums
------------------------------------------------------------
on searchManuals()
tell application "Preview"
activate
delay mediumDelay
try
open file CubaseSevenManual
delay mediumDelay
tell application "System Events" to keystroke "f" using {command down}
delay shortDelay
tell application "System Events" to keystroke "v" using {command down}
delay mediumDelay
---
open file CubaseSevenPointFiveNewFeatures
delay extraShortDelay
tell application "System Events" to keystroke "f" using {command down}
delay shortDelay
tell application "System Events" to keystroke "v" using {command down}
delay mediumDelay
---
open file pluginsManual
delay extraShortDelay
tell application "System Events" to keystroke "f" using {command down}
delay shortDelay
tell application "System Events" to keystroke "v" using {command down}
on error
display dialog "You may not have Cubase 7.5 installed in the root level of the Applications folder on this system because all of the manuals did not open."
end try
---
try
open file NuendoSixManual
delay extraShortDelay
tell application "System Events" to keystroke "f" using {command down}
delay shortDelay
tell application "System Events" to keystroke "v" using {command down}
on error
display dialog "You may not have Nuendo 6.5 installed in the root level of the Applications folder on this system because the opration manual did not open."
end try
end tell
end searchManuals
------------------------------------------------------------
on searchCubaseManual()
tell application "Preview"
activate
delay mediumDelay
try
open file CubaseSevenManual
delay mediumDelay
tell application "System Events" to keystroke "f" using {command down}
delay shortDelay
tell application "System Events" to keystroke "v" using {command down}
on error
display dialog "You may not have Cubase 7.5 installed in the root level of the Applications folder on this system because all of the manuals did not open."
end try
---
end tell
end searchCubaseManual
------------------------------------------------------------
on searchSteinbergForums()
tell application "Safari"
activate
open location google
delay mediumDelay
tell application "System Events"
keystroke "site:steinberg.net/forums "
delay mediumDelay
keystroke "v" using {command down}
delay mediumDelay
tell application "System Events" to key code 36 --return
delay mediumDelay
end tell
end tell
end searchSteinbergForums
------------------------------------------------------------
say "Search Complete"