Keystroke Spacebar ??

Happy New year to all!

I'm trying to get the keystroke for the spacebar to work, however (as a newbie to AS) I think I may have two issues to deal with:

1. I'm not sure what the "keystroke" for the spacebar is, to insert it into my script.

2. The window of the application I'm trying to run from the script, does not start as the frontmost window when the app opens via the script!

So ideally, once I know the keystroke, I'm still going to need to bring the app to the frontmost window, script the keystoke for the Spacebar to start the application, then make the main app to frontmost window again.

Any help would be most gratefully received.

Thanks in advance.

Mac OS X (10.5.4)

Posted on Jan 1, 2011 4:49 PM

Reply
2 replies

Jan 1, 2011 5:29 PM in response to willoghby

You can use the reserved word space, for example
keystroke space

To bring an application to the front, you can usually just tell it to activate. For example, running the following script from the *Script Editor* with a Finder window opened in the background will bring the window to the front and do a QuickLook (assuming you haven't changed the keyboard preference)

<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFCE75;
overflow: auto;"
title="this text can be pasted into the Script Editor">
tell application "Finder"
activate
tell application "System Events"
keystroke space
end tell
end tell
</pre>

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Keystroke Spacebar ??

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.