Created
October 17, 2014 23:42
-
-
Save Noitidart/8b875261d1a9dbd6b0cf to your computer and use it in GitHub Desktop.
_applescript-FocusMostRecentWindow -
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" to tell application process "Firefox" | |
tell application "Firefox" | |
activate | |
tell windows | |
set minimized to false | |
set visible to true | |
end tell | |
end tell | |
end tell |
This popen
does AXRaise
and it does it as System Events
Cu.import('resource://gre/modules/ctypes.jsm');
function doit() {
_x11 = ctypes.open('libc.dylib');
var popen = _x11.declare('popen', ctypes.default_abi, ctypes.voidptr_t, // Return int
ctypes.char.ptr, // Param1 const char *command
ctypes.char.ptr // Param1 const char *command
);
var fread = _x11.declare('fread', ctypes.default_abi, ctypes.size_t, // Return int
ctypes.voidptr_t,
ctypes.size_t,
ctypes.size_t,
ctypes.voidptr_t
);
var pclose = _x11.declare('pclose', ctypes.default_abi, ctypes.int, // Return int
ctypes.voidptr_t
);
////////////////////////
////END DECLARATIONS
////////////////////////
var file = popen('osascript -e \'tell application "System Events" to tell first process whose unix id is 398 \n set frontmost to true \n \n perform action "AXRaise" \n end tell\'', 'r')
console.log(file.toString())
pclose(file);
}
console.time('popen');
doit();
console.timeEnd('popen')
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can run via popen from addon: