version 1.0

This commit is contained in:
AloneMonkey
2017-12-01 01:20:02 +08:00
parent 7a7c452ba3
commit 635d0986cf
4 changed files with 531 additions and 0 deletions

31
app.js Normal file
View File

@@ -0,0 +1,31 @@
//by: AloneMonkey
const LSApplicationWorkspace = ObjC.classes.LSApplicationWorkspace;
function openApplication(appid){
const workspace = LSApplicationWorkspace.defaultWorkspace();
return workspace.openApplicationWithBundleID_(appid);
}
function getbundleid(name){
const workspace = LSApplicationWorkspace.defaultWorkspace();
const apps = workspace.allApplications();
var result;
for(var index = 0; index < apps.count(); index++){
var proxy = apps.objectAtIndex_(index);
if(proxy.localizedName().toString() == name){
return proxy.bundleIdentifier().toString();
}
}
return ""
};
function handleMessage(message) {
const bundleid = getbundleid(message);
if(bundleid.length > 0){
openApplication(bundleid);
}
send({opened: "ok"});
}
recv(handleMessage);