Hey Everyone!
First post
I’ve been working on a script for the past 2 weeks, and I’ve done a LOT of research. I’m kind of stuck with these dang dialog boxes. I don’t get how to add the “text returned” from a dialog box to an actual text field.
The basic goals of the script.
- Open safari
- Go to a secure website (the website shows our daily sales goals at our store and multiple other stores)
- Select the login and password text field
- Prompt the user with a dialog box for username and password and paste it into the text fields
- I would like the script not to continue of the login and password is incorrect, or maybe just restart the user and PW dialog boxes.
- After that, the script is going to open up 5-7 more tabs and auto select what to show. (I think I have this part down packed). Then it is going to cycle through each tab every 10 seconds.
We will use Hotmail for example. This is what I have so far; This was obviously very easy
tell application "Safari"
activate
open location "http://www.hotmail.com"
end tell
display dialog "enter your login:" default answer "" buttons {"ok", "cancel"}
This is the entire script I came up with. I just do not want to store the username or password in the script because this is going out to multiple people.
tell application "Safari"
activate
open location "http://XXXXXXXXXX"
delay 10
tell application "System Events"
keystroke tab
keystroke tab
keystroke tab
end tell
tell application "System Events" to keystroke "USERNAME" & tab & "PASSWORD" & return
end tell
delay 1
tell application "Safari"
open location "http://XXXXXXXXXXXXX"
end tell
-- Safari opening for XXXXXXX
tell application "Safari"
activate
set the URL of document 1 to "http://XXXXXXXXXXX"
delay 10
tell application "System Events"
tell application process "safari"
keystroke tab
keystroke tab
key code 45
delay 3
keystroke tab
key code XX
key code XX
keystroke tab
end tell
end tell
delay 3
my new_tab() --Safari opening for XXXXXXXX
set the URL of document 1 to "http://XXXXXXXXXX"
delay 5
tell application "System Events"
tell application process "safari"
keystroke tab
keystroke tab
keystroke tab
key code XX
keystroke tab
end tell
end tell
delay 3
my new_tab() --Safari opening for XXXXXXX
set the URL of document 1 to "http://XXXXXXXXXX"
delay 5
tell application "System Events"
tell application process "safari"
keystroke tab
keystroke tab
keystroke tab
key code XX
delay 1
end tell
end tell
delay 3
my new_tab() --Safari opening for XXXXXX
set the URL of document 1 to "http://XXXXXXXXXXXX"
delay 5
tell application "System Events"
tell application process "safari"
keystroke tab
keystroke tab
keystroke tab
key code XX
keystroke tab
end tell
end tell
delay 3
my new_tab() -- Safari opening for XXXXXXX
set the URL of document 1 to "http://XXXXXXXX"
delay 5
tell application "System Events"
tell application process "safari"
keystroke tab
keystroke tab
keystroke tab
key code XX
keystroke tab
end tell
end tell
end tell
on new_tab()
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
end new_tab
tell application "System Events"
tell application process "safari"
repeat 1000000 times
keystroke tab using control down
delay 7
end repeat
end tell
end tell
Thanks for all the help