Can "Toggle Browser View" be scripted?
Custom language based help opened by single key press
Custom language based help opened by single key press
No! Scripting of a command which just toggles a view which can be also toggled by key?
Best regards from an UC/UE/UES for Windows user from Austria
Thank you. Here is some more background. I'm writing scripts in some language (Ansys APDL). I have many HTML help pages local on my computer, one for each Ansys APDL command. When I write Ansys APDL code using UltraEdit I'd like to hit a key when the cursor is on an Ansys APDL command and automatically have the help page come up, preferably right away with the browser look. I can do all these steps by hand, so I thought UltraEdit's scripting capabilities can automate it. As it appears right now I need at least 2 keystrokes, one for running the script to pull up the HTML help page and another one to toggle the view. I already tried mapping the Toggle Browser View to a key (CTRL+b) and then tried UltraEdit.activeDocument.key("CTRL+b"). This didn't work. Personally I think allowing any key mappings in this method would be a great addition to the scripting capabilities. Maybe there are better ways to accomplish what I'm trying to do?
The scripting command key of the UltraEdit.document object is for moving the caret in the document. It does not emulate a hit on keyboard triggering a keyboard event which the operating system passes to the application with input focus on which the command mapped to the key code is executed by the main event loop of the application. That would not work as UltraEdit is already executing code when running a script and therefore cannot handle parallel other events. IDM could move the execution of a script into a separate thread to remain responsive for system (user) events. But this is usually not required as UltraEdit scripts are mainly for modifying 1 or more files and not for automating a sequence of user actions not related to a file. And in real UE scripts are already executed in a separate thread to support canceling the execution of the script via the button Cancel in the displayed small dialog window.
However, for your requirement I can suggest 3 possible solutions.
For solution 3 (and 2) take a look on Tools for online help on PHP, HTML and CSS (etc).
However, for your requirement I can suggest 3 possible solutions.
- The usage of a third-party application like AutoHotkey designed for sending key and mouse events to applications - in other words emulating human actions.
- The configuration of a user tool to run your favorite browser as explained at View in Firefox / Internet Explorer / Opera / Chrome / Safari with passing the file to open in browser as parameter on command line of the user tool. The user tool configuration supports %sel% anywhere on command line of the user tool which can be used to open the right file in browser according to command selected before. For example:
"full name of browser executable with path" "path to Ansys APDL HTML files\%sel%.html"
- The usage of an additional help file. In UltraEdit you can add via Help - Add Help Files *.hlp (RTF based) and *.chm (HTML based) help files. It looks like for Ansys APDL there is already an HTML documentation. Perhaps there is also a compiled HTML documentation (CHM). If this is the case, you can add this CHM file to UltraEdit help system.
If the word under cursor is in keywords index of the help (tab Index on viewing a CHM), simply pressing the associated help key results in opening the appropriate help page from added HLP or CHM file. The Ansys APDL must not be even selected as UltraEdit automatically takes the word under cursor on lookup in help index. But if something is selected, UltraEdit looks up the selected text in index of help.
The help key can be configured at Advanced - Configuration - Key Mapping by assigning a hotkey to command HelpUserFilex.
I use this method for help on HTML4.01 commands, help on CSS2.1 properties and help on various C/C++ related topics.
For solution 3 (and 2) take a look on Tools for online help on PHP, HTML and CSS (etc).
Best regards from an UC/UE/UES for Windows user from Austria
Thanks again - very helpful. As far as I know the Ansys help does not come as CHM. But I was able to write a little program that extracted needed information from the HTML pages and assembled an index (HHK file) and then I used some other tool to compile the HTML to CHM. And then I added it to the UltraEdit help. Pretty much identical to your suggestion #3.
There is only one detail that could be slightly better which I don't know how to go about. Here are two examples of Ansys APDL commands: "vget", "*vget". The problem is that in either case only "vget" gets passed to the help when I only have the cursor within this string. Then the help lists the two options and I have to pick again. That's certainly something I can comfortably live with. If I select the entire string "*vget" (using the mouse, for example) and then call the help it finds "*vget" right away. So I tried writing an UltraEdit js-script that automatically selects the entire string "*vget" but then I don't know how to call the help directly from a js-script. I could map one key that does the selection and another key that calls the help but couldn't figure out how to do the same thing using just one key push, maybe not even having the cursor on the command but just in the same line, select the first word of that line which is the command, select the entire string including special characters there might be in front of it, open the help and jump back to the initial cursor location. I coded all that but just don't know how to open the help from the js-script but presumably this isn't possibly just like the "Toggle Browser View" isn't possible. Again, I think I'm happy (and impressed) enough that I got this far. Thanks again for your help.
There is only one detail that could be slightly better which I don't know how to go about. Here are two examples of Ansys APDL commands: "vget", "*vget". The problem is that in either case only "vget" gets passed to the help when I only have the cursor within this string. Then the help lists the two options and I have to pick again. That's certainly something I can comfortably live with. If I select the entire string "*vget" (using the mouse, for example) and then call the help it finds "*vget" right away. So I tried writing an UltraEdit js-script that automatically selects the entire string "*vget" but then I don't know how to call the help directly from a js-script. I could map one key that does the selection and another key that calls the help but couldn't figure out how to do the same thing using just one key push, maybe not even having the cursor on the command but just in the same line, select the first word of that line which is the command, select the entire string including special characters there might be in front of it, open the help and jump back to the initial cursor location. I coded all that but just don't know how to open the help from the js-script but presumably this isn't possibly just like the "Toggle Browser View" isn't possible. Again, I think I'm happy (and impressed) enough that I got this far. Thanks again for your help.
Congratulations on creating the CHM help.
Yes, opening the added help from within the script is not possible. Same reason as for Toggle Browser View. Open View - View/Lists - Tag List, select the tag group UE/UES Script Commands and you can see in the list all available Key ... commands supported by UltraEdit.activeDocument.key(...).
The only workarounds would be solutions similar to what I wrote already for the HTML help. An AutoHotkey script executed by key runs the UltraEdit script with its hotkey and then opens the help with its hotkey. Or a user tool is configured running hh.exe with the created CHM and the name of the HTML file inside for the selected command. See answer on question Is it possible to open a specific topic from the Hh.exe command line? Both workarounds are not really handy, but I do not know about better solutions for Ansys APDL having commands containing also non word characters making the CHM help support at little bit more difficult to use.
Yes, opening the added help from within the script is not possible. Same reason as for Toggle Browser View. Open View - View/Lists - Tag List, select the tag group UE/UES Script Commands and you can see in the list all available Key ... commands supported by UltraEdit.activeDocument.key(...).
The only workarounds would be solutions similar to what I wrote already for the HTML help. An AutoHotkey script executed by key runs the UltraEdit script with its hotkey and then opens the help with its hotkey. Or a user tool is configured running hh.exe with the created CHM and the name of the HTML file inside for the selected command. See answer on question Is it possible to open a specific topic from the Hh.exe command line? Both workarounds are not really handy, but I do not know about better solutions for Ansys APDL having commands containing also non word characters making the CHM help support at little bit more difficult to use.
Best regards from an UC/UE/UES for Windows user from Austria