When I click a button it gets stuck


(Daniel Santos) #1

Hello,
I developed a simple swift/cocoa application, and I am scripting it using system events. Sometimes when I click the button in my applescript the button stays pressed (with a blue color). Could it be related to the action the button does ? It is currently showing a progress window while in the background some files are uploaded. It does not happen all the time. I have tried putting more delay after the button click to allow it’s action to finish but it still happens sometimes.

Thanks


(Shane Stanley) #2

I can’t answer your question, but I can ask you one: Why not just make your app scriptable? UI scripting should be a last resort.


(Daniel Santos) #3

My problem was my application. I changed the implementation of the button, and now it doesn’t get stuck anymore. At least the script ran all night without doing that.

I would like to make it scriptable. Need to make a google search on how to do that. Or maybe you can give me some references on any sites that teach that.

Thanks


(Shane Stanley) #4

Apple’s docs are as good a place as any to start:

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_implement/SAppsImplement.html