Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • December 07, 2016, 07:59:53 PM
  • Proudly celebrating 10 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

Last post Author Topic: Adapt emptytxtfile.ahk to windows 8.1  (Read 7615 times)

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Adapt emptytxtfile.ahk to windows 8.1
« on: August 07, 2015, 07:57:25 PM »
I don't know why don't go now.
Work wonderfully under w7
Sure I have misunderstanding something .

The code i am trying is :
Code: Autohotkey [Select]
  1.      
  2.     #if winactive("ahk_class CabinetWClass")
  3.     {
  4.       #y::
  5.       Gui, Destroy
  6.       WinGet, WinID, ID, A
  7.       Gui, +LastFound
  8.       HWND := WinExist()
  9.       ControlGetText, DesPath, Edit1, ahk_id %WinID%
  10.       Gui, Add, ListView, r10 NoSort vChosenName h300 w400, File Name
  11.          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"}
  12.         LV_Add("",B)
  13.         Gui, Add, Button, gChoose, Submit
  14.       Gui, Show, h340 w420, Choose File Name
  15.       Return
  16.     }
  17.      
  18.     Choose:
  19.    ControlGet, List, List, Selected, SysListView321, ahk_id %HWND%
  20.     Gui, Destroy
  21.     Loop, Parse, List, `n
  22.     {
  23.        If !FileExist(DesPath "\" A_LoopField)
  24.           FileAppend,, %DesPath%\%A_LoopField%
  25.     }
  26.     Return


Launch well the selection windows but finally the files are not created.

Best Regards
Win+Y
« Last Edit: August 10, 2015, 08:32:24 PM by Contro »

Stephen66515

  • Animated Giffer in Chief
  • Honorary Member
  • Joined in 2010
  • **
  • Posts: 3,129
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #1 on: August 07, 2015, 09:32:48 PM »
And for those of you who don't want a headache reading the above code - here is an easier version :P

Code: Autohotkey [Select]
  1.  
  2. #if winactive("ahk_class CabinetWClass")
  3. {
  4.   ; quito la combinación hotkey control-alt-z  ^!z:: , para poner la combinación win+y
  5.   ; debido a que ctrl+alt+z la utilizamos junto con shift+ para volver al estado anterior
  6.   #y::
  7.   WinGet, WinID, ID, A
  8.   Gui, +LastFound
  9.   HWND := WinExist()
  10.   ControlGetText, DesPath, Edit1, ahk_id %WinID%
  11.   ; añado w400 para aumentar el ancho de la ventana
  12.   ; perfecto lo de h300 . Me funciona bien y ya tengo la ventana más grande y preparada
  13.   ; compara con copia (2) de Emptytxtfile.ahk para ver estado anterior.
  14.   ; quito en la línea de abajo h300 porque obtengo error a la segunda vez.
  15.   Gui, Add, ListView, r10 NoSort vChosenName h300 w400, File Name
  16.      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"}
  17.     LV_Add("",B)
  18.     Gui, Add, Button, gChoose, Submit
  19.   ; añado w420 intercalado entre las comas para aumentar el ancho de la ventana opciones
  20.   ; me comentan de poner h300 en alguna parte inicio pruebas de ponerlo al lado
  21.   Gui, Show, h340 w420, Choose File Name
  22.   Return
  23. }
  24.  
  25. Choose:
  26. ControlGet, List, List, Selected, SysListView321, ahk_id %HWND%
  27. Loop, Parse, List, `n
  28. {
  29.    If !FileExist(DesPath "\" A_LoopField)
  30.       FileAppend,, %DesPath%\%A_LoopField%
  31. }
  32. Return

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #2 on: August 08, 2015, 08:42:53 PM »
And for those of you who don't want a headache reading the above code - here is an easier version :P

Code: Autohotkey [Select]
  1.  
  2. #if winactive("ahk_class CabinetWClass")
  3. {
  4.   ; quito la combinación hotkey control-alt-z  ^!z:: , para poner la combinación win+y
  5.   ; debido a que ctrl+alt+z la utilizamos junto con shift+ para volver al estado anterior
  6.   #y::
  7.   WinGet, WinID, ID, A
  8.   Gui, +LastFound
  9.   HWND := WinExist()
  10.   ControlGetText, DesPath, Edit1, ahk_id %WinID%
  11.   ; añado w400 para aumentar el ancho de la ventana
  12.   ; perfecto lo de h300 . Me funciona bien y ya tengo la ventana más grande y preparada
  13.   ; compara con copia (2) de Emptytxtfile.ahk para ver estado anterior.
  14.   ; quito en la línea de abajo h300 porque obtengo error a la segunda vez.
  15.   Gui, Add, ListView, r10 NoSort vChosenName h300 w400, File Name
  16.      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"}
  17.     LV_Add("",B)
  18.     Gui, Add, Button, gChoose, Submit
  19.   ; añado w420 intercalado entre las comas para aumentar el ancho de la ventana opciones
  20.   ; me comentan de poner h300 en alguna parte inicio pruebas de ponerlo al lado
  21.   Gui, Show, h340 w420, Choose File Name
  22.   Return
  23. }
  24.  
  25. Choose:
  26. ControlGet, List, List, Selected, SysListView321, ahk_id %HWND%
  27. Loop, Parse, List, `n
  28. {
  29.    If !FileExist(DesPath "\" A_LoopField)
  30.       FileAppend,, %DesPath%\%A_LoopField%
  31. }
  32. Return

Owwww. Running to try !!!!!!!!

Best Regards
 :-*

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #3 on: August 08, 2015, 09:19:03 PM »
Don't go
Is the same version ?

Happen the same
What am i doing bad ?

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 10,328
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #4 on: August 09, 2015, 04:31:27 AM »
Don't go
Is the same version ?

Yes - he just wanted to make it easier to read
Tom

Stephen66515

  • Animated Giffer in Chief
  • Honorary Member
  • Joined in 2010
  • **
  • Posts: 3,129
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #5 on: August 09, 2015, 08:49:54 AM »
Don't go
Is the same version ?

Yes - he just wanted to make it easier to read

Ah yeah, sorry, I was just making it easier for people to read it :)

En Español
Esa es la misma versión. Simplemente me hizo más fácil para la gente a leer


Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #6 on: August 10, 2015, 06:29:38 AM »
 ;D

Yeap. Now is easier to read.
Can i have now a really executable script under windows 8 ?

What i really don't understand is why goes well under 7 and not under 8 ?

What's the difference ?

 :-\

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,286
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #7 on: August 10, 2015, 10:47:59 AM »
;D

Yeap. Now is easier to read.
Can i have now a really executable script under windows 8 ?

What i really don't understand is why goes well under 7 and not under 8 ?

What's the difference ?

 :-\

In AHK generally I find #IfWinActive ahk_class classname
more reliabe than
#If   (some condition)

Also on W8.x try running it As Administrator.

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #8 on: August 10, 2015, 02:14:03 PM »
I am the administrator in windows 8.1

Could you please propose the new code to try ?

Best Regards Miles

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #9 on: August 10, 2015, 02:32:43 PM »
I am going mad  >:(
I can modify the code because the symbol # don't appear.
I have to respond :

#SingleInstance Force

#if winactive("ahk_class CabinetWClass")
{
  #y::
  Gui, Destroy
  WinGet, WinID, ID, A
  Gui, +LastFound
  HWND := WinExist()
if (class="CabinetWClass" or class="ExploreWClass" or class="Progman")
for window in ComObjCreate("Shell.Application").Windows
DesPath:=window.LocationURL
StringReplace, DesPath, DesPath, file:///
StringReplace, DesPath, DesPath, /, \, all
 Gui, Add, ListView, r10 NoSort vChosenName h300 w400, File Name
     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"}
    LV_Add("",B)
    Gui, Add, Button, gChoose, Submit
  Gui, Show, h340 w420, Choose File Name
  Return
}

Choose:
ControlGet, List, List, Selected, SysListView321, ahk_id %HWND%
Gui, Destroy
Loop, Parse, List, `n
{
   If !FileExist(DesPath "\" A_LoopField)
      FileAppend,, %DesPath%\%A_LoopField%
}
Return

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #10 on: August 10, 2015, 02:34:07 PM »
Why i can't put nice codes like others ?
 >:( :tellme:

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #11 on: August 10, 2015, 02:36:20 PM »
May be have I something disconfigured in windows 8 ? But i have running other ahk scripts .
I don't understand.
 :-[

Stephen66515

  • Animated Giffer in Chief
  • Honorary Member
  • Joined in 2010
  • **
  • Posts: 3,129
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #12 on: August 10, 2015, 03:43:35 PM »
[code=autohotkey]
PUT YOUR CODE HERE
[/code]


Do that, have nice code.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,286
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #13 on: August 10, 2015, 04:20:09 PM »
Code: Autohotkey [Select]
  1. ;where you have this
  2. #if winactive("ahk_class CabinetWClass")
  3. {
  4. ; try this instead
  5. #IfWinActive ahk_class CabinetWClass
  6. ;where you end the block with '}'
  7. ;try this instead
  8. ;with nothing after resets it to hotkeys always on in lines that follow

I don't know if it will work.  It is just a guess.  I am not sure what your script does.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,286
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #14 on: August 10, 2015, 04:21:14 PM »
@Stephen
Thanks for posting that about the code tag.  I didn't realize syntax highlight would work that easily.  :up:
« Last Edit: August 10, 2015, 04:27:34 PM by MilesAhead »

Stephen66515

  • Animated Giffer in Chief
  • Honorary Member
  • Joined in 2010
  • **
  • Posts: 3,129
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #15 on: August 10, 2015, 04:29:08 PM »
@Stephen
Thanks for posting that about the code tag.  I didn't realize syntax highlight would work that easily.  :up:

No worries :) - It works for all the code in the dropdown list on the full reply window - same as all other tags, just drop in whatever you want between the tags, and let the forum do the rest :)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,286
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #16 on: August 10, 2015, 04:31:27 PM »
@Stephen
Thanks for posting that about the code tag.  I didn't realize syntax highlight would work that easily.  :up:

No worries :) - It works for all the code in the dropdown list on the full reply window - same as all other tags, just drop in whatever you want between the tags, and let the forum do the rest :)

I guess I need to learn to "cheat" and do things the easy way for once.  :)

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 10,328
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #17 on: August 10, 2015, 05:21:51 PM »
I am the administrator in windows 8.1

try it anyway - cant hurt! (I think e.g. UAC can still limit software)
Tom

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #18 on: August 10, 2015, 08:00:17 PM »
[code=autohotkey]
PUT YOUR CODE HERE
[/code]


Do that, have nice code.

Running to try. It's easy
 :-*

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #19 on: August 10, 2015, 08:34:40 PM »
@Stephen
Thanks for posting that about the code tag.  I didn't realize syntax highlight would work that easily.  :up:

The target of the script is open a window with predefined names of txt files in a selected folder in windows explorer.
When submit the selected txt files in that window are created in the opened folder.
 :-[

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #20 on: August 10, 2015, 09:11:09 PM »
I am the administrator in windows 8.1

try it anyway - cant hurt! (I think e.g. UAC can still limit software)

I have disabled UAC because of my old CRM don't work well if not.

 :-*

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #21 on: August 10, 2015, 09:21:28 PM »
I try follow your instructions Miles

Code: Autohotkey [Select]
  1.      
  2.    ; #if winactive("ahk_class CabinetWClass")
  3.    ; {
  4. ; quito las dos líneas de arriba por miles ahead y pongo
  5.         #IfWinActive ahk_class CabinetWClass
  6.       ; quito la combinación hotkey control-alt-z  ^!z:: , para poner la combinación win+y
  7.       ; debido a que ctrl+alt+z la utilizamos junto con shift+ para volver al estado anterior
  8.       #y::
  9.       Gui, Destroy
  10.       WinGet, WinID, ID, A
  11.       Gui, +LastFound
  12.       HWND := WinExist()
  13.       ControlGetText, DesPath, Edit1, ahk_id %WinID%
  14.       ; añado w400 para aumentar el ancho de la ventana
  15.       ; perfecto lo de h300 . Me funciona bien y ya tengo la ventana más grande y preparada
  16.       ; compara con copia (2) de Emptytxtfile.ahk para ver estado anterior.
  17.       ; quito en la línea de abajo h300 porque obtengo error a la segunda vez.
  18.       Gui, Add, ListView, r10 NoSort vChosenName h300 w400, File Name
  19.          For A,B in {1:"Instrucciones.txt",2:"Instalar en mv.txt", 3:"Es mal portable. Instalar como no portable.txt", 4:"Instalado como
  20.  
  21. portable.txt", 5:"Instalar cuando se pueda.txt", 6:"ReciboLLamadaAlas.proponer fecha hora.txt", 7:"Ver pantallazos.proponer fecha hora.txt",
  22.  
  23. 8:"Ver grabaciones de la fecha.proponer fecha sistema.txt", 9:"password   pegado del portapapeles.txt", 10:"Avira detecta virus. en parte a
  24.  
  25. 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
  26.  
  27. 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
  28.  
  29. AutoIt.au3",19:"Script Autohotkey.ahk", 20:"es un trial de prueba.txt", 21:"ae.fecha.txt",22:"File22.txt", 23:"File23.txt",
  30.  
  31. 24:"File24.txt",25:"File25.txt",26:"File26.txt"}
  32.         LV_Add("",B)
  33.         Gui, Add, Button, gChoose, Submit
  34.       ; añado w420 intercalado entre las comas para aumentar el ancho de la ventana opciones
  35.       ; me comentan de poner h300 en alguna parte inicio pruebas de ponerlo al lado
  36.       Gui, Show, h340 w420, Choose File Name
  37.       Return
  38.     ; }  , quito por instrucción Miles Ahead
  39.         #IfWinActive    
  40.     Choose:
  41.    ControlGet, List, List, Selected, SysListView321, ahk_id %HWND%
  42.     Gui, Destroy
  43.     Loop, Parse, List, `n
  44.     {
  45.        If !FileExist(DesPath "\" A_LoopField)
  46.           FileAppend,, %DesPath%\%A_LoopField%
  47.     }
  48.     Return

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #22 on: August 10, 2015, 09:22:38 PM »
Don't go Miles.
The file is not well submitted and I don't get the new file or files in the folder.

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #23 on: August 11, 2015, 05:13:03 AM »
It's a really strange thing .
Goes well in windows 7 and now....
As tomos said :
try it anyway - cant hurt! (I think e.g. UAC can still limit software)
under windows 7 i also deshabilitated the UAC feature.
 :-[

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 10,328
    • View Profile
    • Donate to Member
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #24 on: August 11, 2015, 05:48:23 AM »
It's a really strange thing .
Goes well in windows 7 and now....
As tomos said :
try it anyway - cant hurt! (I think e.g. UAC can still limit software)
under windows 7 i also deshabilitated the UAC feature.
 :-[

I dont understand - [1] did you try it in 8 ? (right-click, run as admin)
[2] Did it work?


EDIT// win 7 & win 8 work differently - that is why it's good to try ;-)
Tom