Topics - Nod5 [ switch to compact view ]

Pages: prev1 2 3 [4] 5 6 7 8 9 ... 22next
16
Find And Run Robot / minor bug: FARR locks #filecontents file if empty
« on: February 17, 2020, 03:57 AM »
Minor bug: If an alias uses #filecontents and the file exists and is empty then FARR locks that file.

To reproduce:
1. Make an alias with this as Results
#filecontents C:\test.txt
2. Create the empty file "C:\test.txt"
3. Run the alias
4. close FARR
5. try to delete or write to "C:\test.txt"

This might also affect the fileresults command, I haven't had time to test that yet.

17
Minor request: Add FARR variables for the FARR window's position (x y), width and height at the moment right before a result was triggered.

This lets us make results that can run a script with FARR position/size as parameters. The script can then position its window based on where the FARR window was.

edit: I forgot that we can make the script parse those values from these FindAndRunRobot.ini lines
[Windows]
MainLeft=1001
MainTop=53
MainWidth=340
MainHeight=70
But built in variables that can be used as parameters would be handy.

18
Does anyone know of a code editor or plaintext editor that has these features:

1 First view displays the full text (every editor has this!)
2 Second view of the same document side by side (many editors have this!)

3 The second view displays only filtered lines from the full text.
4 An inputfield for typing a string/regex that updates the filtered lines immediately.
5 Synced edits: edits in the full text view are synced to the filtered view, and vice versa.

bonus feature but not as important
6 Synced positions: caret position and scrolling is synced between both views.

This feature would be of use when renaming variables or repeatedly doing similar changes at various places in a document. Find/replace already exists of course, but filtering could be a useful complement and give a better overview. Another use case is to show all lines that has the string "todo" etc in them, which could give an overview of code locations you've tagged for working on later.


Some other viewing/navigating tools that, while useful, don't do the above.

Minimap, https://code.visualstudio.com/docs/getstarted/userinterface#_minimap
Instead of filtering this zooms out to show a map of the full text. The map highlights lines with matches when using find/replace, which is nice. But the minimap is too small to read the text on those lines and we can't edit inside the minimap.

Multiple views (and scroll and caret positions) for the same full (unfiltered) text. E.g. the "split editor" command in VS Code

Filtering tools that create and open a separate, non-synced file with filtered lines. E.g. Text Power Tools for VS Code, https://marketplace.visualstudio.com/items?itemName=qcz.text-power-tools

Markdown preview, https://code.visualstudio.com/docs/languages/markdown#_dynamic-previews-and-preview-locking
This syncs positions. Edits in the plaintext view immediately sync to the preview. But there is no filtering and no editing in the preview.

19
FARR aliases can already start actions that make use of the active window through the special FARR variable %LASTHWND%, which contains a window ID string. Example: use FARR to run a script with %LASTHWND% as command line parameter. The script can then condition what it does depending on what window was active. Close that window, or move it, or copy text from it, or whatever.

The new feature idea: Aliases conditional on active window
In the alias setup we would specify conditions on the active window that must also be met for FARR to trigger the alias. Conditions could be active window processname, window class and/or window title. Exact or regex matching.

In effect FARR would for each alias test two things:
- does the string typed by the user match the alias name/regex?
- does the active window match the alias conditionals set by the user?

If yes and yes then the alias is triggered.

For example an alias named "dl" (short for download) could show different results depending on if the active window is Firefox or Chrome or some other application. Or results depending on if the active Firefox window title contains " - YouTube" (one result action: a script to download the youtube video in the active tab) or " - DonationCoder.com" (two results: scripts to save the current tab as .html or .pdf).

Two different ways the feature could be exposed to users:
1 an extra box in the alias editing window, similar to the RegEx editbox.
2 a special prefix string at the start of each Results line.

With 1 the user would make multiple aliases for "dl".
With 2 the user would make one "dl" alias but then add more lines in the results box with the special prefix.
Mockup code for case 2:
#If(win_process = "Firefox.exe" and win_title = regex("^ - YouTube$") Save youtube video | C:\folder\script.ahk %LASTHWND%
Or alternatively put the conditional on a separate line and apply it to all results line below it until a new conditional line is encountered. Mockup:
#If win_process = "Firefox.exe" and win_title = regex("^ - YouTube$")

We can think of this feature a bit like how the context menu in Windows File Explorer shows different actions depending on what extension the selected file has. Or the #IfWinActive syntax for context-sensitive hotkeys in AutoHotkey.

Some more use cases: The alias "cs" could be used to immediately (using the special FARR string "dolaunch") run a cheat sheet file for the active application/process. Alias "help" could show help resources relevant to the active application.

20
Coding Snack request
a script/tool that auto creates .lnk shortcuts for all currently installed Windows Store Apps.

Background
Users of Mouser's Find And Run Robot (FARR) requested an easy way to launch Windows Store Apps. The problem is that those apps do not create .lnk shortcut files FARR can find when searching files and folders. Users can manually create .lnk shortcuts one by one. But an automated method would be more user friendly. A standalone tool could also be useful for people who don't use FARR.

Research done

1. syntax for .lnk shortcuts to Windows Store Apps

Windows Store Apps can  be run from .lnk shortcuts with a target that has this format
explorer.exe shell:Appsfolder\<AUMID>
where AUMID (Application User Model ID) is a special string for each app.
For example on my PC we can launch Windows Calculator with
explorer.exe shell:Appsfolder\Microsoft.WindowsCalculator_8wekyb3d8bbwe!App

2. Powershell command to get a list of AUMID
The Powershell command
get-StartApps
returns a list with an App name and its associated App AUMID on each line.
More details here https://docs.microsoft.com/en-us/windows/configuration/find-the-application-user-model-id-of-an-installed-app

3. Making .lnk shortcuts programmatically
AutoHotkey has the command FileCreateShortcut, https://autohotkey.com/docs/commands/FileCreateShortcut.htm

What has already been tried
I didn't find a working way to use AutoHotkey to run Powershell with the get-StartApps command and output the resulting list to a .txt file.
I get this error
'get-StartApps' is not recognized as the name of a cmdlet

Instead of banging my non-powershell experienced head more against powershell error message walls, perhaps someone else here can think of a quick fix or different solution, using AutoHotkey, Powershell or some other method?  :)

Pages: prev1 2 3 [4] 5 6 7 8 9 ... 22next
Go to full version