I use JSMS (http://jsmsirl.sourceforge.net/JSMS/JSMS.html) to send text messages and want to set it up so I can send messages via Applescript. I got a script that does it all except I can not get the “Send Message” button to work.
The accessibility inspector (UIElementInspector) tells me “Send Message” is indeed a button.
<AXApplication: “JSMS”>
<AXWindow: “JSMS (00123456) - O2.ie Webtext”>
<AXButton: “Send Message”>
Attributes:
AXParent: “”
AXRole: “AXButton”
AXRoleDescription: “button”
AXHelp: “Send message to selected contact”
AXWindow: “<AXWindow: “JSMS (00123456) - O2.ie Webtext”>”
AXTopLevelUIElement: “<AXWindow: “JSMS (00123456) - O2.ie Webtext”>”
AXEnabled: “1”
AXSize: “w=87 h=18”
AXPosition: “x=894 y=375”
AXTitle: “Send Message”
Actions:
AXPress “ click
I tried things like:
click button “Send Message”
click radio button “Send Message”
click button “Send Message” of menu bar 1 of window “JSMS (00123456) - O2.ie Webtext” of application process “JSMS”
all to no avail.
Any tips how to do this?
Thanks
I’ve been looking for the UIElementInspector. Apple no longer has it listed on the developer site. I lost my copy when I upgraded to my new Mac Mini. If you send me a copy of it I’ll see if I can help.
Deal? Just send it to my Macscripter account, kevinb@macscripter.net
Morning Kevin, (and no I am not a morning person, have no fear).
it is here!
http://developer.apple.com/samplecode/UIElementInspector/index.html
OK, I’ve compiled the UIElementInspector and downloaded JSMS. What messaging service are you using? I’ll set up an account there so I can test this out.
Also, a side thought: Have you tried the “perform action” command on the button? It’s the same as actually clicking the button.
Kevin, greetings.
I use O2 Ireland. But think it would not make a difference as to the operation of the programme. and you would be able to test it without an account, as the programme would give you a error message when it can not connect to server. At this point however you would know it is working.
Anyway, I have been working on it yesterday (had an insight as to how to solve it) and got it to work. Here is what I have, maybe not the most elegant way to do it, but it works. Note that JSMS is slow to respond, so long delays are needed.
tell application "JSMS"
activate
end tell
delay 5
tell application "System Events"
delay 2
keystroke "123456" -- Note: number of recepeint goes here
keystroke return
delay 7
keystroke tab
delay 7
keystroke "Test" -- Note: text goes here
keystroke space
tell application "System Events"
delay 4
key code 48 using control down
delay 2
keystroke "s" using {option down}
end tell
end tell
delay 20
tell application "JSMS"
quit
end tell
I also had to repeat the command “tell application "System Events”" as it seems to not work for me otherwise, strange.
if you have thoughts to improve this I am open to hear as I like to learn.