topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Wednesday January 26, 2022, 11:26 am
  • 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 ... 46next
1
That's a super duper niche request ;D Seems like a very small set of people who need to incrementally prefix rename desktop icons in horizontal order often enough that starting a dedicated tool could save them time compared to doing it manually?

A tip if anyone goes for it: There are existing functions in the AutoHotkey forums for getting filepaths from selected Desktop files and also for getting the X Y position of all Desktop icons. Use both to find the horizontal order.

2
N.A.N.Y. 2021 / Re: NANY 2021: MoveFileHere
« on: January 09, 2022, 07:08 AM »
I'm (very) embarrassed about the lateness of this response, but this works a treat -- thank you very much  :-[  :up: :up:
No worries, thanks for testing the fix. I updated the main GitHub release with it now.

3
Hi, I can't make it work on Windows 10. Could you fix it?
It works on Windows 10. The old ffmpeg link has expired but you can get a compatible version of ffmpeg and ffprobe in ffmpeg-master-latest-win64-gpl-shared.zip on this release page
https://github.com/B...peg-Builds/releases/

4
N.A.N.Y. 2022 / Re: Pledge: Search Thing
« on: December 18, 2021, 01:08 PM »
I like customizable short search syntaxes for browsers, the more the merrier. The description has some similarity with Yubnub https://yubnub.org/ , which I had almost forgotten exists.

5
I still run FARR in Windows 10 so can't comment about Win 11 folder changes.

One alternative though is to use FARR in portable mode. The latest release is here https://www.donation...ex.php?topic=10505.0
Better safe than sorry: make a backup of your aliases and settings before migrating to portable mode.

6
Latest insider version of Obsidian brings
Neat features!

I haven't been keeping up with the huge stream of note taking apps (and their updates) for a while. Do you know if Obsidian or any competitor by now has an easy way to treat indentation spaces as... indentation spaces. That is, to override the default Markdown rule that treats four space indentation as a code block. I know about the workaround to use   (stack overflow) but am looking for a built in solution.

7
Easy to do with Everything https://www.voidtools.com/
For example if the start folder of the tree is "C:\tree" then you can list all its subfolders with "xyz" in the subfolder name with this search line. (The option "match path" in the menu "Search" must also be enabled.)
"C:\tree\" xyz folder:
You can then select the subfolders in the results list and delete them, just like in File Explorer. Doing so will also delete any files within those subfolders, of course. If the subfolder name fragment you search for has spaces then quote enclose it e.g. "abc def".

3.png

This basic example can be modified for more complex searches, for example with regex pattern matching instead of a plain string.

8
A similar tool: magic wormhole
Some discussion of both here https://news.ycombin...com/item?id=27262193
Croc had some vulnerabilities earlier this year but are fixed now.

9
Find And Run Robot / Re: Powershell problems
« on: September 09, 2021, 09:56 AM »
If you have the new Windows Terminal you can also do
C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\wt.exe powershell ssh

11
The upcoming version 1.5 of Everything will add a lot of features for dealing with file properties. Worth a look. Overview here https://www.voidtool....php?f=12&t=9788

12
N.A.N.Y. 2021 / Re: NANY 2021: MoveFileHere
« on: July 21, 2021, 02:55 AM »
I can confirm that I too had the exactly same issue, when accessing hwnd, the program would crash.

I seem to get error messages no matter what I do

I have still not been able to reproduce the crash so cannot yet explain what the root cause is. Here is a test .ahk version (requires AutoHotkey installed) with an attempted workaround. Can you test it and tell me if the error still happens?

https://github.com/n...721/MoveFileHere.ahk

13
Post New Requests Here / Re: [IDEA] hotkey/shortcut tracker
« on: May 29, 2021, 04:54 AM »
AutoHotKey?
A few tips for AutoHotkey. Pick one organizing system for your hotkeys and stick to it. Some variants:
1. collect all hotkeys in a single .ahk file. You can then simply open the source and look up all hotkeys there. Search for "::" to look up hotkey definitions e.g. "^k::".
2. Separate files, but all hotkeys for one application or window in one .ahk
3. Separate files, but put the hotkey keys in the filename. For example "Firefox copy URL (ctrl+K).ahk". If consistently done then you can search for a hotkey with Everything or similar file search tool.

Also
4. Use a plaintext search tool like ripgrep to instantly search the contents of a whole folder of .ahk source files.
5. Use this script to show a list of all currently running AutoHotkey files.

14
Good request, would be neat to have. Thinking out loud, without yet knowing the answer: I wonder if these could be used to toggle auto-hide on/off per monitor. Will investigate that further when I have more time.
https://docs.microso...lapi-shappbarmessage
https://docs.microso...-shellapi-appbardata

edit:
I tried this AHK script but edited to specify the APPBARDATA structure's second member hWnd to target the taskbar on one of my two monitors (class: Shell_TrayWnd , Shell_SecondaryTrayWnd). But the change still applied to both taskbars. So no success thus far.

Perhaps Display Fusion creates its own individual taskbars that minimic the look and functionality of the native Windows 10 taskbar?

15
Is there some way to view a folders contents the same way, but with an alias to a path.
Here are three slightly different ways. In each start with
alias name: my_docs
alias regex: ^(my_docs|my_doc|my_do|my_d)$         (Not required, but faster. Modify as you want it.)

and then choose one of these
alias result: dosearch C:\users\someone\
alias result: restartsearch C:\users\someone\
alias result: dolaunch restartsearch C:\users\someone\

How they differ:
dosearch: Immediately list folder contents in FARR results.
restartsearch: Show result "restartsearch C:\users\someone" and wait for (Enter) to list folder contents.
dolaunch restartsearch: Immediately list folder contents in FARR results and show folder path in FARR search box.

1.png
2.png

16
I should also mention that if you're looking to paste a lot of different multiline strings then Lintalist is a good standalone tool. The landing page is a bit daunting but it is easy to use once you get going. There's a DC post for it here.

17
Is there an alias that works just like paste %WHATEVER% ... except it takes the contents of %WHATEVER% from a filepath on your local machine?
Not currently I think. FARR does have the built in alias command fileresults which reads the contents of a text file. But I don't recall any FARR method to use what it reads as a variable for a subsequent paste command.

We could ask mouser to add such a variable to FARR though. (It could then be named %lastfileresults%, similar to how the alias command appcap stores its return value in %lastappcap%)

In the meantime you can use an external helper script for this. Here is a simple AutoHotkey example
Code: Autohotkey [Select]
  1. ; read string from textfile and paste in active window
  2. FileRead, String, C:\file.txt
  3. Clipboard := String
  4. Send ^v

Save the script as ReadPaste.ahk and use an alias result line like this
read string from .txt and paste in active window | C:\folder\ReadPaste.ahk

A more advanced version could pass a regex pattern from the FARR alias as parameter to the script, for example to select another text file to read and paste from.

18
Also briefly tested the txt-as-md plugin on a test vault.
That's interesting. I see in https://forum.obsidi...txt-code-etc/1656/50 that there is discussion about two possible features.
1. Have Obsidian read .txt (and other plaintext) files as if markdown (apply markdown styling, and so on)
2. Have Obsidian read .txt as plain plaintext (no markdown styling)

The plugin does 1 AFAICT. But if this gets wings perhaps both 1 and 2 will get implemented, and maybe also a further feature
3. Have Obsidian read files with extension .NNN as some other, perhaps user customized plaintext format that differs from markdown. For example, AsciiDoc.
That is, users would in a config file tell Obsidian to treat filetypes {.md, .txt} as MarkDown, {.asciidoc, .adoc, .asc} as AsciiDoc, and so on.

Obsidian would expand to be a more general system-of-plaintext-notes editor/viewer. Compare to how VS Code is an editor/viewer for code in different programming languages. That ties in with our previous discussions here for/against the markdown format(s) and alternatives to it.

19
Save to FARR_resolve_alias_variables.ahk (with UTF-8 BOM encoding). Requires AutoHotkey

Will work in most cases, but might fail on complex alias text with e.g. escaped % characters.

Code: Autohotkey [Select]
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. ; FARR_resolve_alias_variables.ahk
  4.  
  5. ; by Nod5 on 2021-03-16
  6.  
  7. ; A helper tool for FARR (Find And Run Robot) written in AutoHotkey
  8.  
  9. ; Reads alias result from active FARR "Edit Group Alias" window
  10. ; and resolves (converts) FARR's UserVar variables to text values
  11.  
  12. ; For example the variable "%uservar.Browser.Chrome%" is replaced
  13. ; with e.g. "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
  14.  
  15. ; How to use:
  16. ; Run script and press F8 when FARR Options "Edit Group Alias" window is active
  17. ; A MsgBox shows the results lines with resolved UserVars
  18.  
  19. ; Optional: uncomment lines near end of script to also
  20. ; - Copy text to clipboard
  21. ; - Write text to .txt file
  22.  
  23. ; Discussion
  24. ;   https://www.donationcoder.com/forum/index.php?topic=51199.0
  25.  
  26.  
  27. ; default path to FARR .ini file (edit this filepath if the .ini is in another location)
  28. vFarrIni := "C:\Users\" A_UserName "\Documents\DonationCoder\FindAndRunRobot\FindAndRunRobot.ini"
  29. return
  30.  
  31. #IfWinActive, Edit Group Alias ahk_exe FindAndRunRobot.exe ahk_class TAliasForm
  32. F8::
  33.   if !FileExist(vFarrIni)
  34.   {
  35.     MsgBox % "Error: FindAndRunRobot.ini not found.`n`nEdit script and add correct path to it."
  36.     ExitApp
  37.   }
  38.   ; get text from results editbox
  39.   ControlGetText, vText, TMemo2, A
  40.  
  41.   ; read UserVar data from FARR .ini
  42.   IniRead, vUserVars, % vFarrIni, ExtraSettings, UserVars, %A_Space%
  43.  
  44.   ; split lines to array
  45.   aUserVars := StrSplit(vUserVars, ">n>")
  46.  
  47.   ; object to store full variable/value pairs
  48.   aMap := Object()
  49.  
  50.   For Key, vLine in aUserVars
  51.   {
  52.     vLine := TRim(vLine)
  53.    
  54.     ; skip blank or comment line
  55.     if !vLine or (SubStr(vLine, 1, 2) = "//")
  56.       continue
  57.  
  58.     ; [Section]
  59.     if RegExMatch(vLine, "^\[(.+)\]$", vMatch)
  60.       vSection := vMatch1
  61.  
  62.     ; if variable line then get variable/value pair and add to map array
  63.     ; prefix variable name "uservar." and last found section name (if any)
  64.     if RegExMatch(vLine, "U)^(.+)=(.+)$", vMatch)
  65.     {
  66.       vVarName := "uservar." ( vSection ? vSection "." : "") vMatch1
  67.       vValue    := vMatch2
  68.       aMap["" vVarName] := vValue
  69.     }
  70.   }
  71.  
  72.   ; resolve
  73.   For vVarName, vValue in aMap
  74.     vText := StrReplace(vText, "%" vVarName "%", vValue) ; replace all
  75.  
  76.   ; show resolved text
  77.   MsgBox % vText
  78.  
  79.   ; put on clipboard
  80.   ;Clipboard := vText
  81.  
  82.   ; write to .txt file in this script's folder
  83.   ;FileAppend, % vText, % A_ScriptDir "\alias_resolved_" A_Now ".txt", UTF-8-RAW
  84. return
  85.  
  86.  
  87. ; ----------------------------
  88. ; notes of FARR User Variables (UserVar)
  89. ; ----------------------------
  90. ;   Used as variables in aliases
  91. ;   Set in FARR > Options > Lists > User Variables
  92. ;   Stored in FindAndRunRobot.ini
  93. ;     Default path C:\Users\<username>\Documents\DonationCoder\FindAndRunRobot\FindAndRunRobot.ini
  94.  
  95. ; Format in Options "User Variables" pane:
  96. ; -----
  97. ; TopTest=C:\folder\test.exe
  98. ; [SectionName]
  99. ; VarName=Value
  100. ; VarName2=Value2
  101. ; // comment line
  102. ;
  103. ; [Browser]
  104. ; Chrome=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
  105. ; Firefox=C:\b\firefox.exe
  106. ; -----
  107. ; Note: it is allowed to create variables above the first [Section]
  108. ; Note: comments must be on separate lines. Not allowed: VarName=Value //comment
  109.  
  110. ; -----
  111. ; Format in FARR aliases:
  112. ; -----
  113. ;   %uservar.TopTest%
  114. ;   %uservar.SectionName.VarName%
  115. ;   %uservar.Browser.Chrome%
  116. ; -----
  117.  
  118. ; -----
  119. ; Format in FindAndRunRobot.ini
  120. ; -----
  121. ; Stored as a single line, ">n>" is linebreak separator
  122. ; Example:
  123. ; UserVars=TopTest=C:\folder\test.exe>n>[SectionName]>n>VarName=Value>n>VarName2=Value2>n>// comment line>n>>n>[Browser]>n>Chrome=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe>n>Firefox=C:\b\firefox.exe
  124. ; ----------------------------

20
I don't think FARR has that feature built in, but it would be a useful feature. I have AutoHotkey code that resolves the FARR user variables. I'l clean that up and post here as a helper tool for FARR when I have more time.

21
Here you go.
Neat! I will experiment with that.

22
Here you go.
That looks nice, seems functional for this request.

Off topic: I have come across Sciter a few times before but haven't made anything with it. I see you have a small test repo that transpiles some ahk to sciter here https://github.com/G...ovArpa/ahk-to-sciter . Let me ask: do you know of some Sciter project with AutoHotkey interop, like what is available for Python https://github.com/sciter-sdk/pysciter ?

23
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. ; -----------------------------------

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

25
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?

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