Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

wal9000

macrumors member
Original poster
Oct 8, 2006
45
2
I'm looking for a way to open the Ink window using AppleScript (ideally without GUI scripting), but I haven't had any luck. I figured that the folks over here in the programming forum would probably have more of a clue than I do.

If it's not possible in Applescript would someone be willing to throw together a small program (that could be run quickly, invisibly, and quit when finished) to do this?

Thanks,
Will
 
Without GUI scripting? Oh man this is going to be ugly.

Okay, here's something, but shield your eyes.

Code:
try
	tell application "InkServer" to quit
end try
do shell script "/usr/bin/defaults write com.apple.ink.framework inkWindowVisible  1"
try
	tell application "InkServer" to activate
end try
 
Without GUI scripting? Oh man this is going to be ugly.

Okay, here's something, but shield your eyes.

Code:
try
	tell application "InkServer" to quit
end try
do shell script "/usr/bin/defaults write com.apple.ink.framework inkWindowVisible  1"
try
	tell application "InkServer" to activate
end try

That works perfectly! My reason for non-gui was to avoid problems if the ink menu wasn't up, which would have been the easiest way to do this. Though now that I think about it, I could have just opened the ink menu first... That's what I get for trying to think at 1 in the morning.

I should be able to make this toggle it on and off, then bind it to a quicksilver trigger, or maybe stick it in the Wacom popup menu.

Thanks for the help.
 
I thought this would do it, but I guess not. Every time I run it the Ink window goes away (presumably when it quits) and then reopens. Any ideas?

Code:
try
	tell application "InkServer" to quit
end try
set inkWinState to (do shell script "/usr/bin/defaults read com.apple.ink.framework inkWindowVisible")
if inkWinState is equal to "0" then
	do shell script "/usr/bin/defaults write com.apple.ink.framework inkWindowVisible  1"
else if inkWinState is equal to "1" then
	do shell script "/usr/bin/defaults write com.apple.ink.framework inkWindowVisible  0"
end if
try
	tell application "InkServer" to activate
end try
 
In the words of the inestimable Daffy Duck, for a small price, I can install this little blue button to get you down!

Or not. The ink swerver is willing to deal with an ugly kludge to make its window appear, but doesn't want to reliably close it that way. I'm not finding a nice little API to deal with this, but did run into some mentions of a private framework :p

One option would be to live with it only opening, if you already have the pen out you can close the window easily enough. Another would be to do the UI scripting thing and toggle it through System Preferences, which will work even if the ink extra isn't in the menu bar.
 
Solution

I know this is a really old thread, but maybe this might be of help to others.

Using the kludge method above, when you want the window to close, don't use 1 or 0 values, use this instead:

Code:
do shell script "/usr/bin/defaults write com.apple.ink.framework inkWindowVisible -boolean No"

(and likewise, to open)

Code:
do shell script "/usr/bin/defaults write com.apple.ink.framework inkWindowVisible -boolean Yes"

It only wants a boolean value it seems, and if you just use a 1 or 0 it gets saved as a string. It also seems that whoever coded it only checked against a "No" boolean value since any other value makes the window open.

I hope this helps! I've been working on this problem for years now, slowly getting closer each time I take a swipe at it... now I have a nice scripted digital signature system using a wacom tablet. Thanks for getting me started in the right direction!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.