Messages - Nod5 [ switch to compact view ]

Pages: prev1 ... 25 26 27 28 29 [30] 31 32 33 34 35 ... 234next
146
Microsoft keeps adding nice stuff to the revived PowerToys apps
https://github.com/microsoft/PowerToys

Most recently PowerToys Run, a launcher app that has some similarity with FindAndRunRobot
https://github.com/microsoft/PowerToys/tree/master/src/modules/launcher

Here are my subjective impressions after some quick tests.

1. PowerToys Run has a nice, clean interface with big fonts and no clutter. It takes inspiration from the launcher Wox.

1.png

FARR can be similarly minimally styled using the slenderFARR skin, display option "Large Icon Slides", dragging to hide the toolbar buttons, and using a script to hide the statusbar text.

2.png

2. Run has built in support for CMD/terminal commands through the > prefix.

3.png

FARR can do that too by creating an alias like this:

alias name: run terminal command
RegEx: ^>(.*)
Results:
cmd | C:\Windows\System32\cmd.exe /c $$1

4.png

5.png

3. PowerToys Run can search and switch to open windows. That's a nice to have feature!

4. PowerToys does not have aliases. FARR has very powerful aliases. That is a huge difference. Aliases make FARR searches and actions very easy to customize - it becomes a much more powerful and versatile tool. Even more so when combined with some small AutoHotkey scripts.

All in all I still prefer FARR. Not a big surprise I suppose!  ;D But its age is showing a bit.
- I wish the FARR default UI had a more flat and minimal design.
- To create/test/edit/share/backup FARR aliases is a bit clunky, which might prevent new users from making and using the more powerful aliases features.
- The FARR options give intricate control of search result scoring, which was perhaps more relevant for the era of slow hardrives than for new faster SSD storage.

147
Nice! Here is a helper hotkey script to more quickly go from a regular FARR search to activating the "choose program" alias for the first search match by using an exclamation character as keyboard shortcut.

Code: Autohotkey [Select]
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. ; choose program FARR alias helper hotkey script.ahk
  4. ; 2020-05-23
  5. ; by Nod5
  6.  
  7. #IfWinActive, ahk_exe FindAndRunRobot.exe
  8. ; press ! to expand first FARR match file path and append --
  9. !::
  10.   ControlGetFocus, vFocusControl, A
  11.   ; if FARR search box focus and options not open
  12.   if (vFocusControl = "TEdit1")
  13.     if !WinExist("ahk_class TOptionsForm")
  14.     {
  15.       ; show first result file full path in FARR search box
  16.       Send {down}{right}
  17.       ; append -- to trigger "choose program" alias
  18.       Send --
  19.     }
  20. Return

Screenshot of the alias
alias.png

Gif of how it all works
https://imgur.com/a/YzJlRhx

(Edit: cannot embed .mp4 video in forum posts it seems so I added link to Imgur instead)

Edit2: mouser could uppdate FARR with special variables that represent the full path of a file result, maybe %resultfile1% or similar. Then we could skip the AutoHotkey script and instead make an alias that triggers on "!" anywhere in the searchbox and reacts by doing "restartsearch %resultfile1% --".

148
This worked for me in a quick test. But do try it out on some smaller folders first to see that it works as expected on your files, since mp3 tags and exif data can be complicated and I don't know if the function I use handles all corner cases correctly.

Code: Autohotkey [Select]
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. ; sort mp3 files into folders based on bitrate and if they are VBR or not
  4. ; AutoHotkey script
  5. ; by nod5
  6. ; 2020-05-14
  7.  
  8. ; ---------------------------------------
  9. ; folder with mp3 files that we want to sort move
  10.  
  11. sourcefolder      := "C:\some\folder"
  12.  
  13. ; also recurse in sourcefolder? 1 means yes, 0 means no
  14. recurse := 1
  15.  
  16. ; target folder where we want the files to end up in subfolders
  17. ; for example VBR files go to \VBR subfolder, 128kbs CBR files got to \128 subfolder
  18.  
  19. destinationfolder := "D:\this other\location"
  20.  
  21. ; ---------------------------------------
  22.  
  23. ; disable recurse if in/out folders are same, to avoid endless loop
  24. if (sourcefolder = destinationfolder)
  25.   recurse := 0
  26.  
  27. ; recursively loop sourcefolder for mp3 files and move to a destinationfolder subfolder
  28. Loop, Files, % sourcefolder "\*.mp3", % recurse ? "R" : ""
  29. {
  30.   ; get audio properties as object
  31.   ; we need these two properties:
  32.   ; System.Audio.EncodingBitrate      examples: 128000 (which is 128kbs), 320000, 263704, ...
  33.   ; System.Audio.IsVariableBitRate    value -1 if VBR otherwise value 0
  34.   Props := ["System.Audio.IsVariableBitRate", "System.Audio.EncodingBitrate"]
  35.   obj := Filexpro(A_LoopFilePath,, Props*)           ; v.90 By SKAN on D1CC @ goo.gl/jyXFo9
  36.  
  37.   ; if VBR then move to subfolder "\VBR"
  38.   if (obj["System.Audio.IsVariableBitRate"] = "-1")
  39.     subfolder := "VBR"
  40.   else
  41.   {
  42.     ; else move CBR to matching bitrate folder, for example "\128"
  43.     ; get bitrate in kbs, for example 128000 -> 128
  44.     subfolder := SubStr(obj["System.Audio.EncodingBitrate"],1,-3)
  45.   }
  46.   if subfolder
  47.   {
  48.     if !FileExist(destinationfolder "\" subfolder)
  49.       FileCreateDir, % destinationfolder "\" subfolder
  50.     FileMove, % A_LoopFilePath, % destinationfolder "\" subfolder
  51.   }
  52. }
  53. ToolTip DONE
  54. sleep 2000
  55.  
  56.  
  57.  
  58. ; function: Filexpro
  59. ; get extended properties from file
  60. ; by SKAN 2018-12-11
  61. ; https://www.autohotkey.com/boards/viewtopic.php?t=59882
  62.  
  63. Filexpro( sFile := "", Kind := "", P* ) {           ; v.90 By SKAN on D1CC @ goo.gl/jyXFo9
  64. Local
  65. Static xDetails
  66.  
  67.   If ( sFile = "" )
  68.     {                                                           ;   Deinit static variable
  69.         xDetails := ""
  70.         Return
  71.     }
  72.  
  73.   fex := {}, _FileExt := ""
  74.  
  75.   Loop, Files, % RTrim(sfile,"\*/."), DF
  76.     {
  77.         If not FileExist( sFile:=A_LoopFileLongPath )
  78.           {
  79.               Return
  80.           }
  81.  
  82.         SplitPath, sFile, _FileExt, _Dir, _Ext, _File, _Drv
  83.  
  84.         If ( p[p.length()] = "xInfo" )                          ;  Last parameter is xInfo
  85.           {
  86.               p.Pop()                                           ;         Delete parameter
  87.               fex.SetCapacity(11)                               ; Make room for Extra info
  88.               fex["_Attrib"]    := A_LoopFileAttrib
  89.               fex["_Dir"]       := _Dir
  90.               fex["_Drv"]       := _Drv
  91.               fex["_Ext"]       := _Ext
  92.               fex["_File"]      := _File
  93.               fex["_File.Ext"]  := _FileExt
  94.               fex["_FilePath"]  := sFile
  95.               fex["_FileSize"]  := A_LoopFileSize
  96.               fex["_FileTimeA"] := A_LoopFileTimeAccessed
  97.               fex["_FileTimeC"] := A_LoopFileTimeCreated
  98.               fex["_FileTimeM"] := A_LoopFileTimeModified
  99.           }              
  100.         Break            
  101.     }
  102.  
  103.   If Not ( _FileExt )                                   ;    Filepath not resolved
  104.     {
  105.         Return
  106.     }        
  107.  
  108.  
  109.   objShl := ComObjCreate("Shell.Application")
  110.   objDir := objShl.NameSpace(_Dir)
  111.   objItm := objDir.ParseName(_FileExt)
  112.                                                                
  113.   If ( VarSetCapacity(xDetails) = 0 )                           ;     Init static variable
  114.     {
  115.         i:=-1,  xDetails:={},  xDetails.SetCapacity(309)
  116.        
  117.         While ( i++ < 309 )
  118.           {
  119.             xDetails[ objDir.GetDetailsOf(0,i) ] := i
  120.           }
  121.  
  122.         xDetails.Delete("")
  123.     }
  124.  
  125.   If ( Kind and Kind <> objDir.GetDetailsOf(objItm,11) )        ;  File isn't desired kind  
  126.     {
  127.         Return
  128.     }
  129.  
  130.   i:=0,  nParams:=p.Count(),  fex.SetCapacity(nParams + 11)
  131.  
  132.   While ( i++ < nParams )
  133.     {
  134.         Prop := p[i]
  135.        
  136.         If ( (Dot:=InStr(Prop,".")) and (Prop:=(Dot=1 ? "System":"") . Prop) )
  137.           {
  138.               fex[Prop] := objItm.ExtendedProperty(Prop)
  139.               Continue
  140.           }
  141.          
  142.         If ( PropNum := xDetails[Prop] ) > -1
  143.           {
  144.               fex[Prop] := ObjDir.GetDetailsOf(objItm,PropNum)
  145.               Continue
  146.           }  
  147.     }
  148.  
  149.   fex.SetCapacity(-1)
  150. Return fex  
  151.  
  152. }

Alternatively if you want a GUI approach you could drag all the mp3 files into Mp3Tag, sort by columns bitrate and VBR, select a range of files e.g. all with 128 kbs and use right click context menu action "move...".

149
Find And Run Robot / Re: Launch, stay open and continue searching
« on: April 27, 2020, 12:54 PM »
Another small wrinkle related to the current launch and stay open option: FARR moves focus to the searchbox, instead of keeping focus at the line of the result that was launched.

Here is an AutoHotkey script that somewhat works around both issues. Somewhat since it only works when launching a result that points to file/folder path (not a complex alias result that launches multiple files, passes parameters or other extras). I imagine the script might also fail to keep focus in some situations, depending on how long it takes for the launched file to open in the default app for that extension.

Code: Autohotkey [Select]
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. ; FARR helper script to launch a file and continue search and keep focus in results list
  4.  
  5. ; 2020-04-27 by Nod5
  6.  
  7. ; Hotkey: Alt+Enter
  8. ; - launches the selected FARR result (a file or folder)
  9. ; - FARR continues searching
  10. ; - FARR stays open and keeps its focus in the results window
  11.  
  12. ; note: does nothing if the selected result is not an existing file/folder.
  13. ; In other words does nothing if the result is an complex alias result.
  14.  
  15. #IfWinActive, ahk_exe FindAndRunRobot.exe
  16. !Enter::
  17.   ; only react if user has focused FARR results list
  18.   ControlGetFocus, vFocusControl, A
  19.   if (vFocusControl != "TNextGrid1")
  20.     Return
  21.   ; get FARR window handle
  22.   vHwnd := WinExist("A")
  23.   ; use ctrl+C to get the path to selected file in FARR results
  24.   ; note: only works if result is a path to a single file (not a complex alias result)
  25.   clip := ClipToVar()
  26.   If !FileExist(clip)
  27.     Return
  28.   ; run the file
  29.   Run % clip
  30.   ; keep the FARR window active
  31.   While WinActive("ahk_id " vHwnd) and (A_Index < 100)
  32.     sleep 10
  33.   WinActivate, % "ahk_id " vHwnd
  34. Return
  35.  
  36. ;function: copy selection to clipboard to variable
  37. ClipToVar() {
  38.   cliptemp := clipboardall ;backup
  39.   clipboard =
  40.   send ^c
  41.   clipwait, 1
  42.   clip := clipboard
  43.   clipboard := cliptemp    ;restore
  44.   return clip
  45. }

150
Official Announcements / Re: Upgrading forum Dec 28, 2019
« on: April 25, 2020, 04:48 PM »
Some forums that run on phpBB have inline code and use a [c]tag like this[/c]. For example https://www.autohotkey.com/boards/
I found this customization page https://www.phpbb.com/customise/db/bbcode/inline_bbcode/ but I'm not sure if that is what AutoHotkey and others use today. I know that DC uses SMF though, so maybe that phpBB stuff is not relevant anyway?

I like to use inline code formatting in instructions e.g. when describing some command to type in the terminal or an exact filepath. Less ambiguous than just using quote marks or bold and more compact than adding a code block, especially if there are many small such snippets in a text.

Pages: prev1 ... 25 26 27 28 29 [30] 31 32 33 34 35 ... 234next
Go to full version