help with button script Please

im just new to applescript and finding my feet. i would appreciate help
from the more advance users to a problem i have encountered
i need to be able to choose a menu item in the pop up menu called
“WHC Cottages” then “change all” button clicked
i have managed to write the script so far to open the menu window
is this easy to do? im using Indesign cs4.

this form part of an automator script

many thanks for any replies and taking your valuable time to respond

please see screenshot link below

Model: mac
AppleScript: 2.1.2
Browser: Safari 534.58.2
Operating System: Mac OS X (10.6)


You must find and download MouseLocation and cliclick, to make the script below work. Play with it, as a script by running it in the gui, I have serious doubts as to whether you can make this work in an automator workflow.

But the general idea is that you run the script to activate it, then you perform as many “keyccode down” as you need, before you execute a keycode enter, on the menu item you want to execute.

-- McUsr
set mouseLoc to (do shell script "/usr/local/opt/MouseLocation")
set {astid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ","}
tell mouseLoc to set {mouseX, mouseY} to {it's text item 1, it's text item 2}
set {mouseX, mouseY} to {(mouseX as integer), 1200 - (mouseY as integer)}

tell application "System Events"
	set frontProcessName to name of every process whose frontmost is true
	--	tell a to set aa to (get its name)
	set wnCount to count of windows of process named frontProcessName
	if wnCount > 0 then
		tell window 1 of process named frontProcessName
			set wnPos to its position
			set wnsize to its size
		end tell
		set {wnX, wnY, wnWidth, wnHeight} to {item 1 of wnPos, item 2 of wnPos, item 1 of wnsize, item 2 of wnsize}
		set {leftBound, RightBound, upperBound, lowerBound} to {wnX + 1, (wnX + wnWidth - 21), wnY + 50, (wnY + wnHeight - 51)}
		if mouseX ≥ leftBound and mouseX ≤ RightBound then
		else if mouseX < leftBound then
			set mouseX to leftBound
			log "a"
			set mouseX to RightBound
			log "b"
		end if
		if mouseY ≥ upperBound and mouseY ≤ lowerBound then
		else if mouseY < upperBound then
			set mouseY to upperBound
			log "c"
			set mouseY to lowerBound
			log "d"
		end if
	end if
end tell
set mouseLoc to "c" & mouseX & " " & mouseY
do shell script "/usr/local/opt/cliclick " & mouseLoc
set AppleScript's text item delimiters to astid

I hope this helps, and good luck! :slight_smile:

Many thanks

McUsrII i will give it a try and play with the co - ordinates as suggested



Just adapt it, anyway you see fit, your bigggest challenge will be to make the applescript work as intended under Automator.

This handler may help, for logging a message to a file, without .log extension, that you can look at in the

It is also known to work within try error blocks! You need to prepend it with “my” within any tell application blocks.

to logit(log_string, log_file)
	do shell script ¬
		"echo `date '+%Y-%m-%d %T: '`\"" & log_string & ¬
		"\" >> $HOME/Library/Logs/" & log_file & ".log"
end logit

Good luck!