Applescript Widget Stops Showing and Disapears on Firefox--Reappears upon touching Touchbar

Have two (2) different applescripts that I use for browser apps, specifically Firefox Nightly to display the current url (hostname) and title of current webpage I am browsing on.

Everything was working and is kindof is, however the widgets no longer continue to just stay visible-their are other items on touchbar global items and such and they maintain viability but not the applescript widgets. I can get them to reappear by simply touching and. activating the touchbar in someway.

Anyone have any ideas or dealt with this issue as of late? Had been working great and now this issue has popped up .

Also if anyone has any. knowledge or played around with getting the url/hostname/window. title from Firefox and using it in BTT please do share how you went about it and how well it worked etc. Much apprreciated!

Touch Bar script items hide automatically if the script returns an empty string, maybe that is happening? How are you getting the current url? (I thought Firefox doesn't support any scripting - has this changed?)

nope no change :frowning_face: I wish! Firefox still blows regarding applescript support-only way ive found is through. GUI scripting and the odd hack or workaround pieced together. Wish Mozilla would just add applescript support to the browser.

Anyways one way i currently get url is this applescript

tell application "Firefox Nightly"
	if it is running then
		set Title to name of front window
	else
		set Title to "" -- Or handle the case where Firefox Nightly is not running
	end if
end tell

return Title

also used

tell application "Firefox Nightly"
	set Title to name of front window
end tell

and this script too

tell application "System Events"
	tell process "Firefox Nightly"
		set axfocused to value of attribute "AXFocused" of window 1
		set axfullscreen to value of attribute "AXFullscreen" of window 1
		set axtitle to value of attribute "AXTitle" of window 1
		set axchildreninnavigationorder to value of attribute "AXChildrenInNavigationOrder" of window 1
		set axposition to value of attribute "AXPosition" of window 1
		set axgrowarea to value of attribute "AXGrowArea" of window 1
		set axdocument to value of attribute "AXDocument" of window 1
		set axmain to value of attribute "AXMain" of window 1
		set axproxy to value of attribute "AXProxy" of window 1
		set axdefaultbutton to value of attribute "AXDefaultButton" of window 1
		set axminimized to value of attribute "AXMinimized" of window 1
		set axcancelbutton to value of attribute "AXCancelButton" of window 1
		set axmodal to value of attribute "AXModal" of window 1
		set axsize to value of attribute "AXSize" of window 1
		set axtoolbarbutton to value of attribute "AXToolbarButton" of window 1
		set axframe to value of attribute "AXFrame" of window 1
		return text 25 thru 1 of ((value of attribute "AXTitle" of window 1) as text)
	end tell
end tell

had another GUI but returning error last week after a FF update, prob changed name etc

And then I use an extension that interjects url/hostname in the title and just show that. Usually combine 2 scripts separated by - so it got hostname - site title. Also useful for saving and organizing password/logins in KeepPass

maybe add something to your script so it won't return an empty string if a non-empty string is expected. Then you'd at least know if the scripts are returning an empty string.

E.g.

tell application "Firefox Nightly"
    set theTitle to name of front window
end tell

-- If the title is empty, prepend "error - "
if theTitle = "" then
    set theTitle to "error - " & theTitle
end if

return theTitle

tell application "System Events"
    tell process "Firefox Nightly"
        set axfocused to value of attribute "AXFocused" of window 1
        set axfullscreen to value of attribute "AXFullscreen" of window 1
        set axtitle to value of attribute "AXTitle" of window 1
        set axchildreninnavigationorder to value of attribute "AXChildrenInNavigationOrder" of window 1
        set axposition to value of attribute "AXPosition" of window 1
        set axgrowarea to value of attribute "AXGrowArea" of window 1
        set axdocument to value of attribute "AXDocument" of window 1
        set axmain to value of attribute "AXMain" of window 1
        set axproxy to value of attribute "AXProxy" of window 1
        set axdefaultbutton to value of attribute "AXDefaultButton" of window 1
        set axminimized to value of attribute "AXMinimized" of window 1
        set axcancelbutton to value of attribute "AXCancelButton" of window 1
        set axmodal to value of attribute "AXModal" of window 1
        set axsize to value of attribute "AXSize" of window 1
        set axtoolbarbutton to value of attribute "AXToolbarButton" of window 1
        set axframe to value of attribute "AXFrame" of window 1
        
        -- Reverse substring: text 25 thru 1 of the title
        set theTitle to text 25 thru 1 of (axtitle as text)
    end tell
end tell

-- If the title is empty, prepend "error - "
if theTitle = "" then
    set theTitle to "error - " & theTitle
end if

return theTitle

thanks the suggestion! Much appreciated!(as always) I'll give it a shot and hope for best. Even if it doesn't work you still provided me some valuable info regarding applescript results which may prove invaluable again some time in the future. Have a good feeling you're suggestion maybe solve itv :wink:

off to try it out, let you know. Thanks again for everything!