Command Shift 3 problem ...

Hello MacScripters,

Newbie here (and only basic applescripting - have searched the forums but haven’t found my answer …

Problem

I have an artwork which monitors movement in an art gallery space and displays this on a widescreen monitor outside the gallery space as a gradiated grayscale image, this is done with a Projector created using Macromedia Director with the Track Them Colours xtra, this works fine, apart from my idea that when a certain density of the image is reached it would print out limited editions of the current stage image and then reset to a blank screen and start all over again. Directors printFrom crashes the system, and from reading forums seems to be a Mac problem, so until I can get some extra funding to buy a printing xtra I thought about trying to sort out an alternative using actionscript.

I want create an application that I can run using iCal as a scheduler so that the Director stage is printed out at a specified time(s) during the day.

My first step is to grab the screen so I am trying this


-- Print screen to pdf file on the desktop?

tell application "System Events"
	keystroke "3" using {command down, shift down}
end tell

however it doesn’t work, any ideas why?

Regards

Pete

This seems to work, but I don’t know how reliable it is:

tell application "System Events"
	keystroke "#" using {command down}
end tell

I would use this instead:

do shell script "/usr/sbin/screencapture -x " & quoted form of POSIX path of ((path to desktop as Unicode text) & "Screen Capture.png")

Dear Bruce

Thanks for the quick reply, interestingly this is dependant on the language of your keyboard

for me this is the equivilent of keystroke “3” using {command down, alt down} as I get the hash key with alt 3, however most excellent idea of the directly referencing the shifted keystroke as when I use

 keystroke "£" using {command down}

it works just fine … £ being the UK keyboard for shift+3, interestingly when I change my keyboard to US and use your keystroke “#” it doesn’t work… anyway thanks very much for this, it now works!

Also thanks for the UNIX shell solution, I will look into using that, however I like the first solution for now as it autonumbers the files … as I said I am new to scripting …

Thanks again for such a prompt answer

Pete - A happy newbie :slight_smile:

I thought that would be the case.

Try something like this:

do shell script "cd " & quoted form of POSIX path of (path to desktop) & ¬
	"; COUNT=`/bin/ls" & ¬
	" | /usr/bin/grep '^Picture [0-9]\\+\\.png$'" & ¬
	" | /usr/bin/grep --only-matching '[0-9]\\+'" & ¬
	" | /usr/bin/sort --reverse --numeric-sort" & ¬
	" | /usr/bin/head -n 1`" & ¬
	"; COUNT=`echo \"$COUNT\" + 1 | /usr/bin/bc`" & ¬
	"; /usr/sbin/screencapture -x \"Picture $COUNT.png\""

Thanks yet again,

time to dust off the UNIX books I bought when I was working on my original NeXT cube, ahhh memories …

Pete