|Jan 2, 2007, 05:17 PM||#1|
very basic applescript just won't work
I'm a total newbie with applescript, and have looked around to try and find an answer to this, as well as tried to find ways around it but am a bit stuck...
I am trying to use an incredibly basic task with applescript, but I can't get it to work...
what I'm trying to do is:
so my code looks like this (I hope I'm doing this right..):
set CR to ASCII character of 13
open location "http://www.myurl.com"
However I get an applescript error telling me
Can't make keystroke " " into type reference.
with the "keystroke tab" element highlighted..
what am I doing wrong?
|Jan 2, 2007, 06:06 PM||#2|
keystroke is a command in the System Events dictionary so you need to embed it in a tell application "System Events" block.
The other problem you might run into is that the commands in the script following the open location line are run before the page has finished loading. As a workaround I've put in a delay of a few seconds before the keystrokes are sent, but you might want to adjust the number depending on the time it takes the page to load for you, and how consistent it is.
tell application "Firefox" to activate set CR to ASCII character of 13 open location "http://forums.macrumors.com" delay 3 tell application "System Events" keystroke tab keystroke CR end tell
|Jan 2, 2007, 06:12 PM||#3|
absolutely perfect, that's exactly what was needed..
I tried delaying it before but it didn't change anything, it was obviously just the system events part that was wrong.. I wonder why I couldn't find that anywhere?
anyway thanks ever so much!!
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Basic Terminal Functions do not work||imanoreotwe||Mac Basics and Help||13||Dec 12, 2013 10:27 PM|
|My first applescript doesn't work. Please help.||jbmoore||Mac Programming||4||Sep 15, 2013 04:17 PM|
|Very Basic AppleScript Question||TheMTtakeover||Mac Programming||2||Dec 13, 2012 04:45 AM|
|Very basic Applescript to run command||bjbyers||Mac Programming||1||Nov 27, 2012 03:03 PM|
|Basic question about way retina-optimized apps work||macbook123||MacBook Pro||7||Jul 5, 2012 09:14 AM|
All times are GMT -5. The time now is 01:26 AM.