ControlGet, result, List, Selected Col1, SysListView321, A
System on the 2 reports I received was both Windows 7 64bit.
I'm running ahk_l ansi version.
ControlGet, result, List, Selected Col1, SysListView321, A
The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other messages (those >= WM_USER) to another process, you must do custom marshalling.
Source: SendMessageTimeout Function
That's only relevant if AutoHotkey64 doesn't have the same issue.For an x86 process interacting with an x64 process, [VirtualAllocEx and related] functions work fine, though they can only see the low 4GB of the 64-bit address space (as for an x86 process, their arguments and return values are 32 bits wide).
Source: DLL Injection and WoW64 | Corsix.org
Thank you for the additional information.Yes. Alternatively, use the /bin "binfile" command-line switch of Ahk2Exe_L, which is installed with AutoHotkey_L.
Thank you for the additional information.Yes. Alternatively, use the /bin "binfile" command-line switch of Ahk2Exe_L, which is installed with AutoHotkey_L.
By the way I have just realized that scripts using this line have to be compiled for the both 32-bit and 64-bit systems for distribution purposes, don't they? It means users who use 64-bit systems do not have a choice but to use the 64-bit compiled version.
I'm saying this just because I'm looking for the cleanest way to retrieve currently selecting file paths. I'd like to avoid messing up with Clipboard and I do not have the enough skill level to deal with COM.
How hard would it be to fix it? If it is not easy, I'll try to learn COM. But I guess other non-skilled coders would have to face hard time doing this too.
ShellFolder(hWnd=0,returntype=0) { If hWnd||(hWnd:=WinActive("ahk_class CabinetWClass"))||(hWnd:=WinActive("ahk_class ExploreWClass")) { sa := Com_CreateObject("Shell.Application") ;Find hwnd window wins := sa.Windows loop % wins.count { window:=wins.Item(A_Index-1) If Not InStr( window.FullName, "steam.exe" ) ; ensure pwb isn't Steam IE window which causes problems if(window.Hwnd=hWnd) break } doc:=window.Document sFolder := doc.Folder.Self.path sDisplay := doc.Folder.Self.name ;Don't get focussed item and selected files unless requested, because it will cause a COM error when called during/shortly after explorer path change sometimes if (returntype=2) { sFocus :=doc.FocusedItem.Path SplitPath, sFocus , sFocus } if(returntype=3 || returntype=4) { loop % doc.SelectedItems.Count { path :=doc.selectedItems.item(A_Index-1).Path "`n" ;= (returntype=3 ? sFolder "" COM_Invoke(doc.SelectedItems, "Item", A_Index-1).Name "`n" : COM_Invoke(doc.SelectedItems, "Item", A_Index-1).Name "`n") if(returntype=4) SplitPath, path , path sSelect.=path } StringReplace, sSelect, sSelect, \\ , \, 1 } ;Remove last `n StringTrimRight, sSelect, sSelect, 1 if (returntype=1) Return sFolder else if (returntype=2) Return sFocus else if (returntype=3) Return sSelect else if (returntype=4) Return sSelect else if (returntype=5) Return sDisplay } }
I won't know until I (try to) fix it.How hard would it be to fix it?
hmm, it doesn't work on my computer. It is supposed to return selected file paths, doesn't it? The code below just gives empty message boxes. (COM.ahk is installed)Something like this, uses COM.ahk though:
^1:: hwnd := WinExist("A") if hwnd { ;tooltip %hwnd% msgbox % ShellFolder(hwnd) } Return ShellFolder(hWnd=0,returntype=0) { If hWnd||(hWnd:=WinActive("ahk_class CabinetWClass"))||(hWnd:=WinActive("ahk_class ExploreWClass")) { sa := Com_CreateObject("Shell.Application") ;Find hwnd window wins := sa.Windows loop % wins.count { window:=wins.Item(A_Index-1) If Not InStr( window.FullName, "steam.exe" ) ; ensure pwb isn't Steam IE window which causes problems if(window.Hwnd=hWnd) break } doc:=window.Document sFolder := doc.Folder.Self.path sDisplay := doc.Folder.Self.name ;Don't get focussed item and selected files unless requested, because it will cause a COM error when called during/shortly after explorer path change sometimes if (returntype=2) { sFocus :=doc.FocusedItem.Path SplitPath, sFocus , sFocus } if(returntype=3 || returntype=4) { loop % doc.SelectedItems.Count { path :=doc.selectedItems.item(A_Index-1).Path "`n" ;= (returntype=3 ? sFolder "" COM_Invoke(doc.SelectedItems, "Item", A_Index-1).Name "`n" : COM_Invoke(doc.SelectedItems, "Item", A_Index-1).Name "`n") if(returntype=4) SplitPath, path , path sSelect.=path } StringReplace, sSelect, sSelect, \\ , \, 1 } ;Remove last `n StringTrimRight, sSelect, sSelect, 1 if (returntype=1) Return sFolder else if (returntype=2) Return sFocus else if (returntype=3) Return sSelect else if (returntype=4) Return sSelect else if (returntype=5) Return sDisplay } }
Thanks I'll try.feel free to improve it
Ok, thanks.I won't know until I (try to) fix it.
Oh sorry, I just noticed that the default parameter for returntype is wrong. Valid values are 1,2,3 and 4. By reading the code you should see what they return, or just try it.
^1:: hwnd := WinExist("A") if hwnd { ;tooltip %hwnd% Loop 6 msgbox % ShellFolder(hwnd, A_Index-1) } Return