error message
ginakiele5 opened this issue · 0 comments
tell application "Script Editor"
display dialog "Welcome to Delivery Slot Search Tool!
INSTRUCTIONS:
- Sign into Amazon.com in Safari
- Fill your grocery cart
- Manually start and continue the checkout process until you arrive at the delivery slot page. The session is now initialized. Close this slot page. It's no longer needed.
- Turn up the volume to hear the announcement when a slot is found
- Adjust your 'Energy Saver' settings in 'System Preferences' so the the display never turns off. Also plug in your laptop, if possible
- Go to Safari.
- Read the DISCLAIMER
- Click 'Continue'. After you answer the prompts, the tool will start searching for slots
DISCLAIMER:
No guarantee that slots will be found and/or that slots will work. Often you will select a slot but the page will refresh and the slot will disappear. These phantom slots are very common and are in Amazon's control, not mine. Eventually a slot should work. Some users report success of after 20+ tries. Wishing you resilience and hope!
FEEDBACK:
Post any concerns/feedback on GitHub issue page" with title "Welcome" with icon stop buttons {"Cancel", "Continue"} default button "Continue"
--> {button returned:"Continue"}
display dialog "Amazon gives notices when items in your cart go out of stock.
Would you like the script to:
A. automatically ignore the warnings so it keep looking for slots (recommended)
B. stop searching for slots until you manually review what went out of stock?" buttons {"Cancel", "A. Keep looking for slots", "B. Wait for me to review"} default button "A. Keep looking for slots" with title "Ignore Out Of Stock?" with icon note
--> {button returned:"A. Keep looking for slots"}
display dialog "The advanced features of this tool involve clicking on and navigating the Amazon website. The following permission MUST be enabled for this tool to run.
INSTRUCTIONS:
- While in Safari, push Command-comma together to open Safari Preferences.
- Go to the 'Advanced' page on the far right and enable 'Show develop menu in menu bar' at the very bottom.
- Click 'Develop' in the menu bar at the top of the screen and click 'Allow Javascript from Apple Events' to enable it.
- When finished, click 'Done' to proceed or 'Exit Script' to stop using this tool" with title "More access needed" buttons {"End Script", "Done"} with icon stop default button "Done"
--> {button returned:"Done"}
end tell
tell current application
do shell script "/bin/ls /System/Applications/Messages.app/Contents/Resources/MessagesAppIcon.icns"
--> "/System/Applications/Messages.app/Contents/Resources/MessagesAppIcon.icns"
end tell
tell application "Script Editor"
display dialog "Would you like to receive text messages when delivery slots appear?
Note: If you haven't previously used your Mac's 'Messages' app to send or receive texts, select 'No'" buttons {"Cancel", "Yes", "No"} default button "Yes" with title "Text Notifications" with icon file "System:Applications:Messages.app:Contents:Resources:MessagesAppIcon.icns"
--> {button returned:"No"}
end tell
(user selected no text messaging)
tell application "Script Editor"
display dialog "What delivery service do you want to use this script for?" buttons {"Cancel", "Whole Foods via Amazon.com", "Amazon Fresh"} with icon note with title "Which Service?"
--> {button returned:"Whole Foods via Amazon.com"}
display dialog "The script will start searching for slots once you click 'Continue'.
HOW DO I KNOW IT'S WORKING?
The tool will open and minimize a window once you click 'Continue'. It will quietly search in that window. You won't be get any notifications until A) a slot appears or B) an item goes out of stock and you selected to be notified. If you want to verify the script is running, you can open the minimized window and watch it open and close the slot page every ~60 seconds. You can then minimize the window again or leave it open. Just don't close it" buttons {"Cancel", "Continue"} with title "Configuration Complete" with icon note default button "Continue"
--> {button returned:"Continue"}
end tell
tell application "Safari"
make new document
--> document "Favorites"
get id of window 1
--> 749
make new tab with properties {URL:"https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1"}
--> tab 2 of window id 749
set current tab of window id 749 to last tab of window id 749
set miniaturized of window id 749 to true
get every text of last tab of window id 749
--> "
Schedule your order
Due to increased demand, available windows are limited. Please check back later or shop a Whole Foods Market near you.
Select a location
We’ll leave your order at your doorstep. To receive it in person, switch to Attended Delivery.
Delivery to:
Gina M. Cohen - 190 WASHINGTON ST, WELLESLEY HILLS, MA 02481-3108
Change
Select a day
Today
Apr 9
Not available
Tomorrow
Apr 10
Not available
Select a time
Be sure to chill your perishables immediately upon receiving your order.
No delivery windows available. New windows are released throughout the day.
Select your delivery window
Continue
"
close last tab of window id 749
end tell
(no slots found)
tell application "Safari"
make new tab with properties {URL:"https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1"}
--> tab 2 of window id 749
set current tab of window id 749 to last tab of window id 749
get every text of last tab of window id 749
--> "
Schedule your order
Due to increased demand, available windows are limited. Please check back later or shop a Whole Foods Market near you.
Select a location
We’ll leave your order at your doorstep. To receive it in person, switch to Attended Delivery.
Delivery to:
Gina M. Cohen - 190 WASHINGTON ST, WELLESLEY HILLS, MA 02481-3108
Change
Select a day
Today
Apr 9
Not available
Tomorrow
Apr 10
Not available
Select a time
Be sure to chill your perishables immediately upon receiving your order.
No delivery windows available. New windows are released throughout the day.
Select your delivery window
Continue
"
close last tab of window id 749
end tell
(no slots found)
tell application "Safari"
make new tab with properties {URL:"https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1"}
--> tab 2 of window id 749
set current tab of window id 749 to last tab of window id 749
get every text of last tab of window id 749
--> "
Schedule your order
Due to increased demand, available windows are limited. Please check back later or shop a Whole Foods Market near you.
Select a location
We’ll leave your order at your doorstep. To receive it in person, switch to Attended Delivery.
Delivery to:
Gina M. Cohen - 190 WASHINGTON ST, WELLESLEY HILLS, MA 02481-3108
Change
Select a day
Today
Apr 9
Not available
Tomorrow
Apr 10
Not available
Select a time
Be sure to chill your perishables immediately upon receiving your order.
No delivery windows available. New windows are released throughout the day.
Select your delivery window
Continue
"
close last tab of window id 749
end tell
(no slots found)
tell application "Safari"
make new tab with properties {URL:"https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1"}
--> tab 2 of window id 749
set current tab of window id 749 to last tab of window id 749
get every text of last tab of window id 749
--> error number -1728 from window id 749
Result:
-- 'ascr''err '{ '----':'utxt'("Can’t make every text of last «class bTab» of window id 749 of application "Safari" into type string."), 'errn':-1700, 'erob':'obj '{ 'form':'indx', 'want':'ctxt', 'seld':'abso'(