If you sell on eBay and need to send a note to the buyer one of the ways to do it is using AppleScript generated from the database on-the-fly and running it from any program like bash, perl, C etc.
View Codetell application "Safari"
activate
make new document
delay 2
-- !EBAYCODE! is the eBay Auction number - a long number of digits
-- !BUYER! is a buyer email
set URL of document 1 to "http://contact.ebay.com/ws/eBayISAPI.dll?ReturnUserEmail&requested=!BUYER!&redirect=0&iid=!EBAYCODE!"
set myURL to URL of document 1
delay 5
set web_page_is_loaded to false
set myCounter to 0
set maxCounter to 30
set my_delay to 2
repeat until web_page_is_loaded is true
if name of window 1 contains "Loading" or name of window 1 contains "Untitled" then
delay my_delay
else
set web_page_is_loaded to true
end if
set myCounter to myCounter + 1
if myCounter is maxCounter then
set web_page_is_loaded to true
end if
end repeat
end tell
delay 1
-- check if computer is logged-in to eBay or not
set whichPage to seeCode()
-- if not logged-in - login usine external AppleScript saved as application
if whichPage is false then
set p to "/ebay.login.app"
set otherScript to POSIX file p as alias
set myScript to load script otherScript
set myResult to myScript\'s doLogin()
--doLogin()
delay 5
end if
delay 5
tell application "Safari"
do "document.getElementsByName('message')[0].focus();" in document 1
delay 1
tell application "System Events"
tell application process "Safari"
keystroke tab using {shift down}
delay 1
keystroke "Your Subject Goes Here"
delay 3
keystroke tab
delay 2
keystroke "a" using {command down}
delay 1
keystroke "x" using {command down}
delay 1
-- your message goes here
keystroke "Dear Steve,"
keystroke return
keystroke "Your product have been shipped Today and you should expect it soon."
keystroke return
keystroke "Please leave your feedback once you have received a product."
keystroke return
keystroke "Thank you for your purchase!"
keystroke return
-- end of your message
delay 17
keystroke tab
delay 1
keystroke tab
delay 5
keystroke return
delay 17
end tell
end tell
set web_page_is_loaded to false
set myCounter to 0
set maxCounter to 30
set my_delay to 2
repeat until web_page_is_loaded is true
if name of window 1 contains "Loading" or name of window 1 contains "Untitled" then
delay my_delay
else
set web_page_is_loaded to true
end if
set myCounter to myCounter + 1
if myCounter is maxCounter then
set web_page_is_loaded to true
end if
end repeat
end tell
tell application "System Events"
tell process "Safari"
keystroke "w" using {command down}
delay 1
end tell
end tell
on seeCode()
tell application "System Events"
tell process "Safari"
keystroke tab
delay 1
keystroke tab
delay 1
keystroke "a" using {command down}
delay 2
keystroke "c" using {command down}
delay 2
set page_text to (the clipboard) as text
delay 2
end tell
end tell
if page_text contains "Sign in to your account" then
return false
else
return true
end if
end seeCode
and this is your login AppleScript saved as application. Do not forget to adjust a path to this application in script above!
View Codeon doLogin()
tell application "Safari"
do "document.getElementById('userid').focus()" in document 1
delay 1
tell application "System Events"
tell process "Safari"
keystroke "Your_eBay_username"
delay 1
keystroke tab
delay 1
keystroke "your_eBay_password"
delay 1
keystroke return
delay 2
end tell
end tell
set web_page_is_loaded to false
set myCounter to 0
set maxCounter to 30
set my_delay to 1
repeat until web_page_is_loaded is true
if name of window 1 contains "Loading" or name of window 1 contains "Untitled" then
delay my_delay
else
set web_page_is_loaded to true
end if
set myCounter to myCounter + 1
if myCounter is maxCounter then
set web_page_is_loaded to true
end if
end repeat
end tell
end doLogin