topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Saturday April 27, 2024, 8:50 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 - anonymous29038 [ switch to compact view ]

Pages: [1]
1
CSVPad is a really decent software, and I can't believe it doesn't support the most basic thing as opening files in the command line. This also means that it does not work with file associations, which is a huge pain. Fortunately I know some AutoHotkey to make it work. Thought I'd share the code here:

Code: Autohotkey [Select]
  1. ;@Ahk2Exe-SetMainIcon CSVpad.ico
  2. ;@Ahk2Exe-SetDescription CLI for the simple CSV editor
  3. ;@Ahk2Exe-SetVersion 1.2.0.1
  4.  
  5. SetWorkingDir %A_ScriptDir%
  6.  
  7. Files := A_Args[1]
  8.  
  9. Run CSVpad.exe,,, PID
  10. If (Files != "") {
  11.     WinWait % "ahk_pid" PID
  12.     DropFiles(Files, "ahk_pid" PID)
  13. }
  14. Return
  15.  
  16. DropFiles(FileList, wTitle="", Ctrl="", X=0, Y=0, NCA=0) {
  17.     characterSize := A_IsUnicode ? 2 : 1
  18.     fns:=RegExReplace(FileList,"\n$")
  19.     fns:=RegExReplace(fns,"^\n")
  20.     hDrop:=DllCall("GlobalAlloc","UInt",0x42,"UInt",20+(StrLen(fns)*characterSize)+characterSize*2)
  21.  
  22.     p:=DllCall("GlobalLock","UPtr",hDrop)
  23.     NumPut(20, p+0)  ;offset
  24.     NumPut(x,  p+4)  ;pt.x
  25.     NumPut(y,  p+8)  ;pt.y
  26.     NumPut(0,  p+12) ;fNC
  27.     NumPut(0,  p+16) ;fWide
  28.     NumPut(A_IsUnicode ? 1 : 0,  p+16) ;fWide
  29.  
  30.     p2:=p+20
  31.     Loop,Parse,fns,`n,`r
  32.     {
  33.         DllCall("RtlMoveMemory","UPtr",p2,"Str",A_LoopField,"UPtr",StrLen(A_LoopField)*characterSize)
  34.         p2+=StrLen(A_LoopField)*characterSize + characterSize
  35.     }
  36.     DllCall("GlobalUnlock","UPtr",hDrop)
  37.     PostMessage, 0x233, hDrop, 0, %Ctrl%, %wTitle%
  38. }

Pages: [1]