The program does have a tell block for “Safari” – is this what you consider a “reference to an application”?
Just for completeness sake this is an application type of AppleScript (program.app). Since ScriptDebugger is hung I don’t seem to be able to do anything (like get a listing of the program) … any suggestion on how to do that? I’ve looked in all the folders inside the .app folder and found a folder named “Scripts” in the “Resources” folder that contains a file named “main.recover.rtf” and opened it with TextEdit and this is what it shows:
set question1 to ""
set question2 to ""
set sortedtabnamematchlist to {}
set AppleScript's text item delimiters to ""
repeat while question2 = ""
set question1 to display dialog ("Would you like to search or list Safari tabs?") buttons {"List", "Search"} default button "Search"
set mode to button returned of question1
set question2 to display dialog ("Find Safari tab:") default answer ""
set searchpat to text returned of question2
with timeout of 2000 seconds
tell application "Safari"
set winlist to every window
set winmatchlist to {}
set tabmatchlist to {}
set tabnamematchlist to {}
repeat with win in winlist
set ok to true
try
set tablist to every tab of win
on error errmsg
--display dialog name of win as string
set ok to false
end try
if ok then
repeat with t in tablist
if searchpat is in (name of t as string) then
set end of winmatchlist to win
set end of tabmatchlist to t
set end of tabnamematchlist to (id of win as string) & "." & (index of t as string) & ". " & (name of t as string)
--display dialog name of t as string
else if searchpat is in (URL of t as string) then
set end of winmatchlist to win
set end of tabmatchlist to t
set end of tabnamematchlist to (id of win as string) & "." & (index of t as string) & ". " & (name of t as string)
--display dialog name of t as string
end if
end repeat
end if
end repeat
if (mode = "Search") then
--we are in "Search" mode
if (count of tabmatchlist) = 1 then
--display dialog "one!"
set w to item 1 of winmatchlist
set t to item 1 of tabmatchlist
set current tab of w to t
set index of w to 1
else if (count of tabmatchlist) = 0 then
display dialog "No matches -- To try again, select 'Cancel' button"
else
-- sortedtabnamematchlist = my simple_sort(tabnamematchlist)
considering numeric strings
set sortedtabnamematchlist to my sortList(tabnamematchlist)
end considering
set whichtab to choose from list of sortedtabnamematchlist with prompt "The following Safari tabs match, please select desired tab or select 'Cancel' button to start another search:"
set prevTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"."}
if whichtab is not equal to false then
set tmp to text items of (whichtab as string)
set w to (item 1 of tmp) as integer
set t to (item 2 of tmp) as integer
set current tab of window id w to tab t of window id w
set index of window id w to 1
end if
set AppleScript's text item delimiters to prevTIDs
end if
else
--we are in "List" mode
if (count of tabmatchlist) = 1 then
--display dialog "one!"
set w to item 1 of winmatchlist
set t to item 1 of tabmatchlist
set current tab of w to t
set index of w to 1
else if (count of tabmatchlist) = 0 then
display dialog "No matches -- To try again, select 'Cancel' button"
else
-- sortedtabnamematchlist = my simple_sort(tabnamematchlist)
considering numeric strings
set sortedtabnamematchlist to my sortList(tabnamematchlist)
end considering
--set sortedtabnamematchtext to items of sortedtabnamematchlist as text
display dialog sortedtabnamematchlist
end if
end if
end tell
end timeout
set question2 to ""
end repeat
on sortList(thisList)
local indexList, sortedList, lowItem, a, currentItem, lowItemIndex
set indexList to {}
set sortedList to {}
repeat (length of thisList) times
set lowItem to ""
repeat with a from 1 to (length of thisList)
if a is not in indexList then
set currentItem to item a of thisList --- need to have "as ????" so that numbers sort correctly
if lowItem is "" then
set lowItem to currentItem
set lowItemIndex to a
else if currentItem comes before lowItem then
set lowItem to currentItem
set lowItemIndex to a
end if
end if
end repeat
set end of sortedList to lowItem
set end of indexList to lowItemIndex
end repeat
return sortedList
end sortList
So does this have what you consider a “reference to an application”?
I had to force quit the Script Debugger.app program again and this time I got a crash report but don’t feel comfortable posting that here on public forum as I’m not sure if there is anything there that would be considered personal (it contains a lot of info not related to Script Debugger like other running processes, as well as system related info and ???) – do you know if that is the case or not (post output of crash reports to public forums like this)?? I would be willing to e-mail you this report separetely if you wish, so let me know how to do that?
I then I tried to rebuild the Launch Services database using this command:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
and after several minutes it came back and then tried running Script Debugger again and it started by trying to create a new AppleScript program, which I canceled and then I did an Open Recent and selected the program I’m trying to work on and it then opens a dialog box that says "Reading FindSafariTab - v5.app … Generating Manifest and then I get the rotating beach ball indicating it’s hung again but the dialog box has a progress bar that is all blue with a “Stop” button but nothing else. Activity Monitor again says it’s not responding so back to square one and dead in the water.
As far as your suggestion to switch the Result Var to display the result of script textually, can’t do that as SD is hung, so any other suggestions? Do I again force quit SD and try again??
Thanks…