if my other code worked, then this might also:
#Import <AppKit/AppKit.h>
NSPoint getWindowX(){
NSApplication *myApp = [NSApplication sharedApplication];
NSWindow *myWindow = [myApp keyWindow];
NSRect myFrame = [myWindow frame] ;
NSPoint theOrigin = myFrame.origin;
Return theOrigin;
};