ahertel/Amazon-Fresh-Whole-Foods-delivery-slot-finder

syntax error

ginakiele5 opened this issue · 0 comments

		-- send text notification
		if sendTexts then
			-- Credit for texting code: Sean Pinkey, https://github.com/spinkney
			tell application "Messages"
				set targetService to 1st service whose service type = iMessage
				set targetBuddy to buddy phoneNumber of targetService
				send deliverySlotFoundTextMsg to targetBuddy
			end tell
			log "text message sent about slot found"
		end if
		
		-- bring Safari window to front and expand to fill screen so delivery slots are clearly visible
		tell application "Safari"
			-- unminimize
			set miniaturized of window id amzn_win_id to false
			-- wait for window to open
			delay 1
			-- maximize window 
			-- this might be useful later on if I want to have it take a screenshot as proof of delivery slots found
			-- Credit for fill to screen: https://macosxautomation.com/applescript/firsttutorial/18.html
			tell application "System Events"
				tell application "Finder" to get the bounds of the window of the desktop
				tell application "Safari" to set the bounds of the front window to ¬
					{0, 22, (3rd item of the result), (4th item of the result)}
			end tell
		end tell
		
		-- signals that the loop should end
		set found_slot to true
	else
		-- encountered unknown page
		-- will navigate back to the cart and from there back to the slot selection page
		log "unknown page encountered"
		restartCheckout(selected_cart_url, amzn_win_id)
	end if
end repeat

else
log "user did not confirm javascript access was enabled. exiting due to insufficient permissions"
end iftell application "Finder"
activate
open document file "delivery-window-finder.scpt" of folder "Amazon-Fresh-Whole-Foods-delivery-slot-finder-master" of folder "Downloads" of folder "ginamariacohen" of folder "Users" of startup disk
end tell
tell application "Finder"
activate
close Finder window id 252
end tell