Applescript Calls into Servoy Client

I really need applescript support into the Servoy Client. I know the client can execute applescript, but I need to be able to make calls into the client.

I’ve looked at the rest of the posts in the forum, and nothing has worked.
I’ve also looked at using the UI Brower (http://www.apple.com/applescript/uiscripting/index.html) to sends applescript commands to the Servoy Client application, but have had no success.

I have tried these 2 scripts to set values of fields in Servoy, and neither of them work.

This compiles, but doesn’t work

tell application "System Events"
	tell process "Servoy Client"
		tell window 1
			tell scroll area 1
				set the value of text field 2 to "test"
			end tell
		end tell
	end tell
end tell

This one doesn’t compile

tell application "Servoy Client"
		tell window 1
			tell scroll area 1
				set the value of text field 2 to "test"
			end tell
		end tell
	end tell

I have been able to get this script to work to get values of fields…

tell application "System Events"
	tell process "Servoy Client"
		tell window 1
			tell scroll area 1
				set myTest to the value of text field 2
				display dialog myTest
			end tell
		end tell
	end tell
end tell

Temporarily, I’ve worked out this nasty solution to set clipboard to Servoy code, then run an applescript to click a menu item that runs a Servoy method to evaluate what is in the clipboard. I really hope Servoy can come up with something better? Please?

The applescript

tell application "Servoy Client"
	activate
end tell

--set to code that you would put in method editor
set the clipboard to "forms.busmod_docmgt_Main.fle_casenbr = '99'"

tell application "System Events"
	tell process "Servoy Client"
		tell menu bar 1
			tell menu bar item "Methods"
				tell menu 1
					click menu item "Run_Applescript"
				end tell
			end tell
		end tell
	end tell
end tell

The global method “Run_Applescript”

eval(application.getClipboardString())

Hi Scott,

An application has to support AppleScript to be able to script it. In fact an app has to define what apple events it supports and what to do with it.
Maybe Apple have some AppleScript support built into the JVM to some extend that allows you to get values but I don’t think Servoy Client has AppleScript support built in.
So some AppleScripts might compile simply because the syntax is correct and will send apple events to Servoy Client but Servoy Client is not ‘listening’ so nothing will ever happen.

I hope this explains things.

Hi Scott,

I have not taken the time to read it yet but I found this https://jasconn.dev.java.net/.

Looks like a new and promising project, however based on Java 6.0 which is still alpha/beta for the mac…

Hope this helps, please let me/us know what you think of it (saves reading time :) ).

I have not taken the time to read it yet but I found this https://jasconn.dev.java.net/.

Looks like that may work, but like you said it requires Java 6. It would also require Servoy to build that into the Servoy Client app…if I’m reading it correctly.

I also looked at the URL below, and Apple basically says you can add basic applescript support, like print, open, etc, but additional functionality can only be added through UI Scripting
http://developer.apple.com/documentation/Java/Conceptual/Java14Development/07-NativePlatformIntegration/NativePlatformIntegration.html

If Servoy Client were a Cocoa-Java app, it would be pretty easy…