Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Applications > Mac Applications and Mac App Store

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 20, 2004, 04:45 PM   #1
rock6079
macrumors 6502
 
Join Date: Jan 2004
someone who knows applescript.. very quick question

i want to create an apple script that will launch a certain application and after it laucnehd just send a KeyPress of "return" key..

trying to record it doesnt work...
i was able to come up with this just out of logic, and a my very small understanding of applescript. the program i want to use doesnt have a dictionary. ive seen examples where it says "KeyPress Command "c"" for example, i tried doing "KeyPress Return" but it didnt work. so if n e one has ne ideas and can help, very appreciated

tell application "Finder"
open application application

end tell
rock6079 is offline   0 Reply With Quote
Old Aug 21, 2004, 04:08 AM   #2
HexMonkey
Administrator
 
HexMonkey's Avatar
 
Join Date: Feb 2004
Location: New Zealand
This should do it, just put the application name as the applicationName property.

Code:
property applicationName : "" --Put the application name inside the speech marks

tell application applicationName
	activate --Open and activate the application
	tell application "System Events"
		tell process applicationName
			try
				key code 36 --Type the return key
			on error theError
				display dialog ("Sorry, an error occured:" & theError) buttons "OK" default button "OK" with icon stop
			end try
		end tell
	end tell
end tell
If the script doesn't work, go to System Preferences and make sure the following option is checked:
Universal Access->Enable access for assistive devices (at the bottom).
HexMonkey is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Applications > Mac Applications and Mac App Store

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Could someone who knows about Terminal give me some help? Ripmax2000 Mac Programming 8 Nov 6, 2007 10:01 AM
Very quick question about MBP. very very quick. theman MacBook Pro 26 Oct 31, 2007 07:10 PM
Can someone who knows about Folding please help! Aniej Mac Basics and Help 0 Jan 3, 2007 06:01 PM
Help on political campaign by someone who knows Excel features well Aniej Mac Basics and Help 6 Dec 16, 2006 08:57 PM
Need RAM advice from someone who knows! cleo Macintosh Computers 3 Dec 13, 2004 06:42 PM


All times are GMT -5. The time now is 04:29 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC