topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday February 18, 2025, 1:22 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Nod5 [ switch to compact view ]

Pages: prev1 2 3 4 5 6 [7] 8 9 10 11 12 ... 47next
151
Official Announcements / Re: Upgrading forum Dec 28, 2019
« on: April 25, 2020, 06:01 AM »
Does the current version of the forum software have an option to enable inline code formatting? I mean the minimal code formatting of short strings within a sentence using backticks like `these three words` in contrast to linebreak separate code blocks, which we already have. If yes then turn it on please!  :)

Markdown uses backticks for inline code and many platforms like GitHub and Reddit support it.
https://github.com/a...down-Cheatsheet#code

152
AutoHotkey script template to take action on selected files in active File Explorer window in Windows 10.

Background
FARR can find and launch files, but also do much more. This AutoHotkey script template helps you use FARR to quickly take action on selected files in the active Explorer window. Similar to a context menu action in Explorer, but started from a FARR alias.

AutoHotkey script template
Code: Autohotkey [Select]
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. ; Template: take action on selected files in active Explorer window
  4. ; - AutoHotkey helper script template for FindAndRunRobot (FARR)
  5. ; - by Nod5 2020-04-25
  6.  
  7. ; Get active the window's handle (Hwnd) from parameter passed by FARR
  8. vHwnd := A_Args[1]
  9.  
  10. ; verify that the window is Explorer
  11. WinActivate, ahk_id %vHwnd%
  12. If !WinActive("ahk_class CabinetWClass ahk_id " vHwnd)
  13.  
  14. ; get filepaths for selected files
  15. aFiles := ExplorerHwndSelectedFilepaths(vHwnd)
  16.  
  17. ; ----------------------------------------------------
  18. ; add code to take action on the files here
  19.  
  20. ; example: show each filename in a messagebox popup
  21. For Key, vFile in aFiles
  22. {
  23.   SplitPath, vFile, vFilename
  24.   MsgBox % vFilename
  25. }
  26.  
  27. ; ----------------------------------------------------
  28.  
  29. ; exit script when finished
  30.  
  31.  
  32. ; required function
  33. ; function: ExplorerHwndSelectedFilepaths()
  34. ; return array of filepaths for selected files in Explorer window identified via HWND
  35. ExplorerHwndSelectedFilepaths(vHwnd)
  36. {
  37.   if !vHwnd or !WinExist("ahk_class CabinetWClass ahk_exe Explorer.exe ahk_id " vHwnd)
  38.     return
  39.   for window in ComObjCreate("Shell.Application").Windows
  40.   {
  41.     if (window.HWND != vHwnd)
  42.       continue
  43.     aFiles := []
  44.     sfv   := window.Document
  45.     ; note: gets items in alphanum ascending sort order
  46.     ; https://docs.microsoft.com/en-us/windows/desktop/shell/shellfolderview-selecteditems
  47.     items := sfv.SelectedItems
  48.     for item in items
  49.       aFiles.push(item.Path)
  50.     break
  51.   }
  52.   window := item := items := sfv := ""
  53.   return aFiles
  54. }

Preparation
Install AutoHotkey, https://www.autohotkey.com/

Create a new action
- Download the template to a file, for example "C:\some folder\timestamp action.ahk"
- Edit the template to add code for the action you want to perform on the selected files
- Create a FARR user alias to launch the script and pass the parameter %LASTHWND%

Example FARR alias
- alias keyword: timestamp now
- regular expression pattern: ^(stamp)$
- result: C:\some folder\timestamp action.ahk %LASTHWND%

Use the action
- Open Explorer and select some files
- Open FARR, type to show the alias action (for example "stamp") and press Enter.

Note
The regular expression pattern is optional in FARR aliases, but useful to more quickly get to a single result.
For max speed use short patterns like ^(sta|stam|stamp)$ to show only the alias result when you type "sta", "stam" or "stamp" but still let FARR show regular file search results if you continue typing for example "stamp collection".

Action example
Code: Autohotkey [Select]
  1. ; set "time modified" for the file to the current time
  2. For Key, vFile in aFiles
  3. {
  4.   FileSetTime, % A_Now, % vFile, M
  5. }


List of action ideas
- add to music/video app playlist
- copy to some other folder
- create file shortcuts in some other folder
- create a companion note file ("filename.jpg -- notes.txt")
- compare selected files in WinMerge
- scale image files 50%
- rotate image files 90 degrees
- change file date modified/created timestamp to current time
- create backup file copy with a timestamp suffix ("filename_20200423103546.txt")
(Useful for basic versioning when Git is overkill but you want some order to avoid a mess like "text.doc", "text2 final.doc", "text 2 final FIXED.doc")
- calculate and save file hashes (sha1, sha256, ...)

Ideas for more advanced actions
Asymmetric action on two selected files: copy/clone some feature (image size, timestamp, filename pattern, ...) from first file onto second file. For example clone a date modified timestamp.

Why use this rather than regular Explorer context menu actions?
- easy to create and use if you're already using FARR and AutoHotkey
- very quick if you set up short regex alias patterns
- quick to toggle aliases on/off
- you can add and show context/instructions to alias text to remind you what the action does
- avoid browsing a cluttered context menu



Example with screenshots
Use case: We want a quick way to to create .txt files to write notes about some files, for example some images.

1.png

Edit the template and add an action to create .txt note files. Save, for example to "C:\test\create txt note.ahk"

Code: Autohotkey [Select]
  1. ; create companion text file for notes
  2. For Key, vFile in aFiles
  3. {
  4.   FileAppend, , % vFile " -- notes.txt"
  5. }

Create a user alias in FARR

2.png

Select files in Explorer, Open FARR and use the alias

3.png

Text files are created.

4.png

Take important notes.

5.png

154
Find And Run Robot / Re: Support Windows 10 Universal app?
« on: March 11, 2020, 05:05 PM »
FARR does not have support for that yet.

Some less than perfect things you can try in the meantime:

- If it a single universal apps that you want to launch with FARR then you can manually create a .lnk shortcuts to it using these steps

- If you use many unversal apps then this python program on stack overflow creates a desktop folder with one .lnk shortcut (including icon) for each universal app. You can after that set FARR to include that folder when searching.

155
I updated SaveAsPathHelper.ahk to fix an issue that can make the path change fail in some cases (due to a quirk in how AutoHotkey's ControlClick command works)
https://gist.github....7ab6762833d5442fef5d

I think the scripts is very useful! If I may say so :) Feedback welcome, especially from those who have used Listary's Quick Switch feature a lot and can tell me what my scripts is still lacking (apart from support for other file managers than File Explorer).

156
Adding one tip on top of what mouser said and linked to:
You can also make a hotkey that copies selected text to clipboard but leaves the FARR search box empy on open.
Next you create an alias for Velocity (and one for any other tool you want to pass a selected string to).

In other words, instead of tying one hotkey to a single program, or to a single alias that lists a number of programs, you make a generic "copy selection and open FARR" hotkey and then set up any number of aliases that you want to use with it.

1.png


2.png

157
I tried adding a custom alias directly to the new FindAndRunRobot.ini by pasting from the old one. It was overwritten when I restarted FARR.

I assume you meant that you tried to add a custom alias directly to an .alias file like myaliases.alias ?

To make sure that direct edits (in Notepad or some other editor) to the .alias file will stick first close the FARR process, then open and edit the .alias and then close FARR again.

158
Alt+Tab to the file manager, Alt+Tab back to the dialog

Ok, I added a similar feature to SaveAsPathHelper.ahk just now.
Alt+Tab from file dialogue window to Explorer window and back within 5 seconds: update file dialogue window with Explorer path

Listary supports most of the popular 3rd-party file managers

Doable, but would for each such file manager need this pair of information:
- how to detect the window (what AutoHotkey's Window Spy utility shows as ahk_exe and ahk_class when the file manager is active)
- how to get the current folder path from the window (I guess this varies, but whatever Listary is doing this script could probably also do if the method is public e.g. getting path from window title, control text, DDE, windows message, keyboard shortcut, ...)

I don't use any of the listed file managers but if anyone who does gives me the above info pair I might add support for it.

159
Here's my first AutoHotkey attempt at some of these features. Probably has some issues. But works ok in some tests on my Win 10 x64 PC at least. Only works with File Explorer.

SaveAsPathHelper.ahk
https://gist.github....7ab6762833d5442fef5d

160
Maybe this should be moved to the Coding Snacks section?

I more or less 'live' within my favourite file manager, Total Commander. Listary's ability to steer the dialog box to whatever is the active directory in TC is invaluable.  Listary supports several other file managers etc. too.

Do you with "steer" mean one of these or something else?
1. when in the Save As window, the user presses a hotkey to make Listary change the Save As window path to the last active Explorer window's path
2. when a Save As window opens, Listary automatically and immediately changes the Save As window path to the last active Explorer window's path

Feature 1 seems pretty simple to clone, 2 more complex.

... the Windows folder settings must have "Display full path in Title Bar" enabled.  ...
I'm probably missing something here, but why not get the Explorer window paths via ComObj?

161
There are several scripts, such as this one but it's not working that reliability in my experience.
There are also scripts that allow to select a currently opened folder from a list, which is more convenient than nothing, but it's still not as efficient.
In what way is it unreliable on your computer? I made an AutoHotkey script for the Ctrl+G feature and it seems to run without any issues on my PC. Will test it some more and post somewhere later on if I don't experience any problems with it.

162
I'm with Skajfes. This task (changing the folder in a save file... window) seems like a job for a windowless hotkey tool, not a GUI based file launcher like FARR.

I'm aware that one can mimic this functionality using an AHK script, but would prefer not to have to run another program in the background just to achieve this.

If there already is an AutoHotkey script that does what you want (link?) then why not use that? What is the downside in your view?

163
Find And Run Robot / Re: FARR is on other monitor, can't see
« on: February 28, 2020, 10:35 AM »
I added a line to my AHK script (I have a script running that defines a number of hot keys) added Win+F12 to do the trick.
That'll do it until the bug is fixed.

Off topic: For some time I kept my FARR use and AutoHotkey use mostly separate. But now I find it much easier, and more mnemonic, to make small single use AutoHotkey scripts and run them from a FARR alias. Easier to recall the alias "move" for moving a window than the hotkey "win+F7" or similar. Especially for stuff that I don't use very often.

164
There is also a beta available for https://roamresearch.com/

165
https://www.ghacks.n...manager-for-windows/
:Thmbsup:
:up: Lintalist is such a great application and, if that wasn't enough, a great example of and inspiration for complex applications coded in AutoHotkey.

166
I noticed that if I open an incognito tab in Chrome or Firefox and load donationcoder.com then the main page loads as http (not https). While loaded as http Chrome labels the connection "Not secure" and some of the top menu bar icons are not visible. Once any link on the page is pressed the https version is loaded.

167
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.

168
Find And Run Robot / Re: FARR is on other monitor, can't see
« on: February 06, 2020, 11:52 AM »
If this only happens in the newest FARR version then it is probably an issue that mouser will fix.

In the meantime you could try some workarounds:

First, check if you can move the FARR window using the Win + Shift + Left/Right shortcuts in Windows. Those shortcuts work on most windows. Did not work on my FARR though, but worth a first try.

Alternatively, try using an AutoHotkey script to move the window to the visible part of the screen. One single line of code is enough to move the FARR window to near the middle of the primary display on my PC.
WinMove, ahk_class TMainForm ahk_exe FindAndRunRobot.exe,, 500, 500

If that works then you could for convenience make a FARR alias to run the script when you type "move".
alias name: move FARR
regex: ^move$
Result: dolaunch C:\folder\moveFARR.ahk

Modify the result line to the filename and folder you want for the AutoHotkey script.
You could also change the "move" part of the regex to whatever other string you want to use to launch the script.

169
Find And Run Robot / Re: FARR - Suggested Hotkey
« on: January 23, 2020, 08:38 AM »
Ctrl+space is also used by the editor
Alt+space is free but I use it for moving window, by opening the system menu.
Well, do you use those more often than FARR? If no, then why not just remap them to something else with AutoHotkey.

Or you could split them like so: Left Ctrl + Space for FARR, Right Ctrl + Space for something else.

170
Find And Run Robot / Re: FARR - Suggested Hotkey
« on: January 22, 2020, 01:40 PM »
I suggest Ctrl+Space or Alt+Space. Both very quick and easy to press without looking down at the keyboard. Take your pick  :)

171
Incorrect AV warnings against compiled AutoHotkey programs suck. It has been like this on and off for a long time. Not much individual coders can do about that I think. Something needs to change in the AV sector. But it probably won't.

172
Find And Run Robot / Re: Broken icons for 64bit programs
« on: January 04, 2020, 04:46 PM »
Confirming that icons work for 64bit applications also in the as of now latest beta.

By the way, I now noticed that FARR also accepts these ways of setting an icon from any absolute path (not sure if new or not)
/ICON="C:\test\test amazon.ico"
/ICON=C:\test\test amazon.ico

I like that we can use absolute paths. But that is not yet documented in the beta version of this help file page
https://www.donation...l_search_phrases.htm

BTW my first hunch was that using /ICON without doublequotes around the absolute path could cause problems, but I acually didn't find any conflict case. For example this combination of special frontslash alias syntaxes does not cause a problem
/ICON=C:\test\test amazon.ico /hint="test hint"

173
Find And Run Robot / Re: naming an alias
« on: January 04, 2020, 03:55 PM »
Regarding my above test cases 1 and 4: You correctly replied
I guess that's to be expected and may not be considered a farr bug.. as long as i can fix the ones with doublequotes. Unless you tell me that those used to would work on the prior version of farr..
I shouldn't have included 1 and 4 at all, but was confused earlier because on a PC here with an older FARR version case 1 did open the file (despite spaces in path and not quote enclosed!). But it turns out that was only because Microsoft's Notepad.exe was replaced by Notepad2 on that PC. And Notepad2 (weirdly!) doesn't require quotes when passing a spaced filepath as parameter. So disregard that.

In other words: test case 2 and 3 (and 5 and 6 using the ++ method) are what matters. Forget 1 and 4.

In the as of now latest portable beta test cases 2 3 (and 5 6) work fine. So the issue seems solved.  :up:

174
Find And Run Robot / Re: naming an alias
« on: January 02, 2020, 02:07 AM »
That was fast!  :) I'm short on time, will test new beta on Saturday.

175
Find And Run Robot / Re: naming an alias
« on: January 01, 2020, 06:42 PM »
Tested 2.238.01 beta portable in Virtualbox Win10

Test 1: result lines for an alias meant to run notepad and show a .txt file

1 | C:\Windows\System32\notepad.exe C:\test\a b.txt
2 | C:\Windows\System32\notepad.exe "C:\test\a b.txt"
3 | "C:\Windows\System32\notepad.exe" "C:\test\a b.txt"
4 | "C:\Windows\System32\notepad.exe" C:\test\a b.txt
5 | "C:\Windows\System32\notepad.exe"
6 | C:\Windows\System32\notepad.exe

- All items show up with correct icons in FARR
- This is what happens when an item is started from FARR:
1 4: opens blank Notepad and error messagebox about file not found
2: opens Notepad and with the .txt correctly
3: does nothing

5 6: opens blank Notepad correctly

5 6 also work as expected when adding ++ C:\test\a b.txt and ++ "C:\test\a b.txt" after the alias regex in the search box

Test 2: an alias meant to run Firefox and show google.com

1 | C:\Program Files\Mozilla Firefox\Firefox.exe https://www.google.com
2 | C:\Program Files\Mozilla Firefox\Firefox.exe "https://www.google.com"
3 | "C:\Program Files\Mozilla Firefox\Firefox.exe" "https://www.google.com"
4 | "C:\Program Files\Mozilla Firefox\Firefox.exe" https://www.google.com
5 | "C:\Program Files\Mozilla Firefox\Firefox.exe"
6 | C:\Program Files\Mozilla Firefox\Firefox.exe
- All items show up with correct icons in FARR
- This is what happens when an item is started from FARR:
1 2 4: opens Firefox and loads google.com correctly
3: does nothing
5 6: opens Firefox correctly

5 6 also work as expected when adding ++ https://www.google.com and ++ "https://www.google.com" after the alias regex in the search box

Related FARR help page on using ++ in searchbox to add a parameter
https://www.donation...dline_parameters.htm[/code]

Pages: prev1 2 3 4 5 6 [7] 8 9 10 11 12 ... 47next