DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

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

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Adapt emptytxtfile.ahk to windows 8.1
« on: August 08, 2015, 12:57 AM »
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)
  #SingleInstance Force
     
    #if winactive("ahk_class CabinetWClass")
    {
      #y::
      Gui, Destroy
      WinGet, WinID, ID, A
      Gui, +LastFound
      HWND := WinExist()
      ControlGetText, DesPath, Edit1, ahk_id %WinID%
      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


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

Best Regards
Win+Y
« Last Edit: August 11, 2015, 01:32 AM by Contro »

KynloStephen66515

  • Animated Giffer in Chief
  • Honorary Member
  • Joined in 2010
  • **
  • Posts: 3,772
    • Participated in NANY Challenge Three Times
    • Cody Award
    • Coding Snacks
    • Official Forum Clown
    • Volunteers/Staff
    • Writer
    • Hardware Hacker
    • DJ Badge - DJ
    • Linux User
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #1 on: August 08, 2015, 02:32 AM »
And for those of you who don't want a headache reading the above code - here is an easier version :P

Code: (autohotkey)
#SingleInstance Force

#if winactive("ahk_class CabinetWClass")
{
  ; quito la combinación hotkey control-alt-z  ^!z:: , para poner la combinación win+y
  ; debido a que ctrl+alt+z la utilizamos junto con shift+ para volver al estado anterior
  #y::
  Gui, Destroy
  WinGet, WinID, ID, A
  Gui, +LastFound
  HWND := WinExist()
  ControlGetText, DesPath, Edit1, ahk_id %WinID%
  ; añado w400 para aumentar el ancho de la ventana
  ; perfecto lo de h300 . Me funciona bien y ya tengo la ventana más grande y preparada
  ; compara con copia (2) de Emptytxtfile.ahk para ver estado anterior.
  ; quito en la línea de abajo h300 porque obtengo error a la segunda vez.
  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
  ; añado w420 intercalado entre las comas para aumentar el ancho de la ventana opciones
  ; me comentan de poner h300 en alguna parte inicio pruebas de ponerlo al lado
  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

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #2 on: August 09, 2015, 01:42 AM »
And for those of you who don't want a headache reading the above code - here is an easier version :P

Code: (autohotkey)
#SingleInstance Force

#if winactive("ahk_class CabinetWClass")
{
  ; quito la combinación hotkey control-alt-z  ^!z:: , para poner la combinación win+y
  ; debido a que ctrl+alt+z la utilizamos junto con shift+ para volver al estado anterior
  #y::
  Gui, Destroy
  WinGet, WinID, ID, A
  Gui, +LastFound
  HWND := WinExist()
  ControlGetText, DesPath, Edit1, ahk_id %WinID%
  ; añado w400 para aumentar el ancho de la ventana
  ; perfecto lo de h300 . Me funciona bien y ya tengo la ventana más grande y preparada
  ; compara con copia (2) de Emptytxtfile.ahk para ver estado anterior.
  ; quito en la línea de abajo h300 porque obtengo error a la segunda vez.
  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
  ; añado w420 intercalado entre las comas para aumentar el ancho de la ventana opciones
  ; me comentan de poner h300 en alguna parte inicio pruebas de ponerlo al lado
  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

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

Best Regards
:-*

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #3 on: August 09, 2015, 02:19 AM »
Don't go
Is the same version ?

Happen the same
What am i doing bad ?

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,970
    • Gathering Badge
    • Participated in NANY Challenge Once
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #4 on: August 09, 2015, 09:31 AM »
Don't go
Is the same version ?

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

KynloStephen66515

  • Animated Giffer in Chief
  • Honorary Member
  • Joined in 2010
  • **
  • Posts: 3,772
    • Participated in NANY Challenge Three Times
    • Cody Award
    • Coding Snacks
    • Official Forum Clown
    • Volunteers/Staff
    • Writer
    • Hardware Hacker
    • DJ Badge - DJ
    • Linux User
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #5 on: August 09, 2015, 01:49 PM »
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

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #6 on: August 10, 2015, 11:29 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,736
    • Coding Snacks
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #7 on: August 10, 2015, 03:47 PM »
;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

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #8 on: August 10, 2015, 07:14 PM »
I am the administrator in windows 8.1

Could you please propose the new code to try ?

Best Regards Miles

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #9 on: August 10, 2015, 07:32 PM »
I am going mad  >:(
I can modify the code because the symbol # don't appear.
I have to respond :

Code
#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

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

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #11 on: August 10, 2015, 07:36 PM »
May be have I something disconfigured in windows 8 ? But i have running other ahk scripts .
I don't understand.
:-[

KynloStephen66515

  • Animated Giffer in Chief
  • Honorary Member
  • Joined in 2010
  • **
  • Posts: 3,772
    • Participated in NANY Challenge Three Times
    • Cody Award
    • Coding Snacks
    • Official Forum Clown
    • Volunteers/Staff
    • Writer
    • Hardware Hacker
    • DJ Badge - DJ
    • Linux User
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #12 on: August 10, 2015, 08:43 PM »
[code=autohotkey]
PUT YOUR CODE HERE
[/code]

Do that, have nice code.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #13 on: August 10, 2015, 09:20 PM »
Code: (autohotkey)
;where you have this
#if winactive("ahk_class CabinetWClass")
{
; try this instead
#IfWinActive ahk_class CabinetWClass
;where you end the block with '}'
;try this instead
#IfWinActive
;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,736
    • Coding Snacks
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #14 on: August 10, 2015, 09:21 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, 09:27 PM by MilesAhead »

KynloStephen66515

  • Animated Giffer in Chief
  • Honorary Member
  • Joined in 2010
  • **
  • Posts: 3,772
    • Participated in NANY Challenge Three Times
    • Cody Award
    • Coding Snacks
    • Official Forum Clown
    • Volunteers/Staff
    • Writer
    • Hardware Hacker
    • DJ Badge - DJ
    • Linux User
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #15 on: August 10, 2015, 09:29 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,736
    • Coding Snacks
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #16 on: August 10, 2015, 09:31 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: 11,970
    • Gathering Badge
    • Participated in NANY Challenge Once
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #17 on: August 10, 2015, 10:21 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

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #18 on: August 11, 2015, 01:00 AM »
[code=autohotkey]
PUT YOUR CODE HERE
[/code]

Do that, have nice code.

Running to try. It's easy
:-*

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #19 on: August 11, 2015, 01:34 AM »
@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

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #20 on: August 11, 2015, 02:11 AM »
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

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #21 on: August 11, 2015, 02:21 AM »
I try follow your instructions Miles

Code: (Autohotkey)
    #SingleInstance Force
     
   ; #if winactive("ahk_class CabinetWClass")
   ; {
; quito las dos líneas de arriba por miles ahead y pongo 
	#IfWinActive ahk_class CabinetWClass
      ; quito la combinación hotkey control-alt-z  ^!z:: , para poner la combinación win+y
      ; debido a que ctrl+alt+z la utilizamos junto con shift+ para volver al estado anterior
      #y::
      Gui, Destroy
      WinGet, WinID, ID, A
      Gui, +LastFound
      HWND := WinExist()
      ControlGetText, DesPath, Edit1, ahk_id %WinID%
      ; añado w400 para aumentar el ancho de la ventana
      ; perfecto lo de h300 . Me funciona bien y ya tengo la ventana más grande y preparada
      ; compara con copia (2) de Emptytxtfile.ahk para ver estado anterior.
      ; quito en la línea de abajo h300 porque obtengo error a la segunda vez.
      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
      ; añado w420 intercalado entre las comas para aumentar el ancho de la ventana opciones
      ; me comentan de poner h300 en alguna parte inicio pruebas de ponerlo al lado
      Gui, Show, h340 w420, Choose File Name
      Return
    ; }  , quito por instrucción Miles Ahead
	#IfWinActive     
    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

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #22 on: August 11, 2015, 02:22 AM »
Don't go Miles.
The file is not well submitted and I don't get the new file or files in the folder.

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #23 on: August 11, 2015, 10:13 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: 11,970
    • Gathering Badge
    • Participated in NANY Challenge Once
Re: Adapt emptytxtfile.ahk to windows 8.1
« Reply #24 on: August 11, 2015, 10:48 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

Original address: https://www.donationcoder.com/forum/index.php?topic=41406.0