def __init__(self, path=None, pid=None, url=None, desc=None, codecs= _defaultcodecs): """ path : str | None -- full path to local application pid : int | None -- Unix process id for local process url : str | None -- url for remote process desc : AEAddressDesc | None -- AEAddressDesc for application codecs : Codecs -- used to convert Python values to AEDescs and vice-versa Notes: - If no path, pid, url or aedesc is given, target will be 'current application'. - If path is given, application will be launched automatically; if pid, url or desc is given, user is responsible for ensuring application is running before sending it any events. """ self._codecs = codecs self._path = path if path: self._address = aemconnect.localapp(path) self.AEM_identity = ('path', path) elif pid: self._address = aemconnect.localappbypid(pid) self.AEM_identity = ('pid', pid) elif url: self._address = aemconnect.remoteapp(url) self.AEM_identity = ('url', url) elif desc: self._address = desc self.AEM_identity = ('desc', (desc.type, desc.data)) else: self._address = aemconnect.currentapp self.AEM_identity = ('current', None)
def reconnect(self): """If application has quit since this Application object was created, its AEAddressDesc is no longer valid so this Application object will not work even when application is restarted. reconnect() will update this Application object's AEAddressDesc so it's valid again. Note: this only works for Application objects specified by path, not by URL or AEDesc. Also, any Event objects created prior to calling reconnect() will still be invalid. """ if self._path: self._address = aemconnect.localapp(self._path)
def __init__(self, path=None, pid=None, url=None, desc=None, codecs=_defaultcodecs, newinstance=False, hide=False): """ path : str | None -- full path to local application pid : int | None -- Unix process id for local process url : str | None -- url for remote process desc : AEAddressDesc | None -- AEAddressDesc for application codecs : Codecs -- used to convert Python values to AEDescs and vice-versa newinstance : bool -- launch a new application instance? hide : bool -- hide after launch? Notes: - If no path, pid, url or aedesc is given, target will be 'current application'. - If path is given, application will be launched automatically; if pid, url or desc is given, user is responsible for ensuring application is running before sending it any events. - The newinstance and hide options only apply when specifying application by path. """ self._path, self._codecs, self._newinstance, self._hide = path, codecs, newinstance, hide if path: self._address = aemconnect.localapp(path, newinstance, hide) self.AEM_identity = ('path', path) elif pid: self._address = aemconnect.localappbypid(pid) self.AEM_identity = ('pid', pid) elif url: self._address = aemconnect.remoteapp(url) self.AEM_identity = ('url', url) elif desc: self._address = desc self.AEM_identity = ('desc', (desc.type, desc.data)) else: self._address = aemconnect.currentapp self.AEM_identity = ('current', None)
def reconnect(self): """If application has quit since this Application object was created, its AEAddressDesc is no longer valid so this Application object will not work even when application is restarted. reconnect() will update this Application object's AEAddressDesc so it's valid again. Notes: - This only works for Application objects specified by path, not by URL or AEDesc. Also, any Event objects created prior to calling reconnect() will still be invalid. - If the Application object was created with newinstance=True, calling reconnect() will launch a new application instance and connect to that each time it is called. Otherwise it will reconnect to the first existing application instance it finds, and only launches a new instance if none are found. """ if self._path: self._address = aemconnect.localapp(self._path, self._newinstance, self._hide)
def __init__(self, path=None, pid=None, url=None, desc=None, codecs= _defaultcodecs, newinstance=False, hide=False): """ path : str | None -- full path to local application pid : int | None -- Unix process id for local process url : str | None -- url for remote process desc : AEAddressDesc | None -- AEAddressDesc for application codecs : Codecs -- used to convert Python values to AEDescs and vice-versa newinstance : bool -- launch a new application instance? hide : bool -- hide after launch? Notes: - If no path, pid, url or aedesc is given, target will be 'current application'. - If path is given, application will be launched automatically; if pid, url or desc is given, user is responsible for ensuring application is running before sending it any events. - The newinstance and hide options only apply when specifying application by path. """ self._path, self._codecs, self._newinstance, self._hide = path, codecs, newinstance, hide if path: self._address = aemconnect.localapp(path, newinstance, hide) self.AEM_identity = ('path', path) elif pid: self._address = aemconnect.localappbypid(pid) self.AEM_identity = ('pid', pid) elif url: self._address = aemconnect.remoteapp(url) self.AEM_identity = ('url', url) elif desc: self._address = desc self.AEM_identity = ('desc', (desc.type, desc.data)) else: self._address = aemconnect.currentapp self.AEM_identity = ('current', None)
def __init__(self, path=None, pid=None, url=None, desc=None, codecs=_defaultcodecs): """ path : str | None -- full path to local application pid : int | None -- Unix process id for local process url : str | None -- url for remote process desc : AEAddressDesc | None -- AEAddressDesc for application codecs : Codecs -- used to convert Python values to AEDescs and vice-versa Notes: - If no path, pid, url or aedesc is given, target will be 'current application'. - If path is given, application will be launched automatically; if pid, url or desc is given, user is responsible for ensuring application is running before sending it any events. """ self._codecs = codecs self._path = path if path: self._address = aemconnect.localapp(path) self.AEM_identity = ('path', path) elif pid: self._address = aemconnect.localappbypid(pid) self.AEM_identity = ('pid', pid) elif url: self._address = aemconnect.remoteapp(url) self.AEM_identity = ('url', url) elif desc: self._address = desc self.AEM_identity = ('desc', (desc.type, desc.data)) else: self._address = aemconnect.currentapp self.AEM_identity = ('current', None)