Sign in to follow this  
Followers 0
Generator

Ini Problem

16 posts in this topic

#1 ·  Posted (edited)

Since i made this simple gui launcher, i wanted to use ini to store information else it's completely useless.

So i attmpted this way, but it doesn't seem to work, any idea?

P.S: Problem with array i suppose

#NoTrayIcon
#include<GUIConstants.au3>
#include<Math.au3>
#include<File.au3>
Opt("GUIOnEventMode",1)
Opt("GUICloseOnEsc", 0)
Opt("GUIResizeMode", 802)

Global $Run[256],$Browse[256], $Counter=0, $WidthPos1=-195, $HeightPos1=1,$WidthPos2=-100, $HeightPos2=2, $Dir[256], $Execute[256],$GUIPos[4]
Global $FileName="Setting.ini"

_IniCheck()

$mainfrm=GUICreate("GUI Launcher",$GUIPos[0],$GUIPos[1],$GUIPos[2],$GUIPos[3])
$filemenu=GUICtrlCreateMenu("File")
$fileexit=GUICtrlCreateMenuItem("Exit",$filemenu)
$createmenu=GUICtrlCreateMenu("Create")
$createitem=GUICtrlCreateMenuItem("Add Button",$createmenu)
GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
GUICtrlSetOnEvent($fileexit,"_Exit")
GUICtrlSetOnEvent($createitem,"_CreateButton")
GUISetFont(9,400,0,"Tahoma")
GUISetState()
While 1
    Sleep(1)
WEnd
Func _Exit()
    Local $WinPos=WinGetPos($mainfrm)
    IniWriteSection($FileName,"GUIPos","ValueX="&$WinPos[0]&@LF&"ValueY="&$WinPos[1]&@LF&"ValueW="&$WinPos[2]&@LF&"ValueH="&$WinPos[3])
    For $i=0 to UBound($Dir,1)-1
        IniWrite($FileName,"Directory","Directory."&$i,$Dir[$i])
    Next
    Exit
EndFunc
Func _CreateButton()
    Local $WinPos=WinGetPos($mainfrm)
    $WidthPos1+=200
    $WidthPos2+=200
    $Run[$Counter]=GUICtrlCreateButton("Executable",$WidthPos1,$HeightPos1,90,30)
    GUICtrLSetOnEvent(-1,"_RunExecute")
    GUICtrlSetFont(-1,9,400,0,"Tahoma")
    $Browse[$Counter]=GUICtrlCreateButton("Browse",$WidthPos2,$HeightPos2,90,30)
    GUICtrLSetOnEvent(-1,"_BrowseDirc")
    GUICtrlSetFont(-1,9,400,0,"Tahoma")
    $Counter+=1
    If _MathCheckDiv($Counter,3)=1 Then
        If $Counter>3 Then
        Else
            WinMove($mainfrm,"",$WinPos[0],$WinPos[1],$WinPos[2]+205,$WinPos[3])
        EndIf
    Else
        $WidthPos1-=600
        $WidthPos2-=600
        $HeightPos1+=35
        $HeightPos2+=35
        WinMove($mainfrm,"",$WinPos[0],$WinPos[1],$WinPos[2],$WinPos[3]+35)
    EndIf
EndFunc
Func _RunExecute()
    Local $Id=@GUI_CtrlHandle
    For $i=0 to UBound($Run,1)-1
        If GUICtrlGetHandle($Run[$i])=$Id Then
            ShellExecute($Dir[$i])
            ExitLoop
        EndIf
    Next
EndFunc
Func _BrowseDirc()
    Local $Id=@GUI_CtrlHandle
    Local $Dirc, $String, $Display
    $Dirc=FileOpenDialog("Please Select the Exe",@DesktopDir,"All Executables (*.exe)",1+2)
    $String=StringSplit($Dirc,".")
    $String2=StringSplit($String[1],"\")
    $Display=UBound($String2,1)-1
    For $i=0 to Ubound($Browse,1)-1
        If GUICtrlGetHandle($Browse[$i])=$Id Then
            $Dir[$i]=$Dirc
            $Execute[$i]=$String2[$Display]
            GUICtrlSetData($Run[$i],$Execute[$i])
            ExitLoop
        EndIf
    Next
EndFunc
Func _IniCheck()
    If Not FileExists($FileName) Then
        _FileCreate($FileName)
        $GUIPos[0]=IniRead ($FileName,"GUIPos","ValueW",190)
        $GUIPos[1]=IniRead ($FileName,"GUIPos","ValueH",55)
        $GUIPos[2]=IniRead ($FileName,"GUIPos","ValueX",-1)
        $GUIPos[3]=IniRead ($FileName,"GUIPos","ValueY",-1)
        For $i=0 to 255
        IniWrite($FileName,"Directory","Directory."&$i,"")
        Next
    Else
        $GUIPos[0]=IniRead ($FileName,"GUIPos","ValueW",190)
        $GUIPos[1]=IniRead ($FileName,"GUIPos","ValueH",55)
        $GUIPos[2]=IniRead ($FileName,"GUIPos","ValueX",-1)
        $GUIPos[3]=IniRead ($FileName,"GUIPos","ValueY",-1)
    EndIf
EndFunc
Edited by Generator

Share this post


Link to post
Share on other sites



..and your problem is what ?

Did you select the *.exe from another directory and is the Setting.ini created there ?

Its better to change this line to :

Global $FileName = @scriptdir & "\Setting.ini"


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Actually i am surpised, it worked, the problem was the iniwrite not functioning when going into a loop with writing the saved directory, using $Dir as an array to these info.

Share this post


Link to post
Share on other sites

so does it work now?

Share this post


Link to post
Share on other sites

Actually i am surpised, it worked ..

You mean changing the line solved the problem ?

believe the FileOpenDialog() is known for changing the WOrkDir thus when the INI file is Setting.ini with the full path, it will be written to the last selected directory. THat is why I asked to check that directory ...

:)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

You mean changing the line solved the problem ?

believe the FileOpenDialog() is known for changing the WOrkDir thus when the INI file is Setting.ini with the full path, it will be written to the last selected directory. THat is why I asked to check that directory ...

:)

Yes, it worked after changing the line, now i am working on recreation of the buttons and redimming arrays

Share this post


Link to post
Share on other sites

this looks cool. its funny how changing a little line can make such a big difference!

Share this post


Link to post
Share on other sites

I've made a new attempt, but the weird thing is, it's not creating buttons, here is how i wish to do it(as in logic).

  • When you first open the program, it creates a list in ini for directory, and a counter which is refer to the variable $Counter to see how many sets of button you've created
  • After you close the program, it writes the GUIPos into the ini so next time you open it it just stays where you closed it
  • Then it reads the counter in ini, for example you have 5, then i will use for $i=0 to $Counter and recreate the buttons, but the point is it doesn't work.
Maybe can someone point out or give me a hint on how to accomplish this? :)

Here is what i did

#NoTrayIcon
#include<GUIConstants.au3>
#include<Math.au3>
#include<File.au3>
Opt("GUIOnEventMode",1)
Opt("GUICloseOnEsc", 0)
Opt("GUIResizeMode", 802)

Global $Run[256],$Browse[256], $Counter=0, $WidthPos1=-195, $HeightPos1=1,$WidthPos2=-100, $HeightPos2=2, $Dir[256], $Execute[256],$GUIPos[4]
Global $FileName = @Scriptdir & "\Setting.ini"

_IniCheck()
_BtnCreate()

$mainfrm=GUICreate("GUI Launcher",$GUIPos[0],$GUIPos[1],$GUIPos[2],$GUIPos[3])
$filemenu=GUICtrlCreateMenu("File")
$fileexit=GUICtrlCreateMenuItem("Exit",$filemenu)
$createmenu=GUICtrlCreateMenu("Create")
$createitem=GUICtrlCreateMenuItem("Add Button",$createmenu)
GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
GUICtrlSetOnEvent($fileexit,"_Exit")
GUICtrlSetOnEvent($createitem,"_CreateButton")
GUISetFont(9,400,0,"Tahoma")
GUISetState()
While 1
    Sleep(1)
WEnd
Func _Exit()
    Local $WinPos=WinGetPos($mainfrm)
    IniWriteSection($FileName,"GUIPos","ValueX="&$WinPos[0]&@LF&"ValueY="&$WinPos[1]&@LF&"ValueW="&$WinPos[2]&@LF&"ValueH="&$WinPos[3])
    IniWrite($FileName,"Counter","Counter.#",$Counter)
    For $i=0 to UBound($Dir,1)-1
        IniWrite($FileName,"Directory","Directory."&$i,$Dir[$i])
    Next
    Exit
EndFunc
Func _CreateButton()
    Local $WinPos=WinGetPos($mainfrm)
    $WidthPos1+=200
    $WidthPos2+=200
    $Run[$Counter]=GUICtrlCreateButton("Executable",$WidthPos1,$HeightPos1,90,30)
    GUICtrLSetOnEvent(-1,"_RunExecute")
    GUICtrlSetFont(-1,9,400,0,"Tahoma")
    $Browse[$Counter]=GUICtrlCreateButton("Browse",$WidthPos2,$HeightPos2,90,30)
    GUICtrLSetOnEvent(-1,"_BrowseDirc")
    GUICtrlSetFont(-1,9,400,0,"Tahoma")
    $Counter+=1
    If _MathCheckDiv($Counter,3)=1 Then
        If $Counter>3 Then
        Else
            WinMove($mainfrm,"",$WinPos[0],$WinPos[1],$WinPos[2]+205,$WinPos[3])
        EndIf
    Else
        $WidthPos1-=600
        $WidthPos2-=600
        $HeightPos1+=35
        $HeightPos2+=35
        WinMove($mainfrm,"",$WinPos[0],$WinPos[1],$WinPos[2],$WinPos[3]+35)
    EndIf
EndFunc
Func _RunExecute()
    Local $Id=@GUI_CtrlHandle
    For $i=0 to UBound($Run,1)-1
        If GUICtrlGetHandle($Run[$i])=$Id Then
            ShellExecute($Dir[$i])
            ExitLoop
        EndIf
    Next
EndFunc
Func _BrowseDirc()
    Local $Id=@GUI_CtrlHandle
    Local $Dirc, $String, $Display
    $Dirc=FileOpenDialog("Please Select the File",@DesktopDir,"All (*.*)",1+2)
    $String=StringSplit($Dirc,".")
    $String2=StringSplit($String[1],"\")
    $Display=UBound($String2,1)-1
    For $i=0 to Ubound($Browse,1)-1
        If GUICtrlGetHandle($Browse[$i])=$Id Then
            $Dir[$i]=$Dirc
            $Execute[$i]=$String2[$Display]
            GUICtrlSetData($Run[$i],$Execute[$i])
            ExitLoop
        EndIf
    Next
EndFunc
Func _IniCheck()
    If Not FileExists($FileName) Then
        _FileCreate($FileName)
        $GUIPos[0]=IniRead ($FileName,"GUIPos","ValueW",190)
        $GUIPos[1]=IniRead ($FileName,"GUIPos","ValueH",55)
        $GUIPos[2]=IniRead ($FileName,"GUIPos","ValueX",-1)
        $GUIPos[3]=IniRead ($FileName,"GUIPos","ValueY",-1)
        For $i=0 to 255
        IniWrite($FileName,"Directory","Directory."&$i,"")
        Next
        IniWrite($FileName,"Counter","Counter.#",0)
    Else
        $GUIPos[0]=IniRead ($FileName,"GUIPos","ValueW",190)
        $GUIPos[1]=IniRead ($FileName,"GUIPos","ValueH",55)
        $GUIPos[2]=IniRead ($FileName,"GUIPos","ValueX",-1)
        $GUIPos[3]=IniRead ($FileName,"GUIPos","ValueY",-1)
    EndIf
EndFunc
Func _BtnCreate()
    $Counter=IniRead($FileName,"Counter","Counter.#",0)
    For $i=0 to $Counter
        $Run[$i]=GUICtrlCreateButton("Executable",$WidthPos1,$HeightPos1,90,30)
        GUICtrLSetOnEvent(-1,"_RunExecute")
        GUICtrlSetFont(-1,9,400,0,"Tahoma")
        $Browse[$i]=GUICtrlCreateButton("Browse",$WidthPos2,$HeightPos2,90,30)
        GUICtrLSetOnEvent(-1,"_BrowseDirc")
        GUICtrlSetFont(-1,9,400,0,"Tahoma")
        If _MathCheckDiv($Counter,3)=1 Then
            
        Else
            $WidthPos1-=600
            $WidthPos2-=600
            $HeightPos1+=35
            $HeightPos2+=35
        EndIf
    Next
EndFunc

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

(!) hmm, i dont understand why it shouldnt, it look stoo confusing.. :) (!) :P:):)

Why is there a _CreateButton() func and then another function called _BtnCreate()?

Edited by JustinReno

Share this post


Link to post
Share on other sites

(!) hmm, i dont understand why it shouldnt, it look stoo confusing.. :) (!) :P:):)

Why is there a _CreateButton() func and then another function called _BtnCreate()?

_BtnCreate() is the recreation of the buttons by reading the info in ini.

Share this post


Link to post
Share on other sites

ahh, ok. i get it.

Share this post


Link to post
Share on other sites

I've made a new attempt, but the weird thing is, it's not creating buttons, here is how i wish to do it(as in logic).

  • When you first open the program, it creates a list in ini for directory, and a counter which is refer to the variable $Counter to see how many sets of button you've created
  • After you close the program, it writes the GUIPos into the ini so next time you open it it just stays where you closed it
  • Then it reads the counter in ini, for example you have 5, then i will use for $i=0 to $Counter and recreate the buttons, but the point is it doesn't work.
Maybe can someone point out or give me a hint on how to accomplish this? :)
Have you checked what the value of $Counter is after the iniread?

Can you post an example ini file to test with?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I used a msgbox to test the value of $Counter, Reading from ini was successful.

Just put all these code in a name of Setting.ini, i am not allow to upload ini as attachment

CODE

[Directory]

Directory.0=

Directory.1=

Directory.2=

Directory.3=

Directory.4=

Directory.5=

Directory.6=

Directory.7=

Directory.8=

Directory.9=

Directory.10=

Directory.11=

Directory.12=

Directory.13=

Directory.14=

Directory.15=

Directory.16=

Directory.17=

Directory.18=

Directory.19=

Directory.20=

Directory.21=

Directory.22=

Directory.23=

Directory.24=

Directory.25=

Directory.26=

Directory.27=

Directory.28=

Directory.29=

Directory.30=

Directory.31=

Directory.32=

Directory.33=

Directory.34=

Directory.35=

Directory.36=

Directory.37=

Directory.38=

Directory.39=

Directory.40=

Directory.41=

Directory.42=

Directory.43=

Directory.44=

Directory.45=

Directory.46=

Directory.47=

Directory.48=

Directory.49=

Directory.50=

Directory.51=

Directory.52=

Directory.53=

Directory.54=

Directory.55=

Directory.56=

Directory.57=

Directory.58=

Directory.59=

Directory.60=

Directory.61=

Directory.62=

Directory.63=

Directory.64=

Directory.65=

Directory.66=

Directory.67=

Directory.68=

Directory.69=

Directory.70=

Directory.71=

Directory.72=

Directory.73=

Directory.74=

Directory.75=

Directory.76=

Directory.77=

Directory.78=

Directory.79=

Directory.80=

Directory.81=

Directory.82=

Directory.83=

Directory.84=

Directory.85=

Directory.86=

Directory.87=

Directory.88=

Directory.89=

Directory.90=

Directory.91=

Directory.92=

Directory.93=

Directory.94=

Directory.95=

Directory.96=

Directory.97=

Directory.98=

Directory.99=

Directory.100=

Directory.101=

Directory.102=

Directory.103=

Directory.104=

Directory.105=

Directory.106=

Directory.107=

Directory.108=

Directory.109=

Directory.110=

Directory.111=

Directory.112=

Directory.113=

Directory.114=

Directory.115=

Directory.116=

Directory.117=

Directory.118=

Directory.119=

Directory.120=

Directory.121=

Directory.122=

Directory.123=

Directory.124=

Directory.125=

Directory.126=

Directory.127=

Directory.128=

Directory.129=

Directory.130=

Directory.131=

Directory.132=

Directory.133=

Directory.134=

Directory.135=

Directory.136=

Directory.137=

Directory.138=

Directory.139=

Directory.140=

Directory.141=

Directory.142=

Directory.143=

Directory.144=

Directory.145=

Directory.146=

Directory.147=

Directory.148=

Directory.149=

Directory.150=

Directory.151=

Directory.152=

Directory.153=

Directory.154=

Directory.155=

Directory.156=

Directory.157=

Directory.158=

Directory.159=

Directory.160=

Directory.161=

Directory.162=

Directory.163=

Directory.164=

Directory.165=

Directory.166=

Directory.167=

Directory.168=

Directory.169=

Directory.170=

Directory.171=

Directory.172=

Directory.173=

Directory.174=

Directory.175=

Directory.176=

Directory.177=

Directory.178=

Directory.179=

Directory.180=

Directory.181=

Directory.182=

Directory.183=

Directory.184=

Directory.185=

Directory.186=

Directory.187=

Directory.188=

Directory.189=

Directory.190=

Directory.191=

Directory.192=

Directory.193=

Directory.194=

Directory.195=

Directory.196=

Directory.197=

Directory.198=

Directory.199=

Directory.200=

Directory.201=

Directory.202=

Directory.203=

Directory.204=

Directory.205=

Directory.206=

Directory.207=

Directory.208=

Directory.209=

Directory.210=

Directory.211=

Directory.212=

Directory.213=

Directory.214=

Directory.215=

Directory.216=

Directory.217=

Directory.218=

Directory.219=

Directory.220=

Directory.221=

Directory.222=

Directory.223=

Directory.224=

Directory.225=

Directory.226=

Directory.227=

Directory.228=

Directory.229=

Directory.230=

Directory.231=

Directory.232=

Directory.233=

Directory.234=

Directory.235=

Directory.236=

Directory.237=

Directory.238=

Directory.239=

Directory.240=

Directory.241=

Directory.242=

Directory.243=

Directory.244=

Directory.245=

Directory.246=

Directory.247=

Directory.248=

Directory.249=

Directory.250=

Directory.251=

Directory.252=

Directory.253=

Directory.254=

Directory.255=

[Counter]

Counter.#=3

[GUIPos]

ValueX=336

ValueY=483

ValueW=606

ValueH=115

Share this post


Link to post
Share on other sites

hmm, still doesnt work..how weird. :)

Share this post


Link to post
Share on other sites

hmm, still doesnt work..how weird. :)

The code below fixes the _BtnCreate only. This should enable you to fix CreateButton

#NoTrayIcon
#include<GUIConstants.au3>
#include<Math.au3>
#include<File.au3>
Opt("GUIOnEventMode",1)
Opt("GUICloseOnEsc", 0)
Opt("GUIResizeMode", 802)

                       ;changes made oin next line
Global $run[256], $Browse[256], $Counter=0, $WidthPos1=15,$HeightPos1=1,$WidthPos2=115, $HeightPos2=1, $Dir[256], $Execute[256],$GUIPos[4]
Global $FileName = @Scriptdir & "\Setting.ini"
_IniCheck()
;_BtnCreate();can't put this here because there's no gui for it 

$mainfrm=GUICreate("GUI Launcher",$GUIPos[0],$GUIPos[1],$GUIPos[2],$GUIPos[3])
$filemenu=GUICtrlCreateMenu("File")
$fileexit=GUICtrlCreateMenuItem("Exit",$filemenu)
$createmenu=GUICtrlCreateMenu("Create")
$createitem=GUICtrlCreateMenuItem("Add Button",$createmenu)
GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
GUICtrlSetOnEvent($fileexit,"_Exit")
GUICtrlSetOnEvent($createitem,"_CreateButton")
GUISetFont(9,400,0,"Tahoma")
GUISetState()

_BtnCreate()


While 1
    Sleep(1)
WEnd
Func _Exit()
    Local $WinPos=WinGetPos($mainfrm)
    IniWriteSection($FileName,"GUIPos","ValueX="&$WinPos[0]&@LF&"ValueY="&$WinPos[1]&@LF&"ValueW="&$WinPos[2]&@LF&"ValueH="&$WinPos[3])
    IniWrite($FileName,"Counter","Counter.#",$Counter)
    For $i=0 to UBound($Dir,1)-1
        IniWrite($FileName,"Directory","Directory."&$i,$Dir[$i])
    Next
    Exit
EndFunc
Func _CreateButton()
    Local $WinPos=WinGetPos($mainfrm)
    $WidthPos1+=200
    $WidthPos2+=200
    $Run[$Counter]=GUICtrlCreateButton("Executable",$WidthPos1,$HeightPos1,90,30)
    GUICtrLSetOnEvent(-1,"_RunExecute")
    GUICtrlSetFont(-1,9,400,0,"Tahoma")
    $Browse[$Counter]=GUICtrlCreateButton("Browse",$WidthPos2,$HeightPos2,90,30)
    GUICtrLSetOnEvent(-1,"_BrowseDirc")
    GUICtrlSetFont(-1,9,400,0,"Tahoma")
    $Counter+=1
    If _MathCheckDiv($Counter,3)=2 Then
        If $Counter>3 Then
        Else
            WinMove($mainfrm,"",$WinPos[0],$WinPos[1],$WinPos[2]+205,$WinPos[3])
        EndIf
    Else
        $WidthPos1-=600
        $WidthPos2-=600
        $HeightPos1+=35
        $HeightPos2+=35
        WinMove($mainfrm,"",$WinPos[0],$WinPos[1],$WinPos[2],$WinPos[3]+35)
    EndIf
EndFunc
Func _RunExecute()
    Local $Id=@GUI_CtrlHandle
    For $i=0 to UBound($Run,1)-1
        If GUICtrlGetHandle($Run[$i])=$Id Then
            ShellExecute($Dir[$i])
            ExitLoop
        EndIf
    Next
EndFunc
Func _BrowseDirc()
    Local $Id=@GUI_CtrlHandle
    Local $Dirc, $String, $Display
    $Dirc=FileOpenDialog("Please Select the File",@DesktopDir,"All (*.*)",1+2)
    $String=StringSplit($Dirc,".")
    $String2=StringSplit($String[1],"\")
    $Display=UBound($String2,1)-1
    For $i=0 to Ubound($Browse,1)-1
        If GUICtrlGetHandle($Browse[$i])=$Id Then
            $Dir[$i]=$Dirc
            $Execute[$i]=$String2[$Display]
            GUICtrlSetData($Run[$i],$Execute[$i])
            ExitLoop
        EndIf
    Next
EndFunc
Func _IniCheck()
    If Not FileExists($FileName) Then
        _FileCreate($FileName)
        $GUIPos[0]=IniRead ($FileName,"GUIPos","ValueW",190)
        $GUIPos[1]=IniRead ($FileName,"GUIPos","ValueH",55)
        $GUIPos[2]=IniRead ($FileName,"GUIPos","ValueX",-1)
        $GUIPos[3]=IniRead ($FileName,"GUIPos","ValueY",-1)
        For $i=0 to 255
        IniWrite($FileName,"Directory","Directory."&$i,"")
        Next
        IniWrite($FileName,"Counter","Counter.#",0)
    Else
        $GUIPos[0]=IniRead ($FileName,"GUIPos","ValueW",190)
        $GUIPos[1]=IniRead ($FileName,"GUIPos","ValueH",55)
        $GUIPos[2]=IniRead ($FileName,"GUIPos","ValueX",-1)
        $GUIPos[3]=IniRead ($FileName,"GUIPos","ValueY",-1)
    EndIf
EndFunc

           ;various changes in this fn
Func _BtnCreate()
    $Counter=IniRead($FileName,"Counter","Counter.#",0)
    ConsoleWrite('counter = ' & $Counter & @CRLF)
    For $i=0 to $Counter - 1

        $Run[$i]=GUICtrlCreateButton("Executable",$WidthPos1,$HeightPos1,90,30)
        GUICtrLSetOnEvent(-1,"_RunExecute")
        GUICtrlSetFont(-1,9,400,0,"Tahoma")
        $Browse[$i]=GUICtrlCreateButton("Browse",$WidthPos2,$HeightPos2,90,30)
        GUICtrLSetOnEvent(-1,"_BrowseDirc")
        GUICtrlSetFont(-1,9,400,0,"Tahoma")
        If _MathCheckDiv($i+1,3)=2 Then
           $HeightPos1+=35
            $HeightPos2+=35
        $widthPos1 = 15
            $widthpos2 = 115
        Else
            $WidthPos1 += 200
            $WidthPos2 += 200
            
        EndIf
    Next
EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Thanks for the help martin, but i realized an easiest way to do it, repeat the _CreateButton func and assign elements back to the array.

I updated in example forum.

Share this post


Link to post
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
Sign in to follow this  
Followers 0