Pass parameters from apple script to python to perform click operation
Hi,
I want to pass parameters to python script from apple script that i took using UIElements inspector to perform clicking on specific position (x,y) where i found my app's notification title.I could list titles and verify my own apps's then save its x,y position in a variable.Now i want to pass these variables in python script to click.I found this script to perform click at position:(1136,120).
(Used python script to click as unable to click using click command in apple script)
I want x and y parameters to set here coming from my apple script.
set x to 1136 as integer
set y to 120 as integer
how can i pass it here in python script??
-------------------------------------------------------------------------------- --------------------------
tell application "System Events"
tell process "Notification Center"
do shell script "
python <<-END
import sys
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
mouseEvent(kCGEventLeftMouseDown, posx,posy);
mouseEvent(kCGEventLeftMouseUp, posx,posy);
time.sleep(2);
ourEvent = CGEventCreate(None);
currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
mouseclick(1136, 120); --want to replace with mouseclick(x,y);
time.sleep(2);
mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
END
"
end tell
end tell
-------------------------------------------------------------------------------- --------------------------
if i am using this one:
do shell script "
python <<-END" & x & y &"
import......
then it gives error.
plz help me.
MacBook Pro, macOS High Sierra (10.13.6)