Yeah, knowing what to search for is key. I still miss my cubicle neighbor at Disney who had a gift for Google searches. Even if he didn't know the subject, he just "spoke" Google.
Bookmarked. Thanks!
Yeah, knowing what to search for is key. I still miss my cubicle neighbor at Disney who had a gift for Google searches. Even if he didn't know the subject, he just "spoke" Google.
Bookmarked. Thanks!
@JMichaelTX, @ComplexPoint, @peternlewis -
I might be on to something. Iām gonna take a break for a while, maybe the rest of the evening. But I thought I should report this, because one of you might have a lightbulb moment after I share this.
I was hoping I could get something to work as long as I didnāt have more than one copy of a file open. Nothing seemed to work. Until I tried UI Automation properties/functions/whatever.
This appears to work every time, but as I said, Iām stopping for now.
(function Run() {
'use strict';
var _xcode = Application("Xcode");
_xcode.activate();
delay(1);
var _systemEvents = Application("System Events");
var _xcode = _systemEvents.processes["Xcode"];
var _window = _xcode.windows[0];
return _window.title();
})()
Now, it may only work because Iām using āactivateā. Havenāt checked that yet.
Iām want to see if I can get some of the attributes shown in UI Browser. Iām able to get Role, although itās called āAXRoleā in UI Browser, so donāt know if itās the same or not. If anyone can figure out how to get other attributes, that might help also.
'Night.
.properties()
gives some idea of what's accessible
(function () {
'use strict';
Application('Xcode').activate();
var se = Application('System Events'),
procs = se.applicationProcesses.whose({
name: 'XCode'
}),
proc = procs.length ? procs[0] : undefined;
if (proc) {
var ws = proc.windows,
w = ws.length ? ws[0] : undefined;
return w && w.properties();
}
})();
Awesome!
Did you see my question about Atom? I canāt seem to get it to build JavaScript. I think I just configured something wrong. Any ideas?
Once you have installed the packages:
you can save your source with an .scpt extension
and then run it in the editor with āI
I also use the atom-beautify package for automatic code formatting,
running my .scpt JavaScript for Automation code through the JS beautifier with:
Awesome! Does this support debugging via Safari?
From the Script Package in Atom, you can certainly launch a JSContexts debugging session in the Safari debugger. I do this all the time with the TaskPaper 3 JSContext.
The level of access is determined, however, by the particular JSContext, rather than by Atom. Safari only seems to allow access to through Script Editor for the Automation JSContext, so at the moment when I need to debug I duplicate the source file and access the debugging session from a copy in SE.
SE is not alas, an unalloyed delight ā no comment-toggling, no block indent or block outdent, no automatic JavaScript formatting, but it does crash
LOL! For sure.
Do you use a macro in Atom to setup SD and run it through the debugger?
SD as in the AppleScript Script Debugger ?
Perhaps SD -> SE ?
No, I should probably take a moment to automate the flipping out to Script Editor for debugging. Havenāt done that.
Yeah.
Script Editor, when youāre debugging. The process you just explained.
As above - not yet ā¦
OK, cool. I donāt use the debugger a lot, especially since it almost never helps.
I find the Safari debugger very good
A good perspective from which to understand the object interfaces and probe them a bit.
Oh, yeah. Itās just that the things Iām trying to debug, as I learn this stuff, are rarely helped by the debugger. Once Iām up to snuff, then it will be helpful. I hope.
Atom question: When I comment out lines, I like to use ā//ā, and I like the slashes to stay in columns 1-2, not indented. Any way to get them to stay there? Beautify, and for that matter Pasting, wants to indent them.
The fine-tuning of Beautify (not sure if there is a setting for that) is at:
Atom > Preferences > Packages > Atom Beautify > JavaScript > Settings
Incidentally under Preferences > Packages for Script, you will find the keybindings:
Any way to get Atom to warn me on exit if I have unsaved files?
Iām such an inveterate saver that I havenāt looked into that.
As youāve probably found, it automatically saves sessions, and reopens the same tabs, in the same state after a simple quit.