How to get a list of functions supported by an application? - hammerspoon

I'm new to Hammerspoon, but interested in automating some macOS workflows with it.
Many examples seem to directly access functions provided by a target application itself - but how does one find out which functions are provided and how they have to be used?
Thanks in advance for any help!

since I may have found an answer myself (or s.th. which comes close to it) let me summarize it here:
Script Editor
One possible approach may be to exploit the built-in macOS "Script Editor" (to be found in folder "Applications" > "Utilities").
Just open the "Script Editor" and - from the menu - choose "Window" > "Library". This will give you a list of automatable applications. Double-clicking on any of these applications will give you a documented list of methods and properties that application provides.
By default, the documentation will use AppleScript syntax - it may be useful to switch to JavaScript using the dropdown just below the window's title bar instead.
Right now, I have no idea if the list (of applications and/or provided properties and methods) is complete or not.
Additionally, you will need a little bit of "fantasy" to map AppleScript/JavaScript definitions to Lua...
I found this recipe in an "DevOps Zone" article
Script Debugger (Lite)
An alternative seems to be the "Script Debugger" from "Late Night Software" - the free "Lite" version seems to be sufficient.
From the menu, simply choose "File" > "Open Dictionary" for an (already open) application of your choice. The "Preview Dictionary" window will then show you a list of all properties and methods provided - and the "Explorer" tab will allow you to inspect them.

Related

How to do a search & replace of Link Properties within a PDF using Adobe Acrobat XI Pro

I am attempting to find an elegant solution to an issue for another department within my agency, and I am hoping somebody can provide me with a path to discovering the right solution.
The problem: The user currently has large number of links which (A) deliver the user to a page within the document, and then (B) open a web link. The Link Properties are currently as follows:
There are a large number of links within this document which point to the same place (frustratingly, this is simply how they've decided to do it, and there is no swaying them in that regard), and many times, the text pointing to the link is different (i.e. "visit this link" and "refer to form 10-a for more info" both point to the same URL).
What I would like to do for them is provide them with some sort of search & replace function, or a batch process of some kind, which will search the link properties for all existing links in any given document, allow them to input the currently existing URL, and replace it with another URL of their choice. As it currently stands, they must edit each link manually, which poorly impacts their manhours.
I have been all through Adobe's help materials, and while I found them to be useful in other tasks I might wish to do, I'm not seeing a way to specifically address the issue of searching and replacing Actions within a Link Properties. I would be rather surprised if this was not something that Adobe will allow me to do, and I am fairly certain I'm simply not finding a way to articulate my need in a search engine friendly way that will find what I am looking for.
One caveat: if no solution exists within Adobe itself, a third party tool is not an option. I work for a government agency, so nifty third party tools are strictly forbidden.
With Adobe Acrobat and only Acrobat, assuming that 3rd party plugins have the same restrictions as other software, the only API you have at your disposal is Acrobat JavaScript and unfortunately, JavaScript can't interrogate the link to find it's properties, it can only set them or reset them.

"S is not defined" Error in Adobe DTM

I am in the process of migrating an existing Adobe anlytics implementation on s_code version 27.5 to DTM. The first step of the migration and what is in scope of the project is a pick up and shift job of the current s_code into AdobeDTM.
The site has multiple JS files that house functions that need the 's object' to be initialised to work, however s is being initialised in the s_code contents after most of these JS functions have run so is throwing errors for 'S is not defined'. It is not being initialised globally as it would be in a standard implementation.
Is there a way I can initialise 's' in the DTM satellite library globally. I have tried to add var = s{}; a page load rule under third party/custom tags area but only having intermittent luck with it, where sometimes getting errors thrown.
Any support/insight into this issue would be most appreciated.
Thanks!
Step 1: Change the Code Configuration to Custom
Note: If you migrated your legacy H code to DTM as a tool, then you should already be familiar with and already done this step, since DTM does not allow you to specify legacy H code for the "Managed by Adobe" option.
In the Library Management section of the Adobe Analytics tool, change the Code Configuration option to Custom, and Code Hosted to In DTM.
If you are using the legacy H code library, then you must also check the "Set report suites using custom code below" option. If part of your migration to DTM was to move to AppMeasurement library, checking this option is optional, depending on how you want to handle report suite routing.
Then, click the Open Editor button to open the editor. You should see the Adobe Analytics library in the code box. If you are migrating legacy H code, then remove everything currently in the box and add your legacy H code library (which you should have already done based on the question).
Step 2: Instantiate the s object
If you are using the legacy H code, then add the following line to the top of the code box, above the library:
window.s = s_gi("[report suite id(s)]");
You will need to replace [report suite id(s)] with the report suite id(s) you want to send the data to. s_gi() requires a value to be passed to it, which is why you must check the checkbox above.
If you are using AppMeasurement library, then add the following line to the top of the code box, above the library:
window.s = new AppMeasurement("[report suite id(s)]");
If you checked the "Set report suites using custom code below" checkbox, then specify the report suite(s). If you did not check it, then do not pass anything to Appmeasurement(). Alternatively, you can pass nothing, but also add the following underneath it:
s.account="[report suite id(s)]";
Note however in step 3 you will be setting it in doPlugins anyway so you don't really need this here (I just added this sidenote for other readers who may be migrating AppMeasurement s_code.js to DTM).
Note: Aside from the window.s part, you should already be familiar with this line of code, and already have logic for populating report suite(s), coming from a legacy implementation. Specifically, you may be using the dynamicAccountXXX variables. If you are upgrading to AppMeasurement library, then you will need to write your own logic to simulate that, since AppMeasurement (for reasons unclear to anybody) does not have this functionality.
Step 3: Setting report suite(s) after page load
One of the many caveats about implementing Adobe Analytics as a tool is that DTM (for reasons unclear to anybody) creates a new s object whenever an event based or direct call rule is triggered and AA is set to trigger. In practice, this means almost all of the variables you set within the custom code boxes in the tool config will not be carried over to subsequent AA calls on a page - report suite(s) being one of them.
What DTM does for report suite is set it to the specified Production Report Suite(s) if DTM is in production mode, or Staging Report Suite(s) if in staging mode. Even if you enabled the "Set report suites using custom code below" option!
To get around this, you will need to include doPlugins function (and usePlugins) in one of the tool's custom code boxes if you don't already have it included (you almost certainly do, coming from a legacy implementation), and you will need to also assign the report suite(s) within it (doPlugins and usePlugins do get carried over now).
For legacy H library, within doPlugins, add the following:
s.sa("[report suite id(s)]");
Note: setting dynamicAccountXXX variables within doPlugins will not work. You will need to write your own logic for passing the report suite(s) to s.sa()
For AppMeasurement library, within doPlugins, add the following:
s.account="[report suite id(s)]";
General Notes:
In the Library Management section, setting Load library at
Page Top will load the library synchronously at the position where
you put your DTM Header tag, which is the earliest you can trigger it
through DTM. However, this is not a guarantee the library will be
loaded before your other scripts that referenced it are executed
(e.g., references to s object in some other script tag above the
DTM Header script will continue to give you a reference error).
If you are indeed still using the legacy H library, then I would
recommend your highest priority be to migrate to AppMeasurement
library. Even higher priority than migrating the code to DTM, IMO.
While I echo Mark's sentiments about implementing AA code as a 3rd
party tag in general, the sad truth is in practice, it may still be
your best option at the moment, depending on your exact scenario. DTM
currently has too many caveats, short-comings, and outright bugs that
make it impossible to implement AA as a tool in DTM, depending on
your exact implementation requirements. Particularly when it comes to
making AA integrate with certain common 3rd party tools, and even
some of Adobe's other tools!
You will be better off if you migrate completely to DTM for analytics deployment rather than trying to reference the s object from legacy H page code.
If migrating completely from H-code to DTM is an option, I would do the following:
Remove all H page code and any references to s_code
Remove all calls to s.t or s.tl on links or pages
Deploy DTM Header / Footer code on all pages
Within DTM, Add the Adobe Analytics Tool
Within DTM, Add the Adobe Marketing Cloud ID Service
Within DTM and the "Custom Page Code" of Adobe Analytics tool, create the "do_plugins" section and add any custom plugins from the H-code.
Following these steps will allow the s object to be created within DTM and allow for all other rules to use it correctly.
What I would not do:
Deploy H-code (s_code) as a third-party script and try and reference the s object outside of the Adobe Analytics tool. This is not efficient and doesn't allow you to get the best practices from DTM, IMO.
Mark
One of the issues noticed using DTM to implement Adobe Analytics was with the S-Object being undefined.enter image description here
Reasons very much unclear.You have a workaround that I used by reminding DTM to set the S object again. In-cases where DTM does not recognizes what needs to be done.
var s = _satellite.getToolsByType('sc')[0].getS();
For my Implementation we had used a Third Party JavaScript that set within a Direct call rule and within which the above code was set.
The solution worked great ....

Could i make a custom function in Clearcase's Toolbox ?

I want to make a new icon and a fuction for clearcase, i want to activate and deactivate the element * MAIN/LATEST function without to change manually the config spec.
I would like to have also the icon on my toolbox so i could know every time if MAIN/LATEST is active. My question is if someone could manipulate the clearcase's Toolbox. I was searching in google without to find out an answer!
The usual customization I see is through the ClearCase Context Menu Editor for Windows Explorer.
That would apply for Windows client only, and for ClearCase 7.x, not ClearTeam Explorer 8 though:
The tool that allows you to change the behavior of existing dialog boxes in Windows and ClearCase Explorer is ClearCase Context Menu Editor (tool called clearmenuadmin typical found in C:\Program Files\Rational\ClearCase\bin\clearmenuadmin.exe) which is available on all ClearCase Windows installations.
With the Context Menu Editor it is possible to:
Create new commands and other menu items available to ClearCase context menus.
Change properties of built-in and custom ClearCase context menu items.
Add items to or remove items from ClearCase context menus.
Test the changes to ClearCase context menus.
It would be good to know why you want to "disable /main/LATEST" and how you plan on doing that. Completely removing the line may cause problems if you need to create new elements, for example.
Whatever script that you're planning on using would need to:
Grab the current view configspec using cleartool getcs
Edit it to make the desired changes
use cleartool setcs {filename} to apply the changes
Some key "gotchas".
Removing /main/LATEST completely will break mkelem, unless have a "element * /main/0 -mkbranch {some branch}" rule.
If you use "-time now" to prevent seeing stuff on /main that others may still be checking in, that will work up to a point. This "now" means "when the configspec is recompiled" which can happen: on starting the view server process or if "cleartool setcs -current" is used to clear view caches.
Not having a configspec line for /main is intentionally introducing "no version selected by configuration" errors. As is using "element ... -none" rules. If you use snapshot or snapshot-derived view types (Web views, and likely Automatic views), you may see error messages on updating/loading views. You can ignore these messages, but only if you're aware they will happen. If you're doing automated updates (say as part of a build process) that tooling needs to be set up to ignore the "spurious" errors and catch the "real" ones.

Sublime open file hotkey

I know that I can use 'Ctrl + p' to find file and open it. But it search file in all projects. What is the way to search file only in current project?
The Ctrl+P key binding opens what is known as "GoTo Anything". The Sublime Text Unofficial Documentation on GoTo Anything states (emphasis added):
As you type into Goto Anything’s input area, names of files in the current project will be searched, and a preview of the best match will be shown.
Further down in the documentation in the "Sidebar" section it states:
The sidebar provides an overview of the active project (more on projects later). Files and folders in the sidebar will be available in Goto Anything and project-wide actions like, for example, project-wide searches.
Projects and the sidebar are closely related. It’s important to note that there’s always an active project, whether it’s explicit or implicit.
I would bet that your current active Sublime project includes files which should be moved to a separate (explicit) project and that is why they are being included in the search results contrary to your desire. To learn more about projects, read even further down in the documentation in the section titled "Projects".
Maybe you can try this one: Shift+Command+F, then you can enter search keyword as follows:
Find: Please enter search keyword
Where: Select the project location

Eclipse Ganymede hacks, hints, tips, tricks, and best practices

I've recently started using Eclipse Ganymede CDT for C development and I couldn't like it more. I'm aware the learning curve could be sort of pronounced, therefore and with your help, my goal is to flatten it as much as possible. I'm looking for the best hacks, hints, tips, tricks, and best practices to really unleash the full power of the IDE.
Accurate Indexing
With CDT you should be sure to enable the "Full Indexing" option rather than the "Fast Indexing" default. It's not perceptibly slower on modern hardware and it does a much better job. In that vein, you should be sure to enable semantic highlighting. This isn't as important in C/C++ as it is in a language like Scala, but it's still extremely useful.
Streamlined Editing
Get used to using Ctrl+O and Ctrl+Alt+H. The former pops up an incrementally searchable outline view, while the latter opens the "Call Hierarchy" view and searches on the currently selected function. This is incredibly useful for tracing execution.
Ctrl+Shift+T (Open Type) isn't exactly an "editing" combo per se, but it is equally important in my workflow. The C++ Open Type dialog not only allows incremental filtering by type, but also selecting of definition (.h) or declaration (.cpp) and even filtering by element type (typedef, struct, class, etc).
Task Oriented Programming
Mylyn: never leave home without it. I just can't say enough about this tool. Every time I'm forced to do without it I find myself having to re-learn how to deal with all of the code noise. Very, very handy to have.
Stripped Down Views
The default Eclipse workspace layout is extremely inefficient both in space and in usability. Everyone has their favorite layout, take some time and find yours. I like to minimize (not necessarily close) everything except for Outline and keep the C/C++ Project Explorer docked in the sidebar configured to precisely hide the Outline when expanded. In this way I can always keep the editor visible while simultaneously reducing the space used by views irrelevant to the current task.
CTRL+TAB let you navigate quickly between a source file and it's header file (foo.cpp <--> foo.h).
I like also the local history feature because you can go back and revert your changes in a convenient way.
ctrl + space is the best tool ever in Eclipse. It is the auto-complete feature. It can complete variable names, method declarations, user defined templates, and a ton more.
Go Eclipse. Tons of my code is generated by ctrl + space.
If the Java Developer Tools aren't installed the Spellcheck won't work.
The Spellcheck functionality is dependent upon the Java Development Tools being installed. This can be a perplexing issue if you just install the C Development Tools exclusively, because it gives no reason for the Spell Checker not working.

Resources