-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJumpToFolder.ahk
2207 lines (1506 loc) · 56.5 KB
/
JumpToFolder.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
$ThisVersion := "1.0.8"
;@Ahk2Exe-SetVersion 1.0.8
;@Ahk2Exe-SetName JumpToFolder
;@Ahk2Exe-SetDescription Change active folder using Everything.
;@Ahk2Exe-SetCopyright NotNull
/*
By : NotNull
Info : https://www.voidtools.com/forum/viewtopic.php?f=2&t=11194
v 1.0.8
- Added support for Directory Opus
- Added routine to select the file in file managers
- BugFix: could be waiting on clipboard change indefinitely under certain conditions
- Improved timing
Version history at the end.
*/
;_____________________________________________________________________________
;
; SETTINGS
;_____________________________________________________________________________
#SingleInstance Force
#NoEnv
;#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input
SetBatchLines -1
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, RegEx
$IniFile := "JumpToFolder.ini"
; When settings not found in INI, use Out-Of-The-Box settings:
; Also used for resetting settings
; Icon: Use the same structure that PickIconDlg would return (for comparison).
$OOB_everything_exe := A_Space
$OOB_also_search_files := 1
$OOB_sort_by := "Run Count"
$OOB_sort_ascending := 0
$OOB_contextmenu_text := "Jump to Folder ..."
$OOB_contextmenu_icon := A_WinDir . "\system32\SHELL32.dll,23"
; Non-GUI options
$OOB_detected_everything_version := ""
$OOB_everything_instance := """"""
$OOB_debug := 0
; DopusDebug
; $OOB_slowdown := 200
; Read settings from INI file
IniRead, $everything_exe, %$IniFile%, JumpToFolder, everything_exe, %$OOB_everything_exe%
IniRead, $also_search_files, %$IniFile%, JumpToFolder, also_search_files, %$OOB_also_search_files%
IniRead, $sort_by, %$IniFile%, JumpToFolder, sort_by, %$OOB_sort_by%
IniRead, $sort_ascending, %$IniFile%, JumpToFolder, sort_ascending, %$OOB_sort_ascending%
IniRead, $contextmenu_text, %$IniFile%, JumpToFolder, contextmenu_text, %$OOB_contextMenu_text%
IniRead, $contextmenu_icon, %$IniFile%, JumpToFolder, contextmenu_icon, %$OOB_contextMenu_icon%
; Read non-GUI INI settings
IniRead, $detected_everything_version, %$IniFile%, JumpToFolder, detected_everything_version, %$OOB_detected_everything_version%
IniRead, $everything_instance,%$IniFile%, JumpToFolder, everything_instance, %$OOB_everything_instance%
IniRead, $debug, %$IniFile%, JumpToFolder, debug, %$OOB_debug%
IniRead, $start_everything, %$IniFile%, JumpToFolder, start_everything
; Expand environment variables in some ini entries
$everything_exe := ExpandEnvVars( $everything_exe )
$contextmenu_icon := ExpandEnvVars( $contextmenu_icon )
$everything_instance := ExpandEnvVars( $everything_instance )
$start_everything := ExpandEnvVars( $start_everything )
DebugMsg( "MAIN" , "Starting JumpToFolder version [" . $ThisVersion . "]" )
;_____________________________________________________________________________
;
; CHECKS, PART 1
;_____________________________________________________________________________
;
; Check if OS is 64-bit or 32-bit
; OS and ahk.exe must have the same bitness. Else exit
If (A_PtrSize = 8) AND ( A_Is64bitOS ) ; Both 64-bit
{
$bitness := 64
}
Else If (A_PtrSize = 4) AND ( !A_Is64bitOS ) ; Both 32-bit
{
$bitness := 32
}
Else If ( A_Is64bitOS ) ; 64-bit Win vs 32-bit ahk
{
MsgBox You need the 64-bit version of JumpToFolder
ExitApp
}
Else ; 32-bit Win vs 64-bit ahk
{
MsgBox You need the 32-bit version of JumpToFolder
ExitApp
}
; Don't Check availability and bitness Everythingnn.dll
; If not available, no incrementing runcount. No dealbreaker.
; Bitness isn't relevant either as IPC communication is always 32-bit.
$everything_instance := Trim($everything_instance," """"")
; Parameter check.
; 4 possibilities:
; - started through file association ("c:\path to\ahk.exe" "x:\path to script.ahk" [parms])
; - started through renamed ahk.exe ("x:\path to\script.exe" ["x:\path to script.ahk"] [parms])
; - started as compiled version ("X:\path to\ahk.exe" [parms])
; - started by random ahk.exe (drag/drop script.ahk or command D:\ahk.exe "x:\path to script.ahk" [parms])
;
; In all cases: parm1 =-jump (or nothing)
If ( A_Args[1] != "-jump" )
{
Goto GUI
}
; We are here because parm -jump detected. Start Everything, etc ..
;_____________________________________________________________________________
;
; CHECKS, PART 2
;_____________________________________________________________________________
;
; Check most important (INI) settings
IfNotExist, %$everything_exe%
{
MsgBox "%$everything_exe%" can not be found.`nCheck your JumpToFolder settings.
; start JumpToFolder without parms to change settings
ExitApp
}
; Check Everything version (1.4/1.5) if not specified in INI
DebugMsg( "Checks" , "Everything version = [" . $detected_everything_version . "]" )
If !( $detected_everything_version == "1.4" OR $detected_everything_version == "1.5" )
{
MsgBox This is not a supported Everything version.`r`n1.4 and 1.5 are supported.`r`n`r`nCheck and save your settings in the GUI.
ExitApp
}
;=============================================================================
;=============================================================================
;=============================================================================
;=============================================================================
;
; MAIN PROGRAM
;
;=============================================================================
;=============================================================================
;=============================================================================
;=============================================================================
;_____________________________________________________________________________
;
; INIT
;_____________________________________________________________________________
; Read Doubleclick speed (system setting)
$DoubleClickTime := DllCall("GetDoubleClickTime")
; Define hotkeys to be used in Everything
Hotkey, Escape, HandleEscape, Off
Hotkey, LButton, HandleClickHotkey, Off
Hotkey, Enter, HandleEnterHotkey, Off
;_____________________________________________________________________________
;
; REGULAR CODE
;_____________________________________________________________________________
; MsgBox DEBUG: And we're off !!!
; How and where is this started? Will return WindowType (Open/SaveAs dialog;explorer; ...)
Gosub GetWindowType
DebugMsg( "MAIN" , "Detected WindowType = [" . $WindowType . "]")
; Next version; Read the currently active path in file dialog or -manager.
; And add thgat as the Everything search path.
; WIP
; If IsFunc( "PathFrom" . $WindowType )
; MsgBox PathFrom%$WindowType% exists
; Start Everything; select a file or folder there.
$EverythingID := StartEverything($everything_exe)
DebugMsg( "MAIN" , "EverythingID = [" . $EverythingID . "]" )
Loop ; Start of WinWaitActive/WinWaitNotActive loop.
{
WinWaitActive, ahk_id %$EverythingID%
; Wait for Enter/Escape/ mouse double-click
; Read selected file/folder and ..
; Close Everything so we can continue with WinWaitNotActive
DebugMsg( "Everything active" , "We are in Everything" )
; The following hotkeys trigger getting the selected path in Everything.
; Returns $FolderPath and $FileName
Hotkey, Escape, On
Hotkey, LButton, On
Hotkey, Enter, On
; Listen for keyboard presses ESC and ENTER and respond to that.
; Also respond to double-click in result list.
; If any of those were used, Everything will be closed,
; so we can continue with:
WinWaitNotActive
Hotkey, Escape, Off
Hotkey, LButton, Off
Hotkey, Enter, Off
; In case another window was activated before getting the path.
WinClose, ahk_id %$EverythingID%
; Prepare found path to be fed to the original application (file manager/ -dialog)
; using the Feed%$WindowType% routine.
; check if found path empty. Do nothing (exit) in that case.
If ( $FoundPath )
{
DebugMsg( A_ThisLabel . A_ThisFunc, "Valid Path: [" . $FoundPath . "]" )
PathSplit($FoundPath, $FolderPath, $FileName)
; Add a backslash th FolderPath
$FolderPath := $FolderPath . "\"
DebugMsg( A_ThisLabel . A_ThisFunc, "$FolderPath = [" . $FolderPath . "]`r`n$FileName = [" . $FileName . "]")
Feed%$WindowType%( $WinID, $FolderPath, $FileName )
}
ExitApp
} ; End of WinWaitActive/WinWaitNotActive loop.
MsgBox We never get here (and that's how it should be)
;=============================================================================
;=============================================================================
;
; SUBROUTINES
;
;=============================================================================
;=============================================================================
;_____________________________________________________________________________
;
GetPathFromEverything(_EverythingID)
;_____________________________________________________________________________
;
{
Global $DoubleClickTime
Global $majorversion
Global $detected_everything_version
$EVERYTHING_IPC_ID_FILE_COPY_FULL_PATH_AND_NAME := 41007
If ( $detected_everything_version == "1.5")
{
ControlGetText, _FoundPath, EVERYTHING_RESULT_LIST_FOCUS1, A
DebugMsg( A_ThisLabel . A_ThisFunc, "detected_everything_version = [" . $detected_everything_version . "]`r`nFound path = [" . _FoundPath . "]" )
}
Else If ( $detected_everything_version == "1.4")
{
_ClipOrg := ClipBoard
ClipBoard := ""
Sleep 50
SendMessage, 0x111, %$EVERYTHING_IPC_ID_FILE_COPY_FULL_PATH_AND_NAME%,,, A
ClipWait,1
_FoundPath := Clipboard
DebugMsg( A_ThisLabel . A_ThisFunc, "detected_everything_version = [" . $detected_everything_version . "]" . "`r`n" . "Found path = [" . _FoundPath . "]" )
Sleep 20
ClipBoard := _ClipOrg
}
else ; should never happen
{
MsgBox Somehow this is not really Everything 1.4 or 1.5. Check your settings.
}
Return _FoundPath
}
;_____________________________________________________________________________
;
GetWindowType:
;_____________________________________________________________________________
;
; Get handle ($WinID) of active windows
$WinID := WinExist("A")
; Get More info on this window
; Get ahk_class
WinGetClass, $ahk_class, ahk_id %$WinID%
; Get ahk_exe
WinGet, $ahk_exe, ProcessName, ahk_id %$WinID%
; Get executable name including path.
; We need this for some filemanagers that will be (re)started with parameters.
WinGet, $Running_exe, ProcessPath, ahk_id %$WinID%
; Define window type (for usage later on)
; Detection preference order: 1. ahk_class 2. ahk_exe
; Ignore the Desktop
If ( $ahk_class = "Progman" ) ; Desktop
{
ExitApp
}
else If ($ahk_class = "TTOTAL_CMD") ; Total Commander
{
$WindowType = TotalCMD
}
; else If ($ahk_exe = "xplorer2_UC.exe" OR $ahk_exe = xplorer2.exe") ; XPlorer2
else If ($ahk_class = "ATL:ExplorerFrame") ; XPlorer2
{
$WindowType = XPlorer2
}
else If ($ahk_class = "dopus.lister") ; Directory Opus
{
$WindowType = DirectoryOpus
}
else If ($ahk_class = "DClass") ; Double Commander
{
$WindowType = DoubleCommander
}
; Q-Dir has a semi-random ahk_class: class ATL:000000014018D720
; Too risky. Fall back : ahk_exe
else If ($ahk_exe = "Q-Dir_x64.exe" or $ahk_exe = "Q-Dir.exe") ; Q-Dir
{
$WindowType = QDirFileMan
}
; ahk_class Salamander 3 and 4 is SalamanderMainWindowVer25, but might vary.
else If ( InStr($ahk_class, "SalamanderMainWindow") > 0) ; Altap Salamander
{
$WindowType = Salamander
}
else If ($ahk_exe = "XYplorer.exe") ; XYplorer
{
$WindowType = XYPlorer
}
else If ($ahk_exe = "explorer.exe") ; Windows File Manager
{
; Win10: WorkerW = desktop CabinetWClass = File Explorer
; Older: Progman = desktop CabinetWClass = File Explorer
$WindowType := "ExplorerFileMan"
}
else If ($ahk_exe = "FreeCommander.exe") ; Has no easy entry point ; Free Commander
{
$WindowType = FreeCommander
}
else If ($ahk_class = "#32770") ; Open/Save dialog
{
$WindowType := SmellsLikeAFileDialog($WinID)
If $WindowType ; This is a supported dialog
{
; MsgBox WindowType = %$WindowType%
}
else
{
MsgBox This is not (yet) supported in %$ahk_exe% .. ; Rest
; MsgBox Not a supported WindowType
}
}
else
{
MsgBox This is not (yet) supported in %$ahk_exe% .. ; Rest
ExitApp
}
return
;_____________________________________________________________________________
;
SmellsLikeAFileDialog(_thisID )
;_____________________________________________________________________________
;
{
; Only consider this dialog a possible file-dialog when:
; (SysListView321 AND ToolbarWindow321) OR (DirectUIHWND1 AND ToolbarWindow321) controls detected
; First is for Notepad++; second for all other filedialogs
; That is our rough detection of a File dialog.
; Returns the detected dialogtype ("OpenSave"/"OpenSave_SYSLISTVIEW"/FALSE)
WinGet, _controlList, ControlList, ahk_id %_thisID%
Loop, Parse, _controlList, `n
{
If ( A_LoopField = "SysListView321" )
_SysListView321 := 1
If ( A_LoopField = "ToolbarWindow321")
_ToolbarWindow321 := 1
If ( A_LoopField = "DirectUIHWND1" )
_DirectUIHWND1 := 1
If ( A_LoopField = "Edit1" )
_Edit1 := 1
}
If ( _DirectUIHWND1 and _ToolbarWindow321 and _Edit1 )
{
Return "OpenSave"
}
Else If ( _SysListView321 and _ToolbarWindow321 and _Edit1 )
{
Return "OpenSave_SYSLISTVIEW"
}
else
{
Return FALSE
}
}
;_____________________________________________________________________________
;
StartEverything(_everything_exe)
;_____________________________________________________________________________
;
; Start Everything (new window) withe specific settings from ini)
; Returns the windowID
{
; Global $everything_exe
Global $sort_by
Global $also_search_files
Global $everything_instance
Global $start_everything
_folders := $also_search_files ? "" : "folder: "
If ( $start_everything = "ERROR" OR $start_everything = "" )
{
; Get Working directory
SplitPath, _everything_exe, , _everything_workdir
_everything_workdir := Trim(_everything_workdir," """"")
Run, "%_everything_exe%" -sort "%$sort_by%" -instance "%$everything_instance%" -details -filter "JumpToFolder" -newwindow -search "%_folders%",%_everything_workdir%,, $EvPID
}
else ; special cases if start_everything INI-entry is defined.
{
; Get Working directory
SplitPath, $start_everything, , _everything_workdir
_everything_workdir := Trim(_everything_workdir," """"")
Run, %$start_everything% -details -filter "JumpToFolder" -newwindow -search "%_folders%",%_everything_workdir%,, $EvPID
}
; Wait until Everything is loaded
WinWaitActive, ahk_class ^EVERYTHING
; Get the ID of the window on top (assumption: that must be the freshly started Everything)
WinGet, _thisID, ID, A
; Remove menu bar of this Everything window (1.4)
DllCall("SetMenu", "uint", _thisID, "uint", 0)
; Everything 1.5 draws its own menu; disble it.
Control Disable,, EVERYTHING_MENUBAR1, A
; Control Hide,, EVERYTHING_MENUBAR1, A
; OK, we started Everything; we've got the ID of the Everything window, so we can talk to it later on.
Return _thisID
}
;_____________________________________________________________________________
;
ValidPath(_thisPath)
;_____________________________________________________________________________
;
; Check if path exists; returns True/False
{
; _thisPath := Trim( _thisFOLDER , "\")
; _withoutQuotes := Trim(_thisPath," """"")
; MsgBox _thisPath = [%_withoutQuotes%]
; IfNotExist, %_withoutQuotes%
IfNotExist, %_thisPath%
{
return false
}
else
{
return true
}
}
;_____________________________________________________________________________
;
PathSplit(_thisPath, ByRef $FolderPath, ByRef $FileName)
;_____________________________________________________________________________
;
; Splits path in folder- and filename part
{
; Check if $Result is a file or a folder. Use this to define variables:
; If folder: create $FolderPath
; If file: create $FolderPath AND $FileName
; Those will be used in the "Feed" routines (if applicable)
if InStr(FileExist(_thisPath), "D")
{ ; it's a folder
; DopusDebug
; Sleep %$slowdown%
$FolderPath := _thisPath
$FileName := ""
}
else
{ ; it has to be a file
SplitPath, _thisPath, $FileName, $FolderPath
}
; DopusDebug
; Sleep %$slowdown%
DebugMsg( A_ThisLabel . A_ThisFunc , "dir = [" . $FolderPath . "]`r`n Name = [" . $FileName . "]" )
Return
}
;_____________________________________________________________________________
;
HandleEscape:
;_____________________________________________________________________________
;
{
WinClose, ahk_id %$EverythingID%
Return
}
;_____________________________________________________________________________
;
HandleClickHotkey:
;_____________________________________________________________________________
;
{
; Detect if in Result list:
MouseGetPos, , , , _focus
If (_focus = "SysListView321")
{
If !(A_ThisHotkey = A_PriorHotkey and A_TimeSincePriorHotkey < $DoubleClickTime)
{ ; Single-click detected
Send {%A_ThisHotkey%}
return
}
; Double-click in resultlist detected, grab file/foldername
$FoundPath := GetPathFromEverything($EverythingID)
; Strip double-quotes and spaces
$FoundPath := Trim( $FoundPath, " """"" )
; Trim trailing backslash?
$FoundPath := RTrim( $FoundPath, "\" )
DebugMsg( A_ThisLabel . A_ThisFunc, "Found :`r`n[" . $FoundPath . "]" )
If ( $FoundPath )
{
DebugMsg( A_ThisLabel . A_ThisFunc, "You selected path:`r`n" . "[" . $FoundPath . "]" )
}
If ValidPath($FoundPath)
{
; We got our path; close Everything
WinClose, ahk_id %$EverythingID%
}
else
{
DebugMsg( A_ThisLabel . A_ThisFunc, "NOT a valid Path:`r`n[" . $FoundPath . "]" )
MsgBox,,,Path could not be found. Maybe off-line?`r`n[%$FoundPath%], 3
$FoundPath := ""
}
}
else if (GetKeyState("LButton","P")) ; drag event outside resultlist
{
sleep,20
Send, {LButton Down}
while (GetKeyState("LButton","P"))
sleep,20
Send, {LButton Up}
}
else ;simple click outside resultlist. Let it pass.
{
; send,{LButton}
Send {%A_ThisHotkey%}
}
}
Return
;_____________________________________________________________________________
;
HandleEnterHotkey:
;_____________________________________________________________________________
;
{
; Detect if in Result list:
ControlGetFocus, _focus, ahk_id %$EverythingID%
If (_focus = "SysListView321")
{
; ENTER in resultlist detected, grab file/foldername
$FoundPath := GetPathFromEverything($EverythingID)
Sleep 20
DebugMsg( A_ThisLabel . A_ThisFunc, "Found :`r`n[" . $FoundPath . "]" )
If ( $FoundPath )
{
DebugMsg( A_ThisLabel . A_ThisFunc, "You selected path:`r`n" . "[" . $FoundPath . "]" )
}
If (ValidPath($FoundPath))
{
; We got our path; close Everything
WinClose, ahk_id %$EverythingID%
}
Else
{
DebugMsg( A_ThisLabel . A_ThisFunc, "NOT a valid Path:`r`n[" . $FoundPath . "]" )
MsgBox,,,Path could not be found. Maybe off-line?`r`n[%$FoundPath%], 3
}
}
else ; ENTER outside result list; let it through
{
Send {%A_ThisHotkey%}
}
}
Return
;_____________________________________________________________________________
;
IsFocusedControl(_thiscontrol)
;_____________________________________________________________________________
;
{
; MouseGetPos, , , , _focus
ControlGetFocus, _focus, A
Return _focus = _thiscontrol ? true : false
}
;_____________________________________________________________________________
;
ExpandEnvVars(_thisstring)
;_____________________________________________________________________________
;
{
; https://www.autohotkey.com/board/topic/9516-function-expand-paths-with-environement-variables/
VarSetCapacity( _expanded, 2000)
DllCall("ExpandEnvironmentStrings", "str", _thisstring, "str", _expanded, int, 1999)
return _expanded
}
;_____________________________________________________________________________
;
DebugMsg(_routine, _message)
;_____________________________________________________________________________
;
{
Global $Debug
If ($Debug)
{
MsgBox, ,%_routine%, %_message%
}
Return
}
;=============================================================================
;=============================================================================
;
; FEEDER ROUTINES PER WINDOW TYPE
;
;=============================================================================
;=============================================================================
;; Start FEEDER ROUTINES PER WINDOW TYPE
;_____________________________________________________________________________
;
FeedTotalCMD( _thisID, _thisFOLDER, _thisFILE )
;_____________________________________________________________________________
;
{
Global $Running_exe
Run, "%$Running_exe%" /O /A /S /L="%_thisFOLDER%%_thisFILE%",,, $DUMMY
return
}
;_____________________________________________________________________________
;
FeedSalamander( _thisID, _thisFOLDER, _thisFILE )
;_____________________________________________________________________________
;
{
Global $Running_exe
If !_thisFILE
_thisFOLDER := RTrim( _thisFOLDER , "\")
else
_thisFOLDER=%_thisFOLDER%%_thisFILE%
Run, "%$Running_exe%" -O -A "%_thisFOLDER%",,, $DUMMY
return
}
;_____________________________________________________________________________
;
FeedFreeCommander( _thisID, _thisFOLDER, _thisFILE )
;_____________________________________________________________________________
;
{
; Details on https://freecommander.com/fchelpxe/en/Commandlineparameters.html
Global $Running_exe
Run, "%$Running_exe%" /C /Z /L="%_thisFOLDER%%_thisFILE%",,, $DUMMY
return
}
;_____________________________________________________________________________
;
FeedXYPlorer( _thisID, _thisFOLDER, _thisFILE )
;_____________________________________________________________________________
;
{
Global $Running_exe
; If ( _thisFILE = "" )
; {
; _thisFOLDER := RTrim( _thisFOLDER , "\")
; }
Run, "%$Running_exe%" "%_thisFOLDER%%_thisFILE%",,, $DUMMY
; Run, "%$Running_exe%" "%_thisFOLDER%",,, $DUMMY
return
}
;_____________________________________________________________________________
;
FeedDoubleCommander( _thisID, _thisFOLDER, _thisFILE )
;_____________________________________________________________________________
;
{
; Details on https://doublecmd.github.io/doc/en/commandline.html
Global $Running_exe
Run, "%$Running_exe%" -C "%_thisFOLDER%%_thisFILE%",,, $DUMMY
return
}
;_____________________________________________________________________________
;
FeedDirectoryOpus( _thisID, _thisFOLDER, _thisFILE )
;_____________________________________________________________________________
;
{
; Details on https://....
Global $Running_exe
Run, "%$Running_exe%\..\dopusrt.exe" /CMD GO "%_thisFOLDER%%_thisFILE%",,, $DUMMY
return
}
;_____________________________________________________________________________
;
FeedExplorerFileMan( _thisID, _thisFOLDER, _thisFILE )
;_____________________________________________________________________________
;
{
; REmote Control through COM object
; (Based on the research done here: https://autohotkey.com/boards/viewtopic.php?f=5&t=526)
; Go through all opened Explorer windows
; For the one that has the same ID as our Explorer window:
; Navigate to $FolderPath
; Doesn't like folderpaths with a # in it if it ends with a "\"
; so trim that one from the end.
_thisFOLDER := RTrim( _thisFOLDER , "\")
; If ( _thisFILE )
; {
; _thisFILE := "\" . _thisFILE
; }
For $Exp in ComObjCreate("Shell.Application").Windows
{
try ; Attempts to execute code.
{
_checkID := $Exp.hwnd
; MsgBox CheckID = %_checkID%
}
catch e ; Handles the errors that Opus will generate.
{
; Do nothing. Just ignore error.
; Proceed to the next Explorer instance
}
if ( _thisID = _checkID )
{
; Go to folder
$Exp.Navigate( _thisFOLDER )
; Select the file (if defined)
If ( _thisFILE )
{
sleep 100
_allfiles := $Exp.Document.Folder.Items
$Exp.Document.SelectItem(_allfiles.Item(_thisFILE), 0x1D)
}
break
}
}
return
}
;_____________________________________________________________________________
;
FeedOpenSave( _thisID, _thisFOLDER, _thisFILE )
;_____________________________________________________________________________
;
{
Global $DialogType