Hi
I'm very, very new to Applescript, and have got stuck almost immediately.
I'm a member of a sports club, and I want to automate the posting of the weekly training schedule on the club forum. I can get the script to create a new thread easily enough, but in order to enter the relevant text, I need to first select either the 'Title' field or the 'Message' field. This is where I'm getting stuck.
If I were to just type it in, I'd hit the Tab key to select the field, then enter text. But I can't get my script to do that for me.
Example code below (I've switched the URL to Macrumors forum for ease)...
Using Keystroke command
Gives me the following error : Can't get keystroke " ".
So I thought I'd try the Key Code command (#48 is tab I believe)
But that gives me error "Expected end of line, etc. but found identifier." at the key code statement.
I've googled this for ages, and everywhere I look, it seems I'm doing the correct thing, so why am I getting errors? I must be missing something simple?
All I want to do is select the field so I can key in 'Monday Night Swim' or something similar....it can't be that hard can it?
Thanks in advance
Steve
I'm very, very new to Applescript, and have got stuck almost immediately.
I'm a member of a sports club, and I want to automate the posting of the weekly training schedule on the club forum. I can get the script to create a new thread easily enough, but in order to enter the relevant text, I need to first select either the 'Title' field or the 'Message' field. This is where I'm getting stuck.
If I were to just type it in, I'd hit the Tab key to select the field, then enter text. But I can't get my script to do that for me.
Example code below (I've switched the URL to Macrumors forum for ease)...
Using Keystroke command
Code:
tell application "Safari" to launch
delay 0.1
open location "https://forums.macrumors.com/newthread.php?do=newthread&f=73"
keystroke tab
Gives me the following error : Can't get keystroke " ".
So I thought I'd try the Key Code command (#48 is tab I believe)
Code:
tell application "Safari" to launch
delay 0.1
open location "https://forums.macrumors.com/newthread.php?do=newthread&f=73"
key code 48
But that gives me error "Expected end of line, etc. but found identifier." at the key code statement.
I've googled this for ages, and everywhere I look, it seems I'm doing the correct thing, so why am I getting errors? I must be missing something simple?
All I want to do is select the field so I can key in 'Monday Night Swim' or something similar....it can't be that hard can it?
Thanks in advance
Steve