Jump to content

Use listboxes to execute programs


Recommended Posts

hello guys,

I got a question since I'm a bit new to autoit. I just want to know how to do it.

I want to create a program using autoit with listboxes. I select the items I want in the left field, click on the arrow to put it on the right field and then click on a button called execute so "all" the programs in my list will execute. How can I do this ?I got a sample code that i started so you all know what i mean.

any help would be appreciated

;This programm execute a programm from the listbox programm
; depending of the type of the programm different type of run is done
; the programm tyep can be .
; VBS , EXeEand REG
; the list of the programm is from a text file call listprog.txt
;the order of the fields is
; programm number, Type, Name, OS,Language,desctiption separate with coma
; 100.00,NumLock.reg,reg,WindowsXp,Francais,This programm activate numlock at startup
;101.00,screensaver.exe,Exe,Windows7,English,This programm change the scrensaver
;102.00,wallpaper.vbs,VBS,All,All,This programm change the wallpaper
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$FormList = GUICreate("List programm", 561, 372, 665, 206)
$ListProg = GUICtrlCreateList("", 8, 8, 233, 279)
GUICtrlSetData(-1, "Item1|Item2|Item3|Item4|Item5")
$Btnto = GUICtrlCreateButton(">", 268, 15, 30, 25)
$BtnAllto = GUICtrlCreateButton(">>", 268, 48, 31, 25)
$BtnRemove = GUICtrlCreateButton("<", 269, 81, 31, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$BtnRemoveAll = GUICtrlCreateButton("<<", 269, 114, 32, 25)
$ListBoxToExecute = GUICtrlCreateList("", 312, 8, 233, 279)
$BtnExecute = GUICtrlCreateButton("&Execute", 200, 345, 75, 25)
$BtnCancel = GUICtrlCreateButton("&Cancel", 280, 345, 75, 25)
$LblName = GUICtrlCreateLabel("LblName", 152, 304, 46, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblNoProg = GUICtrlCreateLabel("LblNoProg", 8, 304, 54, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblDescription = GUICtrlCreateLabel("LblDescription", 232, 304, 71, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblType = GUICtrlCreateLabel("LblType", 72, 304, 42, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblOs = GUICtrlCreateLabel("LblOs", 344, 304, 31, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblLangage = GUICtrlCreateLabel("LblLangage", 408, 304, 60, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
$Type = ""
$dir = "c:\prog"
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $BtnCancel
   Exit
  Case $BtnExecute
   GUICtrlSetState($LblNoProg, $GUI_SHOW)
   GUICtrlSetState($LblType, $GUI_SHOW)
   GUICtrlSetState($LblName, $GUI_SHOW)
   GUICtrlSetState($LblDescription, $GUI_SHOW)
   GUICtrlSetState($LblOs, $GUI_SHOW)
   GUICtrlSetState($LblLangage, $GUI_SHOW)
   If $Type = "reg" Then
    $cmd = $dir & "\NumLock.reg"
    If FileExists($cmd) Then
     RunWait("REGEDIT /S " & $dir & "\clavierFRCwin7.reg")
    Else
     MsgBox(16, "File error", $cmd & " File not found ")
    EndIf
   Else
    If $Type = "VBS" Then
     $cmd = $dir & '\setwallpaper.vbs'
     If FileExists($cmd) Then
      RunWait('cscript "' & $cmd & '"', $dir, @SW_HIDE)
     Else
      MsgBox(16, "File error", $cmd & " File not found ")
     EndIf
    Else
     If $Type = "exe" Then
      $cmd = "\screensaver.exe"
      If FileExists($cmd) Then
       RunWait($cmd)
      Else
       MsgBox(16, "File error", $cmd & " File not found ")
      EndIf
     EndIf
    EndIf
   EndIf
EndSwitch
WEnd
Link to comment
Share on other sites

I think this can help you.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$FormList = GUICreate("List programm", 561, 372, 665, 206)
$ListProg = GUICtrlCreateList("", 8, 8, 233, 279)
GUICtrlSetData(-1, "Item1|Item2|Item3|Item4|Item5")
$Btnto = GUICtrlCreateButton(">", 268, 15, 30, 25)
$BtnAllto = GUICtrlCreateButton(">>", 268, 48, 31, 25)
$BtnRemove = GUICtrlCreateButton("<", 269, 81, 31, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$BtnRemoveAll = GUICtrlCreateButton("<<", 269, 114, 32, 25)
$ListBoxToExecute = GUICtrlCreateList("", 312, 8, 233, 279)
$BtnExecute = GUICtrlCreateButton("&Execute", 200, 345, 75, 25)
$BtnCancel = GUICtrlCreateButton("&Cancel", 280, 345, 75, 25)
$LblName = GUICtrlCreateLabel("LblName", 152, 304, 46, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblNoProg = GUICtrlCreateLabel("LblNoProg", 8, 304, 54, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblDescription = GUICtrlCreateLabel("LblDescription", 232, 304, 71, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblType = GUICtrlCreateLabel("LblType", 72, 304, 42, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblOs = GUICtrlCreateLabel("LblOs", 344, 304, 31, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblLangage = GUICtrlCreateLabel("LblLangage", 408, 304, 60, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
$Type = ""
$dir = "c:prog"
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $BtnCancel
   Exit
   case $Btnto
    $read = GUICtrlRead($ListProg)
    GUICtrlSetData($ListBoxToExecute, $read)
    GUICtrlSetState($BtnRemove, $GUI_ENABLE)
   Case $BtnRemoveAll
    GUICtrlSetData($ListBoxToExecute, "")
  Case $BtnExecute
 $read4 = GUICtrlRead($ListBoxToExecute)
 ;here u can put ur action. MsgBox is an example.
   MsgBox(0, "Your action", "hi i am ur action")
   GUICtrlSetState($LblNoProg, $GUI_SHOW)
   GUICtrlSetState($LblType, $GUI_SHOW)
   GUICtrlSetState($LblName, $GUI_SHOW)
   GUICtrlSetState($LblDescription, $GUI_SHOW)
   GUICtrlSetState($LblOs, $GUI_SHOW)
   GUICtrlSetState($LblLangage, $GUI_SHOW)
   If $Type = "reg" Then
    $cmd = $dir & "NumLock.reg"
    If FileExists($cmd) Then
     RunWait("REGEDIT /S " & $dir & "clavierFRCwin7.reg")
    Else
     MsgBox(16, "File error", $cmd & " File not found ")
    EndIf
   Else
    If $Type = "VBS" Then
     $cmd = $dir & 'setwallpaper.vbs'
     If FileExists($cmd) Then
      RunWait('cscript "' & $cmd & '"', $dir, @SW_HIDE)
     Else
      MsgBox(16, "File error", $cmd & " File not found ")
     EndIf
    Else
     If $Type = "exe" Then
      $cmd = "screensaver.exe"
      If FileExists($cmd) Then
       RunWait($cmd)
      Else
       MsgBox(16, "File error", $cmd & " File not found ")
      EndIf
     EndIf
    EndIf
   EndIf
EndSwitch
WEnd

I also did the $BtnRemoveAll :)

I feel nothing.It feels great.

Link to comment
Share on other sites

Thanks for your Help.

But I want to know how to fill the listbox1 form a text files and then execute the correct code.

the list of the programm is from a text file call listprog.txt

the order of the fields is

programm number, Type, Name, OS,Language,description,path separate with coma

100.00,NumLock.reg,reg,WindowsXp,Francais,This programm activate numlock at startup,c:\prog

;101.00,screensaver.exe,Exe,Windows7,English,This programm change the scrensaver,c:\prog

;102.00,wallpaper.vbs,VBS,All,All,This programm change the wallpaper, c:\regfile

regards

Link to comment
Share on other sites

Try this one.

Generates the 1st list bot with all kinds.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$FormList = GUICreate("List programm", 561, 400, 665, 206)
$ListProg = GUICtrlCreateList("", 8, 8, 233, 279)
GUICtrlSetData(-1, "")
$Btnto = GUICtrlCreateButton(">", 268, 15, 30, 25)
$BtnAllto = GUICtrlCreateButton(">>", 268, 48, 31, 25)
$BtnRemove = GUICtrlCreateButton("<", 269, 81, 31, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$BtnRemoveAll = GUICtrlCreateButton("<<", 269, 114, 32, 25)
$ListBoxToExecute = GUICtrlCreateList("", 312, 8, 233, 279)
$BtnExecute = GUICtrlCreateButton("&Execute", 200, 345, 75, 25)
$BtnCancel = GUICtrlCreateButton("&Cancel", 280, 345, 75, 25)
$LblName = GUICtrlCreateLabel("LblName", 152, 304, 46, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblNoProg = GUICtrlCreateLabel("LblNoProg", 8, 304, 54, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblDescription = GUICtrlCreateLabel("LblDescription", 232, 304, 71, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblType = GUICtrlCreateLabel("LblType", 72, 304, 42, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblOs = GUICtrlCreateLabel("LblOs", 344, 304, 31, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblLangage = GUICtrlCreateLabel("LblLangage", 408, 304, 60, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$filemenu = GUICtrlCreateMenu("&File")
$fileitem = GUICtrlCreateMenuItem("Open", $filemenu)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
$Type = ""
$dir = "c:prog"
While 1
$nMsg = GUIGetMsg()
If $nMsg = $fileitem Then
   $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
   GUICtrlSetData($ListProg, $file)
   EndIf
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $BtnCancel
   Exit
   case $Btnto
    $read = GUICtrlRead($ListProg)
    GUICtrlSetData($ListBoxToExecute, $read)
    GUICtrlSetState($BtnRemove, $GUI_ENABLE)
   Case $BtnRemoveAll
    GUICtrlSetData($ListBoxToExecute, "")
  Case $BtnExecute
$read4 = GUICtrlRead($ListBoxToExecute)
;here u can put ur action. MsgBox is an example.
   MsgBox(0, "Your action", "hi i am ur action")
   GUICtrlSetState($LblNoProg, $GUI_SHOW)
   GUICtrlSetState($LblType, $GUI_SHOW)
   GUICtrlSetState($LblName, $GUI_SHOW)
   GUICtrlSetState($LblDescription, $GUI_SHOW)
   GUICtrlSetState($LblOs, $GUI_SHOW)
   GUICtrlSetState($LblLangage, $GUI_SHOW)
   If $Type = "reg" Then
    $cmd = $dir & "NumLock.reg"
    If FileExists($cmd) Then
     RunWait("REGEDIT /S " & $dir & "clavierFRCwin7.reg")
    Else
     MsgBox(16, "File error", $cmd & " File not found ")
    EndIf
   Else
    If $Type = "VBS" Then
     $cmd = $dir & 'setwallpaper.vbs'
     If FileExists($cmd) Then
      RunWait('cscript "' & $cmd & '"', $dir, @SW_HIDE)
     Else
      MsgBox(16, "File error", $cmd & " File not found ")
     EndIf
    Else
     If $Type = "exe" Then
      $cmd = "screensaver.exe"
      If FileExists($cmd) Then
       RunWait($cmd)
      Else
       MsgBox(16, "File error", $cmd & " File not found ")
      EndIf
     EndIf
    EndIf
   EndIf
EndSwitch
WEnd

Is this what ur trying to do???

Edited by ileandros

I feel nothing.It feels great.

Link to comment
Share on other sites

Here's an example that might be close to what you're looking for, it's not 100% complete and there might be issues with it, but this should get you started in the right direction.

;This programm execute a programm from the listbox programm
; depending of the type of the programm different type of run is done
; the programm tyep can be .
; VBS , EXeEand REG
; the list of the programm is from a text file call listprog.txt
;the order of the fields is
; programm number, Type, Name, OS,Language,desctiption separate with coma
; 100.00,NumLock.reg,reg,WindowsXp,Francais,This programm activate numlock at startup
;101.00,screensaver.exe,Exe,Windows7,English,This programm change the scrensaver
;102.00,wallpaper.vbs,VBS,All,All,This programm change the wallpaper
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
Global $ProgList = "Item1|Item2|Item3|Item4|Item5|", $ProgList1 = $ProgList, $ExecuteList, $ExecuteList1
$FormList = GUICreate("List programm", 561, 372, 665, 206)
$ListProg = GUICtrlCreateList("", 8, 8, 233, 279)
GUICtrlSetData(-1, $ProgList)
$Btnto = GUICtrlCreateButton(">", 268, 15, 30, 25)
$BtnAllto = GUICtrlCreateButton(">>", 268, 48, 31, 25)
$BtnRemove = GUICtrlCreateButton("<", 269, 81, 31, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$BtnRemoveAll = GUICtrlCreateButton("<<", 269, 114, 32, 25)
$ListBoxToExecute = GUICtrlCreateList("", 312, 8, 233, 279)
$BtnExecute = GUICtrlCreateButton("&Execute", 200, 345, 75, 25)
$BtnCancel = GUICtrlCreateButton("&Cancel", 280, 345, 75, 25)
$LblName = GUICtrlCreateLabel("LblName", 152, 304, 46, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblNoProg = GUICtrlCreateLabel("LblNoProg", 8, 304, 54, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblDescription = GUICtrlCreateLabel("LblDescription", 232, 304, 71, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblType = GUICtrlCreateLabel("LblType", 72, 304, 42, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblOs = GUICtrlCreateLabel("LblOs", 344, 304, 31, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblLangage = GUICtrlCreateLabel("LblLangage", 408, 304, 60, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
$Type = ""
$dir = "c:prog"
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Btnto
            GUICtrlSetState($BtnRemove, $GUI_ENABLE)
            $ExecuteList &= GUICtrlRead($ListProg) & "|"
            GUICtrlSetData($ListBoxToExecute, "|" & $ExecuteList)
            $ProgList = StringReplace($ProgList, GUICtrlRead($ListProg )  & "|", "")
            GUICtrlSetData($ListProg, "|" & $ProgList)
        Case $BtnAllto
            $ExecuteList = $ProgList1
            GUICtrlSetState($BtnRemove, $GUI_ENABLE)
            GUICtrlSetData($ListBoxToExecute, "|" & $ExecuteList)
            GUICtrlSetData($ListProg, "")
            $ProgList = ""
;~          $ProgList = $ProgList1
        Case $BtnRemove
            GUICtrlSetData($ListProg, GUICtrlRead($ListBoxToExecute) & "|")
            $ProgList &= GUICtrlRead($ListBoxToExecute) & "|"
            $ExecuteList = StringReplace($ExecuteList, GUICtrlRead($ListBoxToExecute )  & "|", "")
            ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $ExecuteList = ' & $ExecuteList & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
            GUICtrlSetData($ListProg, "|" & $ProgList)
            GUICtrlSetData($ListBoxToExecute, "|" & $ExecuteList)
        Case $BtnRemoveAll
            $ProgList = $ProgList1
            GUICtrlSetState($BtnRemove, $GUI_DISABLE)
            GUICtrlSetData($ListProg, "|" & $ProgList)
            GUICtrlSetData($ListBoxToExecute, "")
            $ExecuteList = ""
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BtnCancel
            Exit
        Case $BtnExecute
            GUICtrlSetState($LblNoProg, $GUI_SHOW)
            GUICtrlSetState($LblType, $GUI_SHOW)
            GUICtrlSetState($LblName, $GUI_SHOW)
            GUICtrlSetState($LblDescription, $GUI_SHOW)
            GUICtrlSetState($LblOs, $GUI_SHOW)
            GUICtrlSetState($LblLangage, $GUI_SHOW)
            If $Type = "reg" Then
                $cmd = $dir & "NumLock.reg"
                If FileExists($cmd) Then
                    RunWait("REGEDIT /S " & $dir & "clavierFRCwin7.reg")
                Else
                    MsgBox(16, "File error", $cmd & " File not found ")
                EndIf
            Else
                If $Type = "VBS" Then
                    $cmd = $dir & 'setwallpaper.vbs'
                    If FileExists($cmd) Then
                        RunWait('cscript "' & $cmd & '"', $dir, @SW_HIDE)
                    Else
                        MsgBox(16, "File error", $cmd & " File not found ")
                    EndIf
                Else
                    If $Type = "exe" Then
                        $cmd = "screensaver.exe"
                        If FileExists($cmd) Then
                            RunWait($cmd)
                        Else
                            MsgBox(16, "File error", $cmd & " File not found ")
                        EndIf
                    EndIf
                EndIf
            EndIf
    EndSwitch
WEnd

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

What do you want to show in the listbox? The whole line, or just part of it? I'm not sure what it is you're looking for.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Here's how you'd read it from a text file called listprog.txt that's located in the same folder as the script is located (@ScriptDir)

;This programm execute a programm from the listbox programm
; depending of the type of the programm different type of run is done
; the programm tyep can be .
; VBS , EXeEand REG
; the list of the programm is from a text file call listprog.txt
;the order of the fields is
; programm number, Type, Name, OS,Language,desctiption separate with coma
; 100.00,NumLock.reg,reg,WindowsXp,Francais,This programm activate numlock at startup
;101.00,screensaver.exe,Exe,Windows7,English,This programm change the scrensaver
;102.00,wallpaper.vbs,VBS,All,All,This programm change the wallpaper
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
Global $ProgList = "", $File, $Text
$File = FileOpen(@ScriptDir & "listprog.txt")
While 1
    $Text = FileReadLine($File)
    If @error = -1 Then ExitLoop
    $ProgList &= $Text & "|"
WEnd

Global $ProgList1 = $ProgList, $ExecuteList, $ExecuteList1
$FormList = GUICreate("List programm", 561, 372, 665, 206)
$ListProg = GUICtrlCreateList("", 8, 8, 233, 279)
GUICtrlSetData(-1, $ProgList)
$Btnto = GUICtrlCreateButton(">", 268, 15, 30, 25)
$BtnAllto = GUICtrlCreateButton(">>", 268, 48, 31, 25)
$BtnRemove = GUICtrlCreateButton("<", 269, 81, 31, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$BtnRemoveAll = GUICtrlCreateButton("<<", 269, 114, 32, 25)
$ListBoxToExecute = GUICtrlCreateList("", 312, 8, 233, 279)
$BtnExecute = GUICtrlCreateButton("&Execute", 200, 345, 75, 25)
$BtnCancel = GUICtrlCreateButton("&Cancel", 280, 345, 75, 25)
$LblName = GUICtrlCreateLabel("LblName", 152, 304, 46, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblNoProg = GUICtrlCreateLabel("LblNoProg", 8, 304, 54, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblDescription = GUICtrlCreateLabel("LblDescription", 232, 304, 71, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblType = GUICtrlCreateLabel("LblType", 72, 304, 42, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblOs = GUICtrlCreateLabel("LblOs", 344, 304, 31, 17)
GUICtrlSetState(-1, $GUI_HIDE)
$LblLangage = GUICtrlCreateLabel("LblLangage", 408, 304, 60, 17)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
$Type = ""
$dir = "c:prog"
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Btnto
            GUICtrlSetState($BtnRemove, $GUI_ENABLE)
            $ExecuteList &= GUICtrlRead($ListProg) & "|"
            GUICtrlSetData($ListBoxToExecute, "|" & $ExecuteList)
            $ProgList = StringReplace($ProgList, GUICtrlRead($ListProg) & "|", "")
            GUICtrlSetData($ListProg, "|" & $ProgList)
        Case $BtnAllto
            $ExecuteList = $ProgList1
            GUICtrlSetState($BtnRemove, $GUI_ENABLE)
            GUICtrlSetData($ListBoxToExecute, "|" & $ExecuteList)
            GUICtrlSetData($ListProg, "")
            $ProgList = ""
;~          $ProgList = $ProgList1
        Case $BtnRemove
            GUICtrlSetData($ListProg, GUICtrlRead($ListBoxToExecute) & "|")
            $ProgList &= GUICtrlRead($ListBoxToExecute) & "|"
            $ExecuteList = StringReplace($ExecuteList, GUICtrlRead($ListBoxToExecute) & "|", "")
            GUICtrlSetData($ListProg, "|" & $ProgList)
            GUICtrlSetData($ListBoxToExecute, "|" & $ExecuteList)
        Case $BtnRemoveAll
            $ProgList = $ProgList1
            GUICtrlSetState($BtnRemove, $GUI_DISABLE)
            GUICtrlSetData($ListProg, "|" & $ProgList)
            GUICtrlSetData($ListBoxToExecute, "")
            $ExecuteList = ""
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BtnCancel
            Exit
        Case $BtnExecute
            GUICtrlSetState($LblNoProg, $GUI_SHOW)
            GUICtrlSetState($LblType, $GUI_SHOW)
            GUICtrlSetState($LblName, $GUI_SHOW)
            GUICtrlSetState($LblDescription, $GUI_SHOW)
            GUICtrlSetState($LblOs, $GUI_SHOW)
            GUICtrlSetState($LblLangage, $GUI_SHOW)
            If $Type = "reg" Then
                $cmd = $dir & "NumLock.reg"
                If FileExists($cmd) Then
                    RunWait("REGEDIT /S " & $dir & "clavierFRCwin7.reg")
                Else
                    MsgBox(16, "File error", $cmd & " File not found ")
                EndIf
            Else
                If $Type = "VBS" Then
                    $cmd = $dir & 'setwallpaper.vbs'
                    If FileExists($cmd) Then
                        RunWait('cscript "' & $cmd & '"', $dir, @SW_HIDE)
                    Else
                        MsgBox(16, "File error", $cmd & " File not found ")
                    EndIf
                Else
                    If $Type = "exe" Then
                        $cmd = "screensaver.exe"
                        If FileExists($cmd) Then
                            RunWait($cmd)
                        Else
                            MsgBox(16, "File error", $cmd & " File not found ")
                        EndIf
                    EndIf
                EndIf
            EndIf
    EndSwitch
WEnd

This should get you started, you can format the string returned to eliminate the path being shown, but I'll leave that up to you to figure out. Not sure what you mean by "with mouse over" but maybe GUICtrlSetToolTip is what you're looking for.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You have to do some of the work yourself, try a few things and come back if you hit a snag.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...