|
|
Using Automater or AppleScript to Log into website each day
|
|
|
|
Fresh-Faced Recruit
Join Date: Oct 2005
Status:
Offline
|
|
I need a script or automation function that will automatically log into CRM Software Leader | Customer Relationship Management (CRM) each morning during the workweek. I'd like the time to vary in a 10 min window each day. Is there a way that i can set this up? Are there any available resources or examples that i could draw from? is this even possible??
thanks in advance!
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Mar 2003
Location: Knoxville
Status:
Offline
|
|
|
timeline - SE/30, some crappy performa, original bondi iMac 233, TiBook500, macbook pro 2GHz
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Jan 2002
Location: London, UK
Status:
Offline
|
|
Such an ability would probably be a massive security hole in the OS, so hopefully it isn't!
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Feb 2001
Location: Sitting in front of computer
Status:
Offline
|
|
Im sure its possible. Maybe with AppleScript UI scripting?
|
I free'd my mind... now it won't come back.
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jan 2007
Location: In front of my Mac
Status:
Offline
|
|
I know I'm three weeks late, but do you still want this script?
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Oct 2005
Status:
Offline
|
|
yeah, please send it over..thanks!!
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jan 2007
Location: In front of my Mac
Status:
Offline
|
|
I think the following will work for you (worked for me, except for not having a username or password). As it's set up now, it would login everyday at 8am, give or take 10 minutes (provided your computer isn't in sleep mode). Let me know if you have any problems/questions.
set runDate to 0
repeat
--The next three lines create variation in execution time.
--If you don't want any variation, just change
--the numbers in the first line to 0.
--Otherwise, the action will occur plus or minus
--the number of seconds you set
set timeVariation to random number from -600 to 600
set theDate to current date
set randomTime to (time of theDate) + timeVariation
--this set up makes sure the program only runs once
--per day
if runDate is day of theDate then
delay 60
else
--the following line is the time of execution in seconds
--past midnight. So 8am is 8 hours X 60 minutes X 60 seconds
--which is 28800. If you have variation set above, then include
--that in the calculation. Therefore, 10 minutes (600 seconds)
--of variation either way would be > 28200 and < 29400.
--Because the script checks the time once per minute (to reduce
--the amount of cpu usage, you should have at least 2 minutes
--of buffer time (e.g. > 28140 and <29460)
if randomTime > 28140 and randomTime < 29460 then
--Replace with Browser of choice (I know Safari and Firefox will both work)
tell application "Firefox"
Get URL "https://www.salesforce.com/login.jsp"
end tell
--The following delay allows the page to load (sometimes it took a while)
delay 15
tell application "Firefox" --again, replace with right browser
activate --this is required to bring the app to the front.
end tell
tell application "System Events"
tell process "Firefox"
keystroke "UserName" & tab --keep quotes, use your own username
delay 0.5
keystroke "Password" & return --keep quotes, use your p/w
delay 1200 --how many seconds do you want to stay logged in?
--make sure its at least equal to total variation or there's
--a chance you'll execute the script twice in a day.
end tell
end tell
set runDate to day of theDate
else
delay 60
end if
end if
end repeat
(
Last edited by Z's Mac; Jan 22, 2007 at 12:02 AM.
Reason: Further explain the current settings.)
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jan 2007
Location: In front of my Mac
Status:
Offline
|
|
1) Did you implement the script liq2?
2) Parsimony is always a good goal, does anyone know of an easier (e.g. less code) way to execute the task daily with the ten minute window? Ideally it would be good to not have to run the script every minute to see if it's time to run the script.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status:
Offline
|
|
For (2), why not use launchd or an iCal alarm?
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jan 2007
Location: In front of my Mac
Status:
Offline
|
|
Both launchd and iCal would allows the script to be run at a specific time. However, the request was for a 10 minute variation in start time. Is there a way, using launchd or iCal, to have a random (within 10 minutes) start time?
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status:
Offline
|
|
Well, you could just launch the script at a determined time, and then have the script begin with a random delay.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status:
Offline
|
|
I guess I don't get the point of the 10 minute window, but yeah Mithras that would work.
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jan 2007
Location: In front of my Mac
Status:
Offline
|
|
Originally Posted by Mithras
Well, you could just launch the script at a determined time, and then have the script begin with a random delay.
That's a good idea. Didn't think of that.
Originally Posted by itai195
I guess I don't get the point of the 10 minute window, but yeah Mithras that would work.
I'm guessing the reason the original request asked for a 10 minute window was because if he logged in at exactly the same time every day it would be an obvious automation. Possibility is that he wants to appear to be at work?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|