topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Wednesday February 24, 2021, 12:27 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: [1] 2 3 4 5 6 ... 45next
1
Neat idea, so I made an AutoHotkey version with a hotkey and also a command line mode for easy use from FARR.

Uses COM to get the focused file's path more reliably than sending keys to the context menu.
Uses SHGetSetFolderCustomSettings method which makes the new folder icon show immediately, see Microsoft doc.

Code: Autohotkey [Select]
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. ; SetExplorerFolderIcon.ahk
  4. ; 2021-02-11
  5. ; by Nod5
  6. ; In Explorer press [F8] to set the focused file's first icon as parent folder icon
  7. ; -----------------------------------
  8. ; Default mode:
  9. ;   Select a file in Explorer and press [F8].
  10. ;   To close the script right click its tray menu icon and Exit.
  11.  
  12. ; Command line mode:
  13. ;   Pass as parameter a HWND window handle to a specific Explorer window
  14. ;   to act on that window's focused file and parent folder.
  15. ;
  16. ; Optional: use this script from FARR (Find And Run Robot)
  17. ;   Create a FARR alias and use this as the result line (modify the path):
  18. ;   Set Explorer parent folder icon | C:\some\folder\SetExplorerFolderIcon.ahk %LASTHWND%
  19. ; -----------------------------------
  20.  
  21. ; if parameter is Explorer HWND then act on that window and exit
  22. if (vHwnd := A_Args[1])
  23. {
  24.   if WinExist("ahk_class CabinetWClass ahk_id " vHwnd)
  25.     GetFocusedFileSetIcon(vHwnd)
  26. }
  27. ; else hotkey mode: create Explorer hotkey and await user action
  28. else
  29. {
  30.   Hotkey, IfWinActive, ahk_class CabinetWClass
  31.   Hotkey, F8, GetFocusedFileSetIcon
  32. }
  33. return
  34.  
  35. GetFocusedFileSetIcon(vHwnd := "")
  36. {
  37.   vFile := ExplorerGetFocusedFilepath(vHwnd)
  38.   if FileExist(vFile)
  39.   {
  40.     SplitPath, vFile, , vFolder
  41.     SetFolderIcon(vFolder, vFile, 0)
  42.   }
  43. }
  44.  
  45.  
  46. ; function: ExplorerGetFocusedFilepath(vHwnd := "")  v210211
  47. ; return filepath of focused item in vHwnd (or active) Explorer window
  48. ExplorerGetFocusedFilepath(vHwnd := "")
  49. {
  50.   vHwnd := vHwnd ? vHwnd : WinActive("A")
  51.   if vHwnd and WinExist("ahk_class CabinetWClass ahk_id " vHwnd)
  52.     for Window in ComObjCreate("Shell.Application").Windows
  53.       if (Window.HWND = vHwnd)
  54.         ; https://docs.microsoft.com/en-us/windows/win32/shell/shellfolderview-focuseditem
  55.         return vFile := Window.Document.FocusedItem.Path
  56. }
  57.  
  58.  
  59. ; function: SetFolderIcon() update Explorer folder icon in desktop.ini via SHGetSetFolderCustomSettings
  60. ; by teadrinker 2017-10-09 https://www.autohotkey.com/boards/viewtopic.php?p=174984#p174984
  61. ; https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetsetfoldercustomsettings
  62. ; https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/ns-shlobj_core-shfoldercustomsettings
  63. SetFolderIcon(folderPath, iconPath, iconIndex)  {
  64.    static FCSM_ICONFILE := 0x10, FCS_FORCEWRITE := 0x2
  65.    if !A_IsUnicode  {
  66.       VarSetCapacity(WiconPath, StrPut(iconPath, "UTF-16")*2, 0)
  67.       StrPut(iconPath, &WiconPath, "UTF-16")
  68.    }
  69.    VarSetCapacity(SHFOLDERCUSTOMSETTINGS, size := 4*5 + A_PtrSize*10, 0)
  70.    NumPut(size, SHFOLDERCUSTOMSETTINGS)
  71.    NumPut(FCSM_ICONFILE, SHFOLDERCUSTOMSETTINGS, 4)
  72.    NumPut(A_IsUnicode ? &iconPath : &WiconPath, SHFOLDERCUSTOMSETTINGS, 4*2 + A_PtrSize*8)
  73.    NumPut(iconIndex, SHFOLDERCUSTOMSETTINGS, 4*2 + A_PtrSize*9 + 4)
  74.    DllCall("Shell32\SHGetSetFolderCustomSettings", Ptr, &SHFOLDERCUSTOMSETTINGS, WStr, folderPath, UInt, FCS_FORCEWRITE)
  75. }
  76.  
  77. ; -----------------------------------
  78. ; notes on desktop.ini files
  79. ; -----------------------------------
  80. ; https://docs.microsoft.com/en-us/windows/win32/shell/how-to-customize-folders-with-desktop-ini
  81. ; "text file that allows you to specify how a file system folder is viewed."
  82. ; See also https://hwiegman.home.xs4all.nl/desktopini.html
  83.  
  84. ; Format:
  85. ; -----
  86. ; [.ShellClassInfo]
  87. ; IconResource=C:\test\file.exe,0     ; <filepath, icon-index>
  88. ; -----
  89. ; To remove the custom folder icon delete desktop.ini
  90.  
  91. ; If we just write the file then the new folder icon does not show immediately (must close/reopen Explorer)
  92. ; If we instead use SHGetSetFolderCustomSettings the new icon shows immediately.
  93. ; SHGetSetFolderCustomSettings also hides the desktop.ini file.
  94. ; https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetsetfoldercustomsettings
  95. ; https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/ns-shlobj_core-shfoldercustomsettings
  96. ; AutoHotkey function: SetFolderIcon()
  97. ; by Teadrinker 2017-10-09 https://www.autohotkey.com/boards/viewtopic.php?p=174984#p174984
  98. ; -----------------------------------

2
N.A.N.Y. 2021 / Re: NANY 2021: MoveFileHere
« on: January 18, 2021, 01:21 PM »
I seem to get error messages no matter what I do
Ok, sorry that it isn't working. That error message points to the a step in the code that uses COM to loop over all open File Explorer windows. It seems to find a File Explorer window but crash when that window's handle is accessed. I don't know what is causing that error though, I'm not able to reproduce it on any PC I have tried. It is also a pretty commonly used method in AutoHotkey scripts and I haven't found similar errors reported in the AHK forums. Guessing: maybe related to Win 10 security permissions settings or a conflict with some other app or script that is running on your computer but not on mine. If you have another Win 10 computer at hand you could try it there, to help narrow down the issue.

3
N.A.N.Y. 2021 / Re: NANY 2021: MoveFileHere
« on: January 17, 2021, 10:31 AM »
Hi tomos, thanks for testing.

1) (minor) it doesnt recognise that the Download folder has been moved from it's default location (the new location is recognised correctly by File Explorer and Vivaldi). I edited the ini file to point to correct folder, so no real problem here

Yes, that's a design choice, to keep the code simple.

2) When I press F7, the name of the file to be moved shows as a tool tip type message (near the mouse pointer) but nothing is moved. If I click on the message I get this error:

After pressing F7 the user accepts the move with Enter, Space or Left Click. (To cancel Esc, F7 again or wait and it times out.) I documented that on GitHub, will add that to the first post here too.

The error you describe is a bug but I haven't found a way to reproduce it yet. It could be an issue with file permissions or Windows 10 security (partially) blocking the exe, hard to say.

If you have time to test more:
  • Change the source folder location in the .ini again, to something other than the browser's download folder. Does moving files from that folder work?
  • Try running the .ahk source file directly instead of the .exe (assuming you have AutoHotkey installed). Does that work?

4
Living Room / Re: Gadget WEEKENDS
« on: January 04, 2021, 04:07 AM »
So it worked quite well, with negligible perceived lag!
Great, thanks for the details.

I used USB Camera Pro - Connect EasyCap or USB WebCam
Good find. Though this is such a neat way to reuse old devices that I wish Google adds its own USB webcam functionality for it to Android. Also wishing Raspberry Pi OS came with some send-HDMI-over-USB functionality to make the converter hardware redundant.

5
Great job mouser - video, audio, the conversations!  :Thmbsup: Co-op games is a good niche to cover. I see that your videos already appear on some game pages on Board Game Geek,e.g. https://boardgamegee...-missions/videos/all , which I think is a good way for people to find you. What's the process for getting listed there - do you add each manually there or does BGG find and add them automatically?

6
Living Room / Re: Gadget WEEKENDS
« on: January 02, 2021, 02:52 PM »
I ordered the capture card and the converter cable, and they should be here on Sunday.  I'll try it and see how that goes before looking into any other options.
Keen to hear how well it works. Including which Android app to use - there are a few in the in Google Play and some appear to show ads.

7
Living Room / Re: Gadget WEEKENDS
« on: December 31, 2020, 05:24 AM »
I think you need to look for something that implements the WiFi Display protocol (MiraCast), for example MiracleCast.
Interesting! Have you used it? I hope these kind of tools evolve to open, near turnkey, inexpensive two-part wireless hardware kits: plug in a caster/sender device to the PC or Raspberry HDMI out port and plug in the receiver to either the HDMI in port on a display/TV or to USB OTG on an old android phone/tablet (maybe flashed with a custom ROM) and shazam: wireless screen over direct Wi-Fi. Pair them by temporarily connecting a cable from receiver to sender and press a hardware button. Bonus feature would be to allow multiple simultaneous receiver devices for one sender device.

8
I made a small tool for NANY2021, MoveFileHere, and it can be seen as an alternative method compared to parts of the Listary feature discussed in this thread. MoveFileHere helps a workflow where we make the browser always save/download files to a fixed Downloads folder and then use a hotkey quickly move the file to another File Explorer folder afterwards. Compare that to the workflow of quickly picking a custom folder for each download using Listary or the small SaveAsPathHelper script I made upthread to mimic some Listary features.

9
Living Room / Re: Gadget WEEKENDS
« on: December 30, 2020, 10:48 AM »
The little HDMI to USB webcam adapter looks very useful! Hackaday wrote about it recently too
https://hackaday.com...pture-device-around/
with link to a video review that covers latency https://www.youtube....56&v=daS5RHVAl2U
Only problem seems to be that there are several similar products on Amazon et al but quality can be hit or miss.

10
N.A.N.Y. 2021 / NANY 2021: MoveFileHere
« on: December 30, 2020, 10:09 AM »
Application Name MoveFileHere
Version 2020-12-31
Short Description AutoHotkey tool to quickly move newest file from Downloads to the active File Explorer folder in Windows 10.
Supported OSes Windows 10
Web Page https://github.com/nod5/MoveFileHere
Download Link Standalone EXE file  https://github.com/n...oveFileHere/releases
AHK source file   https://github.com/n...ain/MoveFileHere.ahk

MoveFileHere1.png

Description
A very small hotkey tool that I use all the time, now released for NANY in case other people also often move files soon after downloading them and find the sequence Right click, Click "Show in folder", Ctrl+X, Alt+Tab Tab Tab, Ctrl+V way too long :). With MoveFileHere you press F7 to move the latest downloaded file to the active Explorer folder. The hotkey and folder can be changed in settings. Copy and rename MoveFileHere.exe to e.g. MoveFileHere2.exe to set up multiple hotkeys and folders.
See GitHub README for more details.

Note: antivirus tools may incorrectly flag the AutoHotkey compiled .exe file. You can always install AutoHotkey and then compile MoveFileHere yourself from the .ahk source file or simply run the .ahk source directly.

MoveFileHere helps a workflow where we make the browser always download to a fixed Downloads folder and then quickly move the file elsewhere afterwards. Compare that to the workflow of quickly picking a custom download/save folder for each download using Listary or the small SaveAsPathHelper script I quickly made to mimic some Listary features.

After pressing F7 the user accepts the move with Enter, Space or Left Click. To instead cancel the move press Esc, F7 again or wait 2 seconds.

11
Another issue is how well the editor/program integrates into a system where there are many types of files. Again I don't think any of them are great for doing this.
Yeah, there is a lot of friction to overcome there. I have an AutoHotkey script setup: I put no-markup filepaths or filenames in the plaintext notes. Later I select a whole or part of such a string (or put the cursor inside it) and press a hotkey. The script detects if there is a unique file anywhere matching the string pattern and takes action depending on filetype. E.g. open PDF in pdf viewer, open source code file in VS Code and so on. If multiple files match action alternatives are shown. If no file is matched alternatives to open up a file search in Everything or do a Google search are shown. Since this works on any text selection anywhere I can use the same approach across different apps, local or web based. For example I use it also in notes written in Google Docs, in effect links from Docs to the local filesystem. I considered making it a NANY tool this year but the thing is still evolving and is very tied to my own note taking setup and how I tend to use the target files, so difficult to make into a more general application yet. But I think this kind of customizable inbetween tool is the best option, since it is unlikely that any specific note taking app will also be a best fit for how you want to deal with various other types of files.

12
General Software Discussion / Re: Automatic text software for Windows
« on: November 29, 2020, 04:51 AM »
Lintalist is a great tool for that https://lintalist.github.io/ . Free and open source.

There is a DC forum thread about it here https://www.donation...x.php?topic=41475.25 and also a thread in the AutoHotkey forums if you have questions.

13
Find And Run Robot / Re: FARR mini weather report from wttr.in
« on: November 24, 2020, 05:53 PM »
Cool idea, but wouldn't it be easier to have the weather be shown in the results?
something like an alias with htmlviewurl https://wttr.in/london?format=%c+%t+%C in the results?
Then the emoji did not show correctly when I tested it - see note at the end of my post. But works for only text/numbers.

14
I wanted to exclude folders in this particular case because the search folder is used in an alias that also has an alias action to do "showfilehtml" (previous thread). Then folders are of no use in the results list. Or worse: FARR freezes on my PC if the "showfilehtml" action is by accident done on a folder result. Not sure if that is a general issue or something with my setup though.

Answering myself, there does seem to be a general issue/bug with FARR (or IE in FARR) there. To reproduce create this alias
name: showfilehtml_test
regex: ^(h:) (.+)$
result: showfilehtml $$2
and create an empty folder "C:\testing" and type "h: C:\testing" in FARR.
FARR will show an Explorer like view of the empty folder and after a few seconds freezes. Sometimes FARR shows an error message and closes its process. Other times the FARR process must be closed manually. If this is a general thing then maybe prevent showfilehtml from acting on folders? Though still possible that this varies with some underlying IE settings.

15
hmm this is a good question.. Let me go look at the code.. If there isn't an easy way to do what you want I will add it; I was doing some little tweaks to FARR today so I can finally work on it a bit.
Hi mouser, great! A bit of context: I wanted to exclude folders in this particular case because the search folder is used in an alias that also has an alias action to do "showfilehtml" (previous thread). Then folders are of no use in the results list. Or worse: FARR freezes on my PC if the "showfilehtml" action is by accident done on a folder result. Not sure if that is a general issue or something with my setup though.

16
This may have been solved before but I didn't find it with search just now.

In FARR settings the search folders page has a field for restricting what to search in the folder.
How do we restrict the search to not show any folders? That is, the search results should show files in the specified folder and in its subfolders, but should not show the subfolders themselves.

search_folders.png

We can include file extensions with "txt;pdf;md" and exclude file extensions with "-mp4;mkv;avi".

But the on screen help text says nothing about folders. Nor does the help page https://www.donation...lp/searchfolders.htm Is there a syntax for that field to exclude folders? ( 2009 thread requested such syntax. )

I tried "-\" and "-\\" but neither worked.

If the search folder modifier keyword is used in an alias together with dosearch then one workaround is to add "-\" in the alias result line (or manually in the searchbox) to exclude folders. Or alternatively "+." to only include files. Helpfile page on that.

That workaround excludes folders, with one exception it seems: the base folder for the search folder settings is still included. For example in the screenshot above the base folder would be "C:\FARR\farr-tldr". But I noticed that if we in the alias instead add "-\\" (two slashes instead of one) then the base folder is also excluded. Though that seems undocumented behaviour.

17
Follow up post to the above GIF tests. This FFmpeg oneliner has nice results
ffmpeg -y -i file.mp4 -filter_complex "[0:v]fps=10,split[v0][v1];[v0]palettegen[plt];[v1][plt]paletteuse" file.gif
ffmpeg.gif (212 kB)
To my eyes it looks less grainy than the earlier GIFs from imgur and cloudconvert, at a pretty small filesize cost.

Found here https://stackoverflow.com/a/60041579 , and the doc page is https://ffmpeg.org/f...rs.html#palettegen-1

We can also shave off a few extra kB by going down to fps=5 with similar output quality.

18
Find And Run Robot / FARR mini weather report from wttr.in
« on: November 19, 2020, 11:55 AM »
Wttr is a fun and fast URL based command line weather report tool.
Background and syntax here https://github.com/chubin/wttr.in

This post describes how to show wttr weather as text directly in the FARR searchbox.

wttr.gif

Step 1. create a FARR alias
name: weather
regex: ^(weath|weat|wea)$
result: weather | appcap "C:\folder\FARR_weather_helper.exe"

Step 2. prepare helper AutoHotkey script
- Save code to C:\folder\FARR_weather_helper.ahk
- Modify the wttr URL in the code: which location? what data to show? language? extra text?
- Compile the script to an .exe file (necessary since FARR's appcap doesn't work if we run .ahk scripts uncompiled, it seems)
Code: Autohotkey [Select]
  1.  
  2. ; FARR_weather_helper.ahk
  3. ; 2020-11-19 by Nod5
  4. ; helper script to show weather from wttr.in in FARR searchbox
  5. ; wttr details and syntax at https://github.com/chubin/wttr.in
  6.  
  7. ; prepare wttr URL (must escape each % character with `)
  8. vUrl := "https://wttr.in/london?format=`%c+`%t+`%C"
  9. ; example output: ☀️ +9°C Sunny
  10.  
  11. ; download weather page to variable
  12. vString := urlDownloadToVar(vUrl)
  13.  
  14. ; replace FARR searchbox string with weather string via clipboard paste
  15. ; clipboard pastes all at once so won't trigger other aliases
  16. vBackup := ClipboardAll
  17. Clipboard := vString
  18. Send ^a^v
  19. sleep 500
  20. Clipboard := vBackup
  21. vBackup := ""
  22.  
  23.  
  24. ; function: dowload URL and return it as variable
  25. UrlDownloadToVar(url, raw :=0)
  26. {
  27.   ; prefix https:// if not found
  28.   if( !regExMatch(url,"i)https?://") )
  29.     url := "https://" url
  30.   try
  31.   {
  32.     hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
  33.     hObject.Open("GET",url)
  34.     hObject.Send()
  35.     return raw ? hObject.ResponseBody : hObject.ResponseText
  36.   }catch err{
  37.       MsgBox % err.message
  38.   }
  39.   return 0
  40. }

Alternatives
Here are some alternative ways to use wttr in FARR
  • Load the wttr URL as embedded webpage in FARR
  • Run a script to get the URL weather text and show as a FARR results line via appcapresults
  • Run a script to get the URL weather text and show it in FARR searchbox via FARR's command line parameter -search
But in all these three cases FARR does not show the unicode weather emoji correctly.
However wttr also has options for richer output formats such as multiline or even mapped weather reports as .png images, and that could probably look quite nice in FARR's HTML view.

19
Find And Run Robot / Re: Farr strecthed idea, send key strokes
« on: November 18, 2020, 04:00 PM »
You can create alias actions that send keys to the window that was active before FARR started
example | sendkeys abc
https://www.donation...ulate_keypresses.htm
https://www.donation...l_launch_strings.htm

Note to mouser: I noticed that if we chain sleep and sendkeys commands then FARR sleeps, sends the keys and reopens and refocuses FARR. If we don't have the sleep command FARR doesn't reopen after sending the keys. Bug?
example | sleep 2000 ;;; sendkeys abc

20
Is it only one batchfile in a fixed location? In that case, how about an alias for that batchfile, with the path to another file as command line parameter. You type the start of the alias in FARR and then drag and drop the file you want as parameter in the FARR searchbox. Its path will then be added to the FARR searchbox. You next press enter to trigger to alias action. Would look something like this:

https://i.imgur.com/mJgfeP1.mp4

21
Nice 4wd! One idea is to search for artist name and use the first match as artist page URL input into the rest of your program.
The URL format is
https://www.discogs.com/search/?type=artist&title=ac+dc
Other URL parameters can be detected by playing around with options on https://www.discogs.com/search/advanced

This could be a little NANY 2021 app.

22
You could maybe achieve this with some combination of appcapresult and external scripts that returns preformatted results, leveraging the showfilehtml action modifier
I already do that - that's what the mp4 recording illustrates. But as noted there are sometimes slowdowns, from the roundtrip to the external script and back.

23
Please, is there any way to set the clock MANUALLY?

What Deozaan wrote. Or if you prefer the command line, open windows terminal and use the command "time".
https://ss64.com/nt/time.html

24
Nice tip, useful in some cases.

I now realize this minor request can be seen as part of the more general wish for ways to customize how search results look while searching in my other recent post.

25
Find And Run Robot / Re: FARR doesn't display icons for exes in path
« on: October 28, 2020, 02:40 PM »
I confirm this issue.

Pages: [1] 2 3 4 5 6 ... 45next