I started off with the script you originally posted, and implemented the suggestion by MilesAhead using "#IfWinExists ahk_class ... " instead of "#if WinExists(...)", though that doesn't matter much (tested both, worked just fine)
Then I tried to find the reason it didn't get the value for the DesPath variable, trying to understand how it got it in the first place. Then used the
AHK AutoIt3 Window Spy tool that comes with the AHK installer to find the control-name for the current Path of the Explorer window, parsed it to remove the Address: prefix, and 'et voila', working
.
BTW, I've compiled the script into a .exe, and it works both compiled for x86 (32 bit Unicode) or x64 (64 bit Unicode). I think the Unicode compilation is required for current Windows versions, to enable it working for *any* Language-locale. Doesn't need to be Run As Administrator (though I still have UAC enabled).
This is my current script: (Didn't do any nice indenting or comments
, only added the current path to the "File Name" first line of the list)
{
#y::
Gui, Add, ListView, r10 NoSort vChosenName h300 w400
, File Name
(Path: %DesPath%) For A,B in {1:"Instrucciones.txt",2:"Instalar en mv.txt", 3:"Es mal portable. Instalar como no portable.txt", 4:"Instalado como portable.txt", 5:"Instalar cuando se pueda.txt", 6:"ReciboLLamadaAlas.proponer fecha hora.txt", 7:"Ver pantallazos.proponer fecha hora.txt", 8:"Ver grabaciones de la fecha.proponer fecha sistema.txt", 9:"password pegado del portapapeles.txt", 10:"Avira detecta virus. en parte a especificar.txt", 11:"File11.txt", 12:"Es un juego.txt", 13:"Es para entorno MAC Apple.txt", 14:"Tambien tienen versiones de pago.txt", 15:"No es buen portable.Instalado como portable.txt",16:"No funcione en xp. es para w7 o sup.txt", 17:"Nuevo Notepad++ Document.txt",18:"Script AutoIt.au3",19:"Script Autohotkey.ahk", 20:"es un trial de prueba.txt", 21:"ae.fecha.txt",22:"File22.txt", 23:"File23.txt", 24:"File24.txt",25:"File25.txt",26:"File26.txt"}
Gui, Show, h340 w420
, Choose File Name
Return
}
Choose:
ControlGet, List
, List
, Selected
, SysListView321
, ahk_id
%HWND% {
}
Return