I don’t see it here, although the service fails with a message Can't ... because <app name> is not showing the main dialog. I suspect switching from full-screen to no-full-screen is just something GUI scripting needs to take extra care for.
I’ve often had that error but not for a while – perhaps because I’ve granted Safari assistive access or have rewritten my service – I’ve found it hard to tell why such errors appear then not appear.
The blinking might be a symptom but my main problem is I need to set the value in a text box of my app.
I’ve done more work on the service. This code switches from Safari to my app without errors but, doesn’t set the value in the text box if it starts with Safari in full screen mode. When Safari is not in full screen, it does set the value.
tell application "System Events"
set value of text field 1 of window of process MyAppName to "Just testing"
delay 1
tell process MyAppName
set visible to true -- in case being hidden is a factor
set frontmost to true
end tell
end tell
I set the value in the text box before switching as it didn’t work when done after. Maybe either way will work if I understand the underlying problem.
It’s been very frustrating as sometimes it works and I can’t figure out what was different. Anyway, I doubt it’s the Toolkit so, I’ll look further afield.
I might have a solution/kludge – it’s just a crude exiting from full screen before switching and GUI scripting:
tell application "System Events"
tell process Safari
tell front window
set value of attribute "AXFullScreen" to false
end tell
end tell
delay 1
tell process MyappName
set visible to true
set frontmost to true
end tell
set value of text field 1 of window of process MyappName to "Just testing"
end tell
I had this idea earlier today but it didn’t work. So far, it has been working on 10.14. I’ll start testing in 10.13.
By the way, my final code is flakey although it still works – sometimes, Safari stays in full screen and just switches to my app.
I noticed a couple of days ago that interrogating AXFullScreen sometimes reported false even though Safari was in full screen. Maybe there are bugs in there. I’ve Googled like mad without luck to try to find other reports on that. Documentation on AXFullScreen is hard to find - can’t find anything on the Apple Developer site.
@ShaneStanley, I want to thank you for offering this fantastic utility.
I have written a dialog box with about 60 control variables (17 checkboxes, 5 fields, 5 matrix controls each with 2 options, 2 popup and their related control labels and 20+ pure labels and rules ) for setting the external preferences (I only need to load this dialog occasionally) of a script. It takes 1 sec+ to load in SD (perfectly fine response time) but as long as 4-5 secs (not every time) to popup when it is loaded as a user script on a 32GB 8-core Xeon system. I wonder if there is any general rules to improve the loading time by not having to reduce the number of controls?
Running as a script, being placed in the application’s script menu of Devonthink V3. I don’t think this is an issue related to Dialog Toolkit at all because the dialog also opens fast from the Apple script folder. That’s why I wonder whether there are general tips for overall performance improvement - I’m now reducing the number of unnecessary label-only and rule controls to see if that helps.
I never really used Dialog Toolkit, so I’m starting with Dialog Toolkit Plus.
But it seems that the documentation, and especially the script samples, are incomplete.
It looks like the sample scripts mostly cover the differences between Dialog Toolkit and Dialog Toolkit Plus, but not the basic function of all the commands and elements. For that, you would need the samples that came with Dialog Toolkit. But, that’s not available on the page anymore. Just Dialog Toolkit Plus.
Or am I missing something?
I found an old copy of Dialog Toolkit that I’d downloaded a while back and it seems like the samples there have everything I was looking for.
I am a bit confused because on the page linked it says “Dialog Toolkit v1.1.2”, but when I download the scptd file and open it in Applescript it says “-- Version 1.1.0. Based on ‘Dialog Toolkit.scptd’.”
Seems like it is indeed a later version, I think, because the date is 2019. But thought I should explain my confusion.