Script Error -1763
James Sentman
james at sentman.com
Wed Jan 10 09:09:16 EST 2018
I’ve had a look at that scripting addition and taking that along with the fact that the error message says that the problem is that an ObjC pointer was stored in the script data I believe it is that something in the addition that is a reference to an ObjC structure is being left in a local variable. That lives in the script context after it runs and blows things up when I ask the system to give me the source. Given the number of references in the scripting addition to pointers to window and control structures i can imagine that is what happening but I’m not entirely sure.
You might try just clearing out the reference to theField, theTop, buttonName, suppressedState and ControlsResults, just set them all to 0 at the end of your script and see if it makes the reference go away. I’m not sure that will work but it’s easy to try. I’m not entirely sure how the scripting addition stuff is saved inside the script that includes it. That is not really a scripting addition and I think that it’s probably including it’s context inside your own script so unless you want to also create another handler inside the Dialog Toolkit Plus that clears out all the properties that it sets up at the beginning there and any others that are created while performing the work then there might not be another good solution.
I think you can do what you want without using the dialog toolkit though, if you switched from using buttons to using the “choose from list” verb in regular applescript. That would look slightly different but would definitely work. I don’t see that you’re doing anything specific in the script below that you couldn’t rebuild with that. It’s not perfect because it doesn’t look like you can change the prompt or use the “giving up after” phrase, but it would work reliably and not require the other. The reply is a list with a single item in it and not a string, so you have to use the “contains” comparator to check what the reply is. It also returns false if the user clicked cancel. I THINK that you’re using “Abandon” as the same as cancel? Thats what my little example below does.
set buttonName to choose from list {“8h”, “9h”, “10h”, “11h”, 12h”, “Pas cours”}
if buttonName is false then
turnoff “Reveil_Leo” in 1
else if buttonName contains “8h” then
set heure_reveil to 8
else if buttonName contains “9h” then
set heure_reveil to 9
etc…
and the rest of your script would be the same.
I will also do a couple of things in XTension to help with this situation if you do wish to keep using the scripting addition. I will make it automatically put the current script data into the edit window if this error occurs as it will just know that for some reason the context of the script contains something that cannot be processed like that. And perhaps experiment with a “save script context” flag on an individual script level so that such scripts could be marked as just don’t try to save it ever which probably doesn’t work either in the case of saving pointers.
James
> On Jan 10, 2018, at 4:02 AM, Philippe SCHMUCK <philippe-schmuck at orange.fr> wrote:
>
> I have a specific « On script » in a unit that causes, each time the script has been triggered by turning On the unit and when the database is saved, the following result in the log:
>
> 10/01/2018 09:54:06 Script Error mesage: : Error: -1763
> 10/01/2018 09:54:06 Executing Script Error Alert
> 10/01/2018 09:54:06 Script Error notification ! Erreur detectee dans Unit : - thisScript : - thisInterface :
> 10/01/2018 09:54:06 Turning ON "Script Error Alert"
> 10/01/2018 09:54:06 there was an error getting the compiled script data, attempting to use the backup ()
>
> What I need to do is still working but, I have sometime to revert to a previous version when I want to edit the script as it shows empty.Any thoughts?
>
> Thanks,
> Philippe
>
>
> The script is exactly this:
>
> --
> --
>
> use AppleScript version "2.4" -- Yosemite (10.10) or later
> use scripting additions
> -- downloaded at https://www.macosxautomation.com/applescript/apps/Script_Libs.html#DialogToolkit
> -- must be put in ~/Library/Script Libraries
> use dtLib : script "Dialog Toolkit Plus" version "1.0.1"
Thanks,
James
James Sentman http://www.PlanetaryGear.org http://MacHomeAutomation.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.machomeautomation.com/pipermail/xtensionlist/attachments/20180110/575326f4/attachment.html>
More information about the XTensionList
mailing list