Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread Display Modes
Old Mar 15, 2013, 07:09 PM   #1
macrumors newbie
Join Date: Mar 2013
Question about applescript program

I have been trying to get applescript to enter a letter and then press enter in Safari. Ive already looked up programs, but they dont seem to work. The text box I need to type into is inside a game, and the programs just reload the page. It isnt necessary to have it press enter, if I could have it click in a specific spot on the screen. The program ive tried is this...
tell application "Safari"
	tell application "System Events" to keystroke "x" using command down
	tell application "System Events" to key code 52 using command down
	delay (random number from 1 to 10)
end tell
Any ideas?
youtheotube2 is offline   0 Reply With Quote
Old Mar 15, 2013, 08:02 PM   #2
macrumors regular
Join Date: Jul 2010
Is Safari active when this is running? Try adding “activate” after the first line.
ytk is offline   0 Reply With Quote
Old Aug 14, 2013, 04:21 PM   #3
macrumors newbie
Join Date: Aug 2013
Location: Sonora, CA
another idea to look into

I don't know if this would help but you may also want to see if there is a way to tell safari to focus on an element on the page. So you may want to view source and find the element ID of that text field to focus then have it echo or type what you need it to do.

Again sorry for lack of specifics I am also supper new to applescript.
jsdraven is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Possible AppleScript question Telp Mac Basics and Help 2 Mar 28, 2014 10:04 PM
AppleScript Question Mork OS X Mavericks (10.9) 0 Feb 12, 2014 09:32 AM
Program Runs Incorrectly When Triggered via AppleScript, fine when opened normally. JonHimself Mac Applications and Mac App Store 1 May 28, 2013 07:53 AM
Little question on Applescript Colty Mac Programming 3 Nov 22, 2012 05:24 PM
Languages to program on mac, and applescript? vim-espresso Mac Programming 4 Jul 30, 2012 04:32 AM

Forum Jump

All times are GMT -5. The time now is 11:56 AM.

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

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