Jump to content
kartune

array variable has incorrect number of subscripts

Recommended Posts

kartune

Hello, I am getting this error message when running my script:

Case $aButiD[0] To $aButiD[$iTotButtons - 1]

Case ^ ERROR

Error:  Array variable has incorrect number of subscripts or subscript dimension range exceeded.

 

The script's purpose is to read my ini file and create buttons for the sections and section contents.

The first part of the script creates buttons for the sections of the ini, once you click on the section button it should open another set of buttons of all the contents under the section

In this case, the section in the .ini file is called "TPA"

on the Func flavorco()

It opens the contents of "TPA" into buttons.

Right now, the section it is reading is determined by $sSection.

It is only when I try to change $sSection = "TPA"

to

$sSection = $flavorco

that the error starts to appear

 

Here is the script

#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>




$optbar = IniReadSectionNames("test.ini")
If Not IsArray($optbar) Then Exit
Local $Button[UBound($optbar) - 1]

$mGUI = GUICreate('Restock Flavor Ingredients', 10 + (130 * UBound($optbar)), 100)

For $x = 1 To UBound($optbar) - 1
    $var = IniReadSection("test.ini", $optbar[$x])
    If @error Then ContinueLoop
    $X_Coord = 10 + (($x - 1) * 100)
    $Button[$x - 1] = GUICtrlCreateButton($optbar[$x], $X_Coord, 30, 70, 30)
Next
GUISetState()

While 1
    $mMsg = GUIGetMsg()
    If $mMsg = $GUI_EVENT_CLOSE Then
       GUIDelete($mGUI)
       ExitLoop
       EndIf
    For $i = 0 To UBound($Button) - 1
        If $mMsg = $Button[$i] Then
            MsgBox(0, '$Msg = ' & $mMsg, GuiCtrlRead($Button[$i]) & ' Pressed', 2)
            Global $flavorco = $Button ; sets the flavor company's variable
            Call('flavorco')
         EndIf
    Next
 WEnd



Func flavorco() ;opened flavor company's flavors
   MsgBox(0, '$Msg = ' & $mMsg, GuiCtrlRead($Button[$i]) & $flavorco, 0)
Local $sFilePath = @ScriptDir & "\Test.ini"
Local $sSection = $Button
Local $aArray = IniReadSection($sFilePath, $sSection)
_ArrayDelete($aArray, 0)
;_ArrayDisplay($aArray)

Local $iIndex
Local $iTotButtons = UBound($aArray)
Local $iNumPerRow = 5
Local $iButWidth = 100
Local $iButDepth = 30
Local $aButiD[$iTotButtons]
Local $hGUI = GUICreate('Ingredients Stock "' & $sFilePath & '"', 10 + ($iButWidth + 10) * $iNumPerRow, _
                                                             10 + Ceiling($iTotButtons / $iNumPerRow) * ($iButDepth + 10), -1, $WS_EX_TOPMOST)
For $i = 0 To $iTotButtons - 1
    ; $x = $iXBorder + (($iRectWidth + $iSpacing) * Mod($i, $iNumCols))
    $x = 10 + (($iButWidth + 10) * Mod($i, $iNumPerRow))

    ; $y = $iYBorder + (($iRectDepth + $iSpacing) * Int($i / $iNumCols))
    $y = 10 + (($iButDepth + 10) * Int($i / $iNumPerRow))

    $aButiD[$i] = GUICtrlCreateButton($aArray[$i][0], $x, $y, $iButWidth, $iButDepth) ;, $BS_NOTIFY)
Next

GUISetState(@SW_SHOW)

While 1
   $msg = GUIGetMsg()
    Switch $msg
       Case $GUI_EVENT_CLOSE
            GUIDelete($hGUI)
            ExitLoop

         Case $aButiD[0] To $aButiD[$iTotButtons - 1] ;clicking on a flavor name
            $iIndex = ($msg - $aButiD[0])
            $RSINGRflavor = $aArray[$iIndex][0] ;flavor name
            $RSINGRml = $aArray[$iIndex][1] ; ml
            $RSINGRgal = $aArray[$iIndex][1]*0.000264172 ;converts ml to gal
            Call('openflavor')
      EndSwitch
WEnd
EndFunc


Func openflavor()
                #Region ### START Koda GUI section ### Form=F:\Karl\AutoIt\FJ-Stock JP\GUI Forms\RSINGRSUBFORM.kxf ;opens flavor to view stock and restock submit
                $RSINGRSUBFORM = GUICreate($sSection & " " & $RSINGRflavor, 242, 213, 530, 269)
                $RSINGRFlavorTitle = GUICtrlCreateLabel($sSection & " " & $RSINGRflavor, 32, 8, 200, 28)
                GUICtrlSetFont(-1, 16, 800, 0, "MS Sans Serif")
                $RSINGRstockcaption = GUICtrlCreateLabel("Current Stock in ml:", 16, 48, 96, 17)
                $RSINGRstockml = GUICtrlCreateLabel($RSINGRml, 120, 48, 114, 25)
                GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
                $RSINGRInput = GUICtrlCreateInput("ml", 40, 112, 153, 21)
                $RSINGRSUBMIT = GUICtrlCreateButton("SUBMIT", 16, 152, 81, 33)
                $RSINGRCLOSE = GUICtrlCreateButton("CLOSE", 145, 151, 81, 33)
                $RSINGRgalcaption = GUICtrlCreateLabel("Current Stock in gal:", 16, 80, 97, 17)
                $RSINGRstockgal = GUICtrlCreateLabel($RSINGRGAL, 120, 80, 114, 25)
                GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
                GUISetState(@SW_SHOW)
                #EndRegion ### END Koda GUI section ###
         ;   $msg = ""

While 1

$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($RSINGRSUBFORM)
            ExitLoop

         Case $RSINGRCLOSE
            GUIDelete($RSINGRSUBFORM)
            ExitLoop

    EndSwitch
WEnd
EndFunc

 

Any help is much appreciated!  Thanks.

My guess is that $Button isn't an actual string??  Whenever I use msgbox it shows up the string exactly, no numbers attached.  So i'm not sure whats going on here.

Share this post


Link to post
Share on other sites
Earthshine
Posted (edited)

it does not even compile.

>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\root\Desktop\test.au3
"C:\Users\root\Desktop\test.au3"(90,54) : warning: $sSection: possibly used before declaration.
                $RSINGRSUBFORM = GUICreate($sSection &
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\root\Desktop\test.au3"(90,75) : warning: $RSINGRflavor: possibly used before declaration.
                $RSINGRSUBFORM = GUICreate($sSection & " " & $RSINGRflavor,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\root\Desktop\test.au3"(94,62) : warning: $RSINGRml: possibly used before declaration.
                $RSINGRstockml = GUICtrlCreateLabel($RSINGRml,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\root\Desktop\test.au3"(100,64) : warning: $RSINGRGAL: possibly used before declaration.
                $RSINGRstockgal = GUICtrlCreateLabel($RSINGRGAL,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\root\Desktop\test.au3"(90,54) : error: $sSection: undeclared global variable.
                $RSINGRSUBFORM = GUICreate($sSection &
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\root\Desktop\test.au3"(90,75) : error: $RSINGRflavor: undeclared global variable.
                $RSINGRSUBFORM = GUICreate($sSection & " " & $RSINGRflavor,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\root\Desktop\test.au3"(94,62) : error: $RSINGRml: undeclared global variable.
                $RSINGRstockml = GUICtrlCreateLabel($RSINGRml,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\root\Desktop\test.au3"(100,64) : error: $RSINGRGAL: undeclared global variable.
                $RSINGRstockgal = GUICtrlCreateLabel($RSINGRGAL,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\root\Desktop\test.au3 - 4 error(s), 4 warning(s)
!>14:52:09 AU3Check ended. Press F4 to jump to next error.rc:2
+>14:52:09 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 0.647

I am not updating autoit until the teething pains are gone for good.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
JLogan3o13
Posted (edited)

@kartune before you work on the buttons, I would look at some of the other issues. You're declaring local variables in one function, which are then not available in another. Are you using the full version of SciTE with AU3Check?

Edit: see example above

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
kartune
Posted (edited)

Sorry, i just noticed that and corrected it, I am using:
SciTE-Lite  
Version 3.5.4 
    Sep 18 2015 15:04:36

I will check out the full version and au3check now.
Here is the revised code:

 

#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>




$optbar = IniReadSectionNames("test.ini")
If Not IsArray($optbar) Then Exit
Local $Button[UBound($optbar) - 1]

$mGUI = GUICreate('Restock Flavor Ingredients', 10 + (130 * UBound($optbar)), 100)

For $x = 1 To UBound($optbar) - 1
    $var = IniReadSection("test.ini", $optbar[$x])
    If @error Then ContinueLoop
    $X_Coord = 10 + (($x - 1) * 100)
    $Button[$x - 1] = GUICtrlCreateButton($optbar[$x], $X_Coord, 30, 70, 30)
Next
GUISetState()

While 1
    $mMsg = GUIGetMsg()
    If $mMsg = $GUI_EVENT_CLOSE Then
       GUIDelete($mGUI)
       ExitLoop
       EndIf
    For $i = 0 To UBound($Button) - 1
        If $mMsg = $Button[$i] Then
            MsgBox(0, '$Msg = ' & $mMsg, GuiCtrlRead($Button[$i]) & ' Pressed', 2)
            Global $flavorco = $Button ; flavor company
            Call('flavorco')
         EndIf
    Next
 WEnd



Func flavorco() ;opened flavor companys flavors
   MsgBox(0, '$Msg = ' & $mMsg, GuiCtrlRead($Button[$i]) & $flavorco, 0)
Global $sFilePath = @ScriptDir & "\Test.ini"
Global $sSection = "TPA"
Global $aArray = IniReadSection($sFilePath, $sSection)
_ArrayDelete($aArray, 0)
;_ArrayDisplay($aArray)

Global $iIndex
Global $iTotButtons = UBound($aArray)
Global $iNumPerRow = 5
Global $iButWidth = 100
Global $iButDepth = 30
Global $aButiD[$iTotButtons]
Global $hGUI = GUICreate('Ingredients Stock "' & $sFilePath & '"', 10 + ($iButWidth + 10) * $iNumPerRow, _
                                                             10 + Ceiling($iTotButtons / $iNumPerRow) * ($iButDepth + 10), -1, $WS_EX_TOPMOST)
For $i = 0 To $iTotButtons - 1
    ; $x = $iXBorder + (($iRectWidth + $iSpacing) * Mod($i, $iNumCols))
    $x = 10 + (($iButWidth + 10) * Mod($i, $iNumPerRow))

    ; $y = $iYBorder + (($iRectDepth + $iSpacing) * Int($i / $iNumCols))
    $y = 10 + (($iButDepth + 10) * Int($i / $iNumPerRow))

    $aButiD[$i] = GUICtrlCreateButton($aArray[$i][0], $x, $y, $iButWidth, $iButDepth) ;, $BS_NOTIFY)
Next

GUISetState(@SW_SHOW)

While 1
   $msg = GUIGetMsg()
    Switch $msg
       Case $GUI_EVENT_CLOSE
            GUIDelete($hGUI)
            ExitLoop

         Case $aButiD[0] To $aButiD[$iTotButtons - 1] ;clicking on a flavor name
            $iIndex = ($msg - $aButiD[0])
            Global $RSINGRflavor = $aArray[$iIndex][0] ;flavor name
            Global $RSINGRml = $aArray[$iIndex][1] ; ml
            Global $RSINGRgal = $aArray[$iIndex][1]*0.000264172 ;converts ml to gal
            Call('openflavor')
      EndSwitch
WEnd
EndFunc








Func openflavor()
                #Region ### START Koda GUI section ### Form=F:\Karl\AutoIt\FJ-Stock JP\GUI Forms\RSINGRSUBFORM.kxf ;opens flavor to view stock and restock submit
                $RSINGRSUBFORM = GUICreate($sSection & " " & $RSINGRflavor, 242, 213, 530, 269)
                $RSINGRFlavorTitle = GUICtrlCreateLabel($sSection & " " & $RSINGRflavor, 32, 8, 200, 28)
                GUICtrlSetFont(-1, 16, 800, 0, "MS Sans Serif")
                $RSINGRstockcaption = GUICtrlCreateLabel("Current Stock in ml:", 16, 48, 96, 17)
                $RSINGRstockml = GUICtrlCreateLabel($RSINGRml, 120, 48, 114, 25)
                GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
                $RSINGRInput = GUICtrlCreateInput("ml", 40, 112, 153, 21)
                $RSINGRSUBMIT = GUICtrlCreateButton("SUBMIT", 16, 152, 81, 33)
                $RSINGRCLOSE = GUICtrlCreateButton("CLOSE", 145, 151, 81, 33)
                $RSINGRgalcaption = GUICtrlCreateLabel("Current Stock in gal:", 16, 80, 97, 17)
                $RSINGRstockgal = GUICtrlCreateLabel($RSINGRGAL, 120, 80, 114, 25)
                GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
                GUISetState(@SW_SHOW)
                #EndRegion ### END Koda GUI section ###
         ;   $msg = ""

While 1

$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($RSINGRSUBFORM)
            ExitLoop

         Case $RSINGRCLOSE
            GUIDelete($RSINGRSUBFORM)
            ExitLoop

    EndSwitch
WEnd
EndFunc

 

Edited by kartune

Share this post


Link to post
Share on other sites
JLogan3o13

Can you please provide an example of your test.ini?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
kartune
2 minutes ago, JLogan3o13 said:

Can you please provide an example of your test.ini?

sure thing, here it is:

 

[VG]
ml=0

[PG]
ml=0

[TPA]
Apple Candy=100
Bavarian Cream=0
Berry Cereal=0
Blueberry=0
Citrus Punch=0
Clove=0
Coconut Extra=0
Energy Drink=0
Fruit Circles=0
Ginger Ale=0
Graham Cracker Clear=0
Hawaiian Drink=0
Honey Dew=0
Kiwi=0
Menthol=0
MType=0
Papaya=0
Peach=0
Peppermint=0
Ry4=0
Tiramisu=0
Toasted Almond=0
Tobacco=0
Vanilla Bean Ice Cream=0
Vanilla Swirl=0
Watermelon=0
Western=0


[JP]
Condensed Milk=0
Garikun=0
Honey Dew=0
Kiwi=0
Matcha=0
Melon Cream Soda=0
Peach=0
Pineapple=0
Strawberry=0
Umeshu=0
Yogurt=0
MType=-0


[CAP]
Honey Dew=0
Vanilla Custard=0


[FA]
Fresh Cream=0
Meringue=0
Seven Leaves=0
Bavarian Cream=0

[INA]
Biscuit=0


(Scroll Up)

Share this post


Link to post
Share on other sites
JLogan3o13

Thanks, will take a look.

In the future you could just attach a file, a lot easier than making someone save it off :) 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
kartune
Just now, JLogan3o13 said:

Thanks, will take a look.

In the future you could just attach a file, a lot easier than making someone save it off :) 

Thanks, i will remember that :), new to this forum and also coding.  Most of my code is copy pasted and then edited.

Share this post


Link to post
Share on other sites
Subz

To read the button text you need to use:

Global $flavorco = GUICtrlRead($Button[$i])

Then you can use $sSection = $Flavorco

Share this post


Link to post
Share on other sites
kartune

It works!!! Thanks a lot guys!

I'm so grateful for this forum and the members :D

Share this post


Link to post
Share on other sites
Subz

No problem, overall code is quite good, Just a couple of pointers, regarding best practice for variables:

  • You shouldn't declare Global variables within functions.
  • Global variables should only be declared if being used between multiple functions (as JLogan pointed out above)
  • Prefixing your variables helps with identifying the variable type see https://www.autoitscript.com/wiki/Best_coding_practices

Quick Example:

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $sSection
Global $sFilePath = @ScriptDir & "\Test.ini"

MainGui()

Func MainGui()
    Local $aOptionBar = IniReadSectionNames($sFilePath)
        If @error Then Exit
    Local $aButton[$aOptionBar[0]]
    Local $hMainGui = GUICreate('Restock Flavor Ingredients', 10 + (130 * UBound($aOptionBar)), 100)

    For $i = 1 To $aOptionBar[0]
        IniReadSection("test.ini", $aOptionBar[$i])
            If @error Then ContinueLoop
        $iX_Coord = 10 + (($i - 1) * 100)
        $aButton[$i - 1] = GUICtrlCreateButton($aOptionBar[$i], $iX_Coord, 30, 70, 30)
    Next

    GUISetState()

    While 1
        $nMainMsg = GUIGetMsg()
        Switch $nMainMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($hMainGui)
                ExitLoop
            Case $aButton[0] To $aButton[UBound($aButton) - 1]
                $sSection = GUICtrlRead($nMainMsg)
                flavorco() ; flavor company
        EndSwitch
     WEnd
EndFunc

Func flavorco() ;opened flavor companys flavors
    Local $x, $y
    Local $aFlavors = IniReadSection($sFilePath, $sSection)
    _ArrayDelete($aFlavors, 0)
    Local $iIndex
    Local $iTotButtons = UBound($aFlavors)
    Local $iNumPerRow = 5
    Local $iButWidth = 100
    Local $iButDepth = 30
    Local $aButiD[$iTotButtons]
    Local $hFlavors = GUICreate('Ingredients Stock "' & $sFilePath & '"', 10 + ($iButWidth + 10) * $iNumPerRow, 10 + Ceiling($iTotButtons / $iNumPerRow) * ($iButDepth + 10), -1, $WS_EX_TOPMOST)
    For $i = 0 To $iTotButtons - 1
        $x = 10 + (($iButWidth + 10) * Mod($i, $iNumPerRow))
        $y = 10 + (($iButDepth + 10) * Int($i / $iNumPerRow))
        $aButiD[$i] = GUICtrlCreateButton($aFlavors[$i][0], $x, $y, $iButWidth, $iButDepth)
    Next

    GUISetState(@SW_SHOW)

    While 1
        $nFlavorCoMsg = GUIGetMsg()
        Switch $nFlavorCoMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($hFlavors)
                ExitLoop
            Case $aButiD[0] To $aButiD[$iTotButtons - 1] ;clicking on a flavor name
                $iIndex = ($nFlavorCoMsg - $aButiD[0])
                openflavor($aFlavors[$iIndex][0], $aFlavors[$iIndex][1], $aFlavors[$iIndex][1]*0.000264172)
        EndSwitch
    WEnd
EndFunc

Func openflavor($sRSINGRflavor, $iRSINGRml, $iRSINGRgal)
    #Region ### START Koda GUI section ### Form=F:\Karl\AutoIt\FJ-Stock JP\GUI Forms\RSINGRSUBFORM.kxf ;opens flavor to view stock and restock submit
        Local $nRSINGRmsg
        Local $hRSINGRSUBFORM = GUICreate($sSection & " " & $sRSINGRflavor, 242, 213, 530, 269)
        GUICtrlCreateLabel($sSection & " " & $sRSINGRflavor, 32, 8, 200, 28)
            GUICtrlSetFont(-1, 16, 800, 0, "MS Sans Serif")
        GUICtrlCreateLabel("Current Stock in ml:", 16, 48, 96, 17)
        GUICtrlCreateLabel($iRSINGRml, 120, 48, 114, 25)
            GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
        Local $idRSINGRInput = GUICtrlCreateInput("ml", 40, 112, 153, 21)
        Local $idRSINGRSUBMIT = GUICtrlCreateButton("SUBMIT", 16, 152, 81, 33)
        Local $idRSINGRCLOSE = GUICtrlCreateButton("CLOSE", 145, 151, 81, 33)
        GUICtrlCreateLabel("Current Stock in gal:", 16, 80, 97, 17)
        GUICtrlCreateLabel($iRSINGRgal, 120, 80, 114, 25)
            GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    #EndRegion ### END Koda GUI section ###

    GUISetState(@SW_SHOW)

    While 1
        $nRSINGRmsg = GUIGetMsg()
        Switch $nRSINGRmsg
            Case $GUI_EVENT_CLOSE, $idRSINGRCLOSE
                GUIDelete($hRSINGRSUBFORM)
                ExitLoop
        EndSwitch
    WEnd
EndFunc

 

Share this post


Link to post
Share on other sites
kartune

Thank you!  I am going to clean up my coding as I learn more and practice :).

 

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

  • Similar Content

    • nooneclose
      By nooneclose
      I need help turning this string "20180913221626" into a formatted time string.
      I need to go from this: 20180913221626
      to this: 09/13/2018 10:16 PM
      I do not always know what the date will be so I can not just use a variable I need to actually convert/format. 
      I did see an older post in the forms that was basically the same question only the other guy did not post the working code and I can not figure out how to use _AD_GetObjectProperties properly to get what I want. 
      As always any help would be appreciated. 
      Here is the code I use to find the date, but it always gives me the unformatted version. 
      ;retrieve the items object $oItem = $oOutlook.Session.GetItemFromID($aItems[1][0], Default) $oItem.GetInspector $eSentOn = $oItem.SentOn ; When was the email sent? MsgBox("", "Sent On of the email", $eSentOn) ;******************************************************************************* ; Formats the date and time from the email ;******************************************************************************* ;Local $fDatenTime = _DateTimeFormat($eSentOn, 1) ;MsgBox("", "Formatted email time", $fDatenTime) $aProperties = _AD_GetObjectProperties($eSentOn) _ArrayDisplay($aProperties, "Did the conversion work?")  
    • Miliardsto
      By Miliardsto
      I got that func
      Func makeHelpImgGUI($title,$width,$height,$img) $img = GUICtrlCreatePic("",20,40,$width,$height) _ResourceSetImageToCtrl($img, "HERE") EndFunc and I call this func like that
      makeHelpImgGUI("Image",1190, 800,$SETTINGS_JPG)  
      so what is the problem in the parameter where is - "HERE" I need value of img but passed as string
      so $img = $SETTINGS_JPG and how make it "SETTINGS_JPG"
       
      I tried something like that but not work
      Func makeHelpImgGUI($title,$width,$height,$img) $name_str = String($img) $name_str = StringTrimLeft ($name_str, 1 ) $img = GUICtrlCreatePic("",20,40,$width,$height) _ResourceSetImageToCtrl($img, $name_str) EndFunc  
    • liagason
      By liagason
      Hello everyone,
      How can I display in ascending  sequence some numbers stored in a string variable?
      $str = "18,03,48,23" MsgBox(0,"test",$str) I would like it to display "03,18,23,48"
    • Rskm
      By Rskm
      Hi, I have the following line in a text file 'input.txt'. I know the line number - say '6'. I wish to replace the text 'WWW' in the below line with a random number (I can generate that with random()).
      WERIS  WWWJP   3.83  8.330  1.000                1097.RAXX 
      The WWW is a 3 digit integer (could be any number between 0 to 999), I can use stringtrimleft and get the numerical value of WWW in this file
      so, basically, I know the string to replace (ie; WWW stored in a variable), I know the line number to work on and the file location/name and the replacement variable (through random()). My requirement is to fill that 3 spaces with my random number (which Is a integer between 1 and 999)
      please put ur suggestions
       
    • nacerbaaziz
      By nacerbaaziz
      Hello Members of this best Forum
      i have a question please
      for example if i have a long string
      and i want to extract a text between two tag
      what i can do to make that?
      note :
      i know that there is a
      StringRegExp function
      it's do that work
      but it result is be as an array
      i want the result to be a string
      is there any function on autoit can do that?
      Thanks in advance.
×