Jump to content
Sign in to follow this  
Jcreator

this script keeps having contradicting loop

Recommended Posts

Jcreator

i used this code to take names for a text file called data and put the info of the image and it location from the data file into the gui interface but it only detect the lines with the info and it do not show the images . here is the code 

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <AVIConstants.au3>
#include <TreeViewConstants.au3>
#include <GuiComboBox.au3>
#include <GuiTab.au3>
#include <file.au3>
#include <array.au3>




_Main()


Func _Main()


Local $idTab1

$Form1 = GUICreate("Form1", 500, 334, 240, 182)
$Group1 = GUICtrlCreateGroup("Group1", 20, 12, 249, 314)
$idButton6 = GUICtrlCreateButton("Info", 50, 270, 185, 49)

GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

Global $fileMPA = "C:\T-in\MPA\data.txt"

FileOpen($fileMPA, 0)

   Global $line1 = FileReadLine($fileMPA , 1)

$imp = 0


$idTab1 = GUICtrlCreateTab(300, -3, 180, 330)
GUICtrlCreateTabItem("imglist1")
GUICtrlSetTip(-1, '#Region TAB1')
GUICtrlSetTip(-1, '#Region LIST')
Local $imglist1 = GUICtrlCreateList("", 307, 26, 164, 304)


$cline =_FileCountLines($fileMPA)

 While  $imp < $cline


$line2 = FileReadLine($fileMPA , $imp + 2)
 $imp = $imp + 7

if $line2 = ""  then

    ExitLoop

   else

 GUICtrlSetData(-1, ""& $line2 &"", "")

 endif

WEnd

GUICtrlCreateTabItem("imagelist2")
GUICtrlSetTip(-1, '#Region TAB2')
GUICtrlCreateTabItem("imagelist3")
GUICtrlSetTip(-1, '#Region TAB3')

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
            Global $whatnow = GUICtrlRead($imglist1)
Case $Msg = $idButton6

            $imp2 = 0
             While  $imp2 < 30


$line2 = FileReadLine($fileMPA ,$imp2 + 2)
$line3 = FileReadLine($fileMPA , $imp2 + 3)
$line7 = FileReadLine($fileMPA , 7)

 $imp2 = $imp2 + 7

if $line2 = ""  then  ExitLoop
            If GUICtrlRead($imglist1) = ""& $line2 &""  Then MsgBox($MB_SYSTEMMODAL, "img info" , $line3)
               WEnd
            EndSelect
$imp2 = 0
             While  $imp2 < 30


$line2 = FileReadLine($fileMPA ,$imp2 + 2)
$line3 = FileReadLine($fileMPA , $imp2 + 3)
$line7 = FileReadLine($fileMPA , 7)

 $imp2 = $imp2 + 7

    Select
Case GUICtrlRead($imglist1) = ""& $line2 &""
if $line2 = "" then ExitLoop
    $Pic1 = GUICtrlCreatePic(""& $line7 &"", 185, 28, 233, 230)

If GUICtrlRead($imglist1) then  ExitLoop
EndSelect
WEnd

    WEnd

 EndFunc   ;==>_Main

the data.txt file content is 

Hibiscus
Hibiscus is a hardy perennial which grows in variety of colors, sizes and fragrances. Actually they are tropical flowers which require ample sunlight and moisture to grow well. These flowers start blooming in late spring and continuously bloom through July and August.



C:\T-in\IMG\2.jpg

Lilies
There are different types of lily flowers which bloom in August including water lilies, tiger lilies and gold band lilies. Tiger lilies generate orange flowers having black spots. This lily blooms in delayed July and beginning of August. Gold band lily produce exotic white blooms. All varieties of lilies need enough space to grow and protection from summer sun.



C:\T-in\IMG\1.jpg

Turtlehead
Growing in humid areas, turtleheads are small flowers which bloom from July to September. They mostly produce flowers of white and pink color.



C:\T-in\IMG\3.jpg

Hydrangea
These are ever green bushes which produce flowers in different colors including white, purple, blue and pink. They are easy to grow bushes and can grow 3 to 10 feet tall. They require morning sun to grow but they should be protected from noon and afternoon sun.



C:\T-in\IMG\4.jpg

Dahlias
August proves to be the peak blooming season for dahlias. Dahlias come in colors like white, orange, yellow, red and purple. They can tolerate all types of soil and require full sun to grow.

Share this post


Link to post
Share on other sites
AutoBert

I suggest using a 2 dimension Array holding the data from the textfile. Creeating array can be done also with regex, the rest of script is just a demo for easy solving with array:

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

$sFile = FileRead('flowers.txt')    ;change to your path
$aFlowers = StringSplit($sFile, '.jpg', 1)
If IsArray($aFlowers) Then
    For $j = $aFlowers[0] To 1 Step -1
        If StringStripWS($aFlowers[$j], 8) = '' Then
            _ArrayDelete($aFlowers, $j)
            $aFlowers[0] -= 1
        EndIf
    Next
    _ArrayColInsert($aFlowers, 1)
    _ArrayColInsert($aFlowers, 1)
    ;_ArrayDisplay($aFlowers)
    For $i = 1 To $aFlowers[0][0]
        $aSplit = StringSplit($aFlowers[$i][0], @CRLF, 1)
        For $j = $aSplit[0] To 1 Step -1
            If $aSplit[$j] = '' Then
                _ArrayDelete($aSplit, $j)
                $aSplit[0] -= 1
            EndIf
        Next
        ;_ArrayDisplay($aSplit, 'Split')
        If $aSplit[0] = 0 Then ExitLoop
        $aFlowers[$i][0] = $aSplit[1]
        #cs
            $sDescription = ''
            For $j = $aSplit[2] To $aSplit[0]; - 1
            if $aSplit[$j]<>'' Then $sDescription &= $aSplit[$j] & @CRLF
            Next
        #ce
        $aFlowers[$i][0] = $aSplit[1]
        $aFlowers[$i][1] = $aSplit[2]
        $aFlowers[$i][2] = $aSplit[$aSplit[0]] & '.jpg'
    Next
EndIf
;_ArrayDisplay($aFlowers)

Global $idPic =-999
$hMainGui=GUICreate('JPG-Viewer',640,480)
$idList=GUICtrlCreateList('',490,5,135,470)
For $i=1 to $aFlowers[0][0]
    GUICtrlSetData($idList,$aFlowers[$i][0])
Next
$idLblDescription=GUICtrlCreateLabel('Test',5,405,470,70);,$SS_LEFT)
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idList
            $sVal = GUICtrlRead($idList)
            $iNo= _ArraySearch($aFlowers,$sVal)
            ConsoleWrite($iNo & ' '&$sVal & ': '& $aFlowers[$iNo][1]&@CRLF)
            GUICtrlSetData($idLblDescription,$aFlowers[$iNo][1])
            If $idPic <>-999 Then GUICtrlDelete($idPic)
            $idPic=GUICtrlCreatePic($aFlowers[$iNo][2],5,5,200,200)
    EndSwitch
WEnd

 

Edited by AutoBert

Share this post


Link to post
Share on other sites
Jcreator

am still not good with the autoit yet so your script will take me some time to understand especially

StringStripW

but i will give it my time to understand it .am sooo thankful . you are a life saver ,and the way you write scripts is so clean . i hope someday i could help you with something.

for now i will give this script some time to see how can i edit it

Share this post


Link to post
Share on other sites
AutoBert

May be @mikell or some one else of the StringRegExp experts, show a shorter way to get the 2 dimension array. Btw. there is a typo in your quote the func name is

Quote

StringStripWS

Strips the white space in a string.

, i use it to detect empty lines.

the pic's are visible in the testscript, i couldn't test it? And found typos in this line:

$idPic=GUICtrlCreatePic($aFlowers[$iNo][2],5,5,200,200)

 

Edited by AutoBert

Share this post


Link to post
Share on other sites
mikell

You could try something like the code below, so you get a 1D array
You can then use it in a For loop with step 3, or build a 2D array with 3 cols, etc

This code implies that the description is a one-liner string and that the data.txt is formatted exactly like the text in post #1 ... regular expression requirements   :)

#Include <Array.au3>

$txt = FileRead("C:\T-in\MPA\data.txt")

$res = StringRegExp($txt, '(?is)(c:\N+jpg)\s*(\N+)\R(\N+)', 3)
 _ArrayDisplay($res)
 
 #cs
Local $u = UBound($res), $flowers[$u/3][3]
For $i = 0 to $u-1 step 3
   $flowers[$i/3][0] = $res[$i+1]
   $flowers[$i/3][1] = $res[$i]
   $flowers[$i/3][2] = $res[$i+2]
Next
 _ArrayDisplay($flowers)
#ce

 

Edited by mikell

Share this post


Link to post
Share on other sites
SadBunny

@Jcreator But why format the text file like that? Why not line by line and separated by some character (comma would make sense except there is free text so pipes or tabs are often better)

Quote

c:\x\y.jpg|my title|This, some text, is the rest of the explanation.

... then use StringSplit or StringRegexp to split it in much the same way, but with easier regexps? :) 

Added benefit: file is easy to maintain in a spreadsheet software like excel.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
AutoBert

@SadBunny: i think the textfile is generated from https://orchidflowers.wordpress.com/2012/12/13/list-of-perennials-which-bloom-all-year/

@Jcreator: now the script is shortened:

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

$sFile = FileRead('flowers.txt') ;change to your path
$aRes = StringRegExp($sFile, '(?is)(c:\N+jpg)\s*(\N+)\R(\N+)', 3)
Global $aFlowers[UBound($aRes) / 3 + 1][3], $j
For $i = 0 To UBound($aRes) - 1 Step 3
    $j += 1
    $aFlowers[$j][0] = $aRes[$i + 1]
    $aFlowers[$j][1] = $aRes[$i + 2]
    $aFlowers[$j][2] = $aRes[$i]
Next
$aFlowers[0][0] = $j
;_ArrayDisplay($aFlowers)

Global $idPic = -999
$hMainGui = GUICreate('JPG-Viewer', 640, 480)
$idList = GUICtrlCreateList('', 490, 5, 135, 470)
For $i = 1 To $aFlowers[0][0]
    GUICtrlSetData($idList, $aFlowers[$i][0])
Next
$idLblHeader = GUICtrlCreateLabel('Header', 5, 5, 470, 40);,$SS_LEFT)
GUICtrlSetFont(-1, 14, 800)
$idLblBody = GUICtrlCreateLabel('Body', 5, 395, 470, 70);,$SS_LEFT)
GUICtrlSetFont(-1, 10, 400)
$sFlower=_GUICtrlListBox_GetText($idList, 0)
_FindFlowerByName($sFlower)
_GUICtrlListBox_SelectString($idList, $sFlower)
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idList
            $sVal = GUICtrlRead($idList)
            _FindFlowerByName($sVal)
    EndSwitch
WEnd

Func _FindFlowerByName($sFlower)
    Local $iNo = _ArraySearch($aFlowers, $sFlower)
    _FindFlowerByID($iNo)
EndFunc   ;==>_FindFlowerByName

Func _FindFlowerByID($iNo)
    ;ConsoleWrite($iNo & ': '& $aFlowers[$iNo][1]&@CRLF)
    GUICtrlSetData($idLblHeader, $aFlowers[$iNo][0])
    GUICtrlSetData($idLblBody, $aFlowers[$iNo][1])
    If $idPic <> -999 Then GUICtrlDelete($idPic)
    $idPic = GUICtrlCreatePic($aFlowers[$iNo][2], 5, 55, 200, 200)
EndFunc   ;==>_FindFlowerByID

@mikell: i hoped with StringRegExp a one liner is possible for creating and assigning a 2 dimension array, but seems not possible.

Edited by AutoBert

Share this post


Link to post
Share on other sites
mikell

Alas, yes indeed using StringRegExp the only arrays you can get are 1D arrays  :(
It's the user's task afterwards to manage it and build their own 2D array with n colummns

Share this post


Link to post
Share on other sites
AutoBert

I found a way to get small (not so  small as StringR egExp), easy readable script using stringreplace to get a working file   for the use of _FileReadToArray:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <StaticConstants.au3>
#include <GuiListBox.au3>

$sPath = 'flowers.txt' ;change to your path
$sFile = FileRead($sPath)
$sFile = Stringreplace($sFile,'.jpg'&@CRLF,chr(255)); row seperator placeholder
Do
    $sFile = Stringreplace($sFile,@CRLF&@CRLF,@CRLF)
Until not @extended
$sFile =Stringreplace($sFile,@CRLF,'|')             ;col seperator
$sFile =Stringreplace($sFile,Chr(255), '.jpg'&@CRLF);row seperator restored
$hFile=FileOpen($sPath&'.work',2)
$sFile='|'&$sFile                                   ;all other rows have this also
FileWrite($hFile,$sFile)
FileClose($hFile)
Global $aFlowers
_FileReadToArray($sPath&'.work',$aFlowers,$FRTA_COUNT,'|')
$aFlowers[0][2]=$aFlowers[0][1] ;saving colcount
$aFlowers[0][1]=$aFlowers[0][0] ;saving rowcount
_ArrayColDelete($aFlowers,0) ;col 0 has no data so deleting
;_ArrayDisplay($aFlowers)

Global $idPic = -999
$hMainGui = GUICreate('JPG-Viewer', 640, 480)
$idList = GUICtrlCreateList('', 490, 5, 135, 470)
For $i = 1 To $aFlowers[0][0]
    GUICtrlSetData($idList, $aFlowers[$i][0])
Next
$idLblHeader = GUICtrlCreateLabel('Header', 5, 5, 470, 40);,$SS_LEFT)
GUICtrlSetFont(-1, 14, 800)
$idLblBody = GUICtrlCreateLabel('Body', 5, 395, 470, 70);,$SS_LEFT)
GUICtrlSetFont(-1, 10, 400)
$sFlower=_GUICtrlListBox_GetText($idList, 0)
_FindFlowerByName($sFlower)
_GUICtrlListBox_SelectString($idList, $sFlower)
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idList
            $sVal = GUICtrlRead($idList)
            _FindFlowerByName($sVal)
    EndSwitch
WEnd

Func _FindFlowerByName($sFlower)
    Local $iNo = _ArraySearch($aFlowers, $sFlower)
    _FindFlowerByID($iNo)
EndFunc   ;==>_FindFlowerByName

Func _FindFlowerByID($iNo)
    ;ConsoleWrite($iNo & ': '& $aFlowers[$iNo][1]&@CRLF)
    GUICtrlSetData($idLblHeader, $aFlowers[$iNo][0])
    GUICtrlSetData($idLblBody, $aFlowers[$iNo][1])
    If $idPic <> -999 Then GUICtrlDelete($idPic)
    $idPic = GUICtrlCreatePic($aFlowers[$iNo][2], 5, 55, 200, 200)
EndFunc   ;==>_FindFlowerByID

 

Edited by AutoBert

Share this post


Link to post
Share on other sites
Jcreator

this last one did more then what i had in mind ^^ thank you so much i had to do some changes  the line For $i = 1 To $cline

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <StaticConstants.au3>
#include <GuiListBox.au3>

$sPath = 'flowers.txt' ;change to your path
$sFile = FileRead($sPath)
$sFile = Stringreplace($sFile,'.jpg'&@CRLF,chr(255)); row seperator placeholder
Do
    $sFile = Stringreplace($sFile,@CRLF&@CRLF,@CRLF)
Until not @extended
$sFile =Stringreplace($sFile,@CRLF,'|')             ;col seperator
$sFile =Stringreplace($sFile,Chr(255), '.jpg'&@CRLF);row seperator restored
$hFile=FileOpen($sPath&'.work',2)
$sFile='|'&$sFile                                   ;all other rows have this also
FileWrite($hFile,$sFile)
FileClose($hFile)
Global $aFlowers
_FileReadToArray($sPath&'.work',$aFlowers,$FRTA_COUNT,'|')
_ArrayColDelete($aFlowers,0) ;row 0 has no data so deleting
_ArrayDisplay($aFlowers)

Global $idPic = -999
$hMainGui = GUICreate('JPG-Viewer', 640, 480)
$idList = GUICtrlCreateList('', 490, 5, 135, 470)
$cline =_FileCountLines($sPath&'.work') ; i had to add this to make it work for me
For $i = 1 To $cline
    GUICtrlSetData($idList, $aFlowers[$i][0])
Next
$idLblHeader = GUICtrlCreateLabel('Header', 5, 5, 470, 40);,$SS_LEFT)
GUICtrlSetFont(-1, 14, 800)
$idLblBody = GUICtrlCreateLabel('Body', 5, 395, 470, 70);,$SS_LEFT)
GUICtrlSetFont(-1, 10, 400)
$sFlower=_GUICtrlListBox_GetText($idList, 0)
_FindFlowerByName($sFlower)
_GUICtrlListBox_SelectString($idList, $sFlower)
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idList
            $sVal = GUICtrlRead($idList)
            _FindFlowerByName($sVal)
    EndSwitch
WEnd

Func _FindFlowerByName($sFlower)
    Local $iNo = _ArraySearch($aFlowers, $sFlower)
    _FindFlowerByID($iNo)
EndFunc   ;==>_FindFlowerByName

Func _FindFlowerByID($iNo)
    ;ConsoleWrite($iNo & ': '& $aFlowers[$iNo][1]&@CRLF)
    GUICtrlSetData($idLblHeader, $aFlowers[$iNo][0])
    GUICtrlSetData($idLblBody, $aFlowers[$iNo][1])
    If $idPic <> -999 Then GUICtrlDelete($idPic)
    $idPic = GUICtrlCreatePic($aFlowers[$iNo][2], 5, 55, 200, 200)
EndFunc   ;==>_FindFlowerByID

 

Share this post


Link to post
Share on other sites
Jcreator

am really thankful for all your help guys and am sorry for being slow at understanding the answer -.- still trying to learn this 

by the way the 

_FileReadToArray

was really useful and i tried to use it in another part of the script where it will show the flowers information and picture by typing the name of the flower 

script

#include <Misc.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <AVIConstants.au3>
#include <TreeViewConstants.au3>
#include <GuiComboBox.au3>
#include <GuiTab.au3>
#include <file.au3>
#include <array.au3>

Global $sfPath = 'flowers.txt'
Global $aFlowers
_FileReadToArray($sfPath,$aFlowers,$FRTA_NOCOUNT,'|')
_ArrayColDelete($aFlowers,0) ;row 0 has no data so deleting

$Form1 = GUICreate("Search Flower Name",320, 480)
$input = GUICtrlCreateInput("", 60, 360, 209, 25)
$idss = GUICtrlCreateButton("Search", 130, 400, 73, 65)

GUISetState(@SW_SHOW)




Func Searchf()



Global $Fname = GUICtrlRead($input)


        For $iNo = 0 To UBound($aFlowers[0][0]) - 1 ;

           if $Fname = $aFlowers[$iNo][0] then

MsgBox($MB_SYSTEMMODAL, "","Flower nfo", ""& $aFlowers[$iNo][1] &"")

pic()

EndIf
        Next

EndFunc

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE

            Exit
         Case $nMsg = $idss

        Searchf()

    EndSwitch
 WEnd

func pic()
   For $iNo = 0 To UBound($aFlowers[0][0]) - 1
   GUICtrlCreatePic($aFlowers[$iNo][2], 20, 30, 280, 280)
    Next
   EndFunc

 

Share this post


Link to post
Share on other sites
Jcreator

@AutoBert i hope that you dont mind me using your code in a different script

and thanks to @mikell for trying to help too

 

Edited by Jcreator

Share this post


Link to post
Share on other sites
SadBunny

Just a quick off-topic friendly word of advice: use the Tidy tool (Tools -> Tidy AutoIt Source or Ctrl+T). It will format your code to make it much more readable, and while doing that it will also very clearly indicate potential syntax problems. This will assist you in writing proper code and catching problems early. I press it, like, every five seconds (it also saves your code, so for me it's pretty much a Ctrl+S replacement :)).

Also, "tidy"-ing your code before posting here on the forum will also go a long way to make it much easier to read for others.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
Jcreator

^^ @SadBunny thx for the  advice  but i cant seem to find this  Tools -> Tidy AutoIt if it exist 

Share this post


Link to post
Share on other sites
SadBunny

Are you using the full version of the Scite editor? If not, I suggest getting it, it is quite useful :dance:


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
AutoBert
16 hours ago, Jcreator said:

i had to do some changes  the line For $i = 1 To $cline

ups, there was an error the last flower wasn't read. So i had just corrected an edited last post. Here only the snipet to see changes:

_FileReadToArray($sPath&'.work',$aFlowers,$FRTA_COUNT,'|')
$aFlowers[0][2]=$aFlowers[0][1] ;inserted=>saving colcount      
$aFlowers[0][1]=$aFlowers[0][0] ;inserted=>saving rowcount
_ArrayColDelete($aFlowers,0) ;col 0 has no data so deleting

in your func Searchf you are using ubound wrong, must be 

For $iNo = 0 To UBound($aFlowers) - 1 ;

 

Edited by AutoBert

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  

  • Similar Content

    • Trisha
      By Trisha
      Hello,
      I Have clicked on save as option to save a file, while doing that I need to rename a file appending with sysdate. I have searched in google find the below one line of code:
      FileMove("C:\somefile.txt", "C:\somefile1.txt"), When I am trying to append with sysdate. It is not happening. Please help me out  with the small issue.
    • MrCheese
      By MrCheese
      Hi guys,
       
      Wondering, is there a better way, likely to use 'for...next' to add a letter to each range, by moving right -> along a range of columns in excel.
      I currently use this, but its clunky.
      If $run = 1 Then $range = "B6:B41" If $run = 2 Then $range = "C6:C41" If $run = 3 Then $range = "D6:D41" If $run = 4 Then $range = "E6:E41" If $run = 5 Then $range = "F6:F41" If $run = 6 Then $range = "G6:G41" If $run = 7 Then $range = "H6:H41" If $run = 8 Then $range = "I6:I41" If $run = 9 Then $range = "J6:J41" If $run = 10 Then $range = "K6:K41" If $run = 11 Then $range = "L6:L41" If $run = 12 Then $range = "M6:M41" If $run = 13 Then $range = "N6:N41" If $run = 14 Then $range = "O6:O41" If $run = 15 Then $range = "P6:P41" If $run = 16 Then $range = "Q6:Q41" If $run = 17 Then $range = "R6:R41" If $run = 18 Then $range = "S6:S41" If $run = 19 Then $range = "T6:T41" If $run = 20 Then $range = "U6:U41" If $run = 21 Then $range = "V6:V41" If $run = 22 Then $range = "W6:W41" If $run = 23 Then $range = "X6:X41" If $run = 24 Then $range = "Y6:Y41" If $run = 25 Then $range = "Z6:Z41" If $run = 26 Then $range = "AA6:AA41" If $run = 27 Then $range = "AB6:AB41" If $run = 28 Then $range = "AC6:AC41" If $run = 29 Then $range = "AD6:AD41" If $run = 30 Then $range = "AE6:AE41" If $run = 31 Then $range = "AF6:AF41" If $run = 32 Then $range = "AG6:AG41" If $run = 33 Then $range = "AH6:AH41" If $run = 34 Then $range = "AI6:AI41" If $run = 35 Then $range = "AJ6:AJ41" If $run = 36 Then $range = "AK6:AK41" If $run = 37 Then $range = "AL6:AL41" If $run = 38 Then $range = "AM6:AM41" If $run = 39 Then $range = "AN6:AN41" If $run = 40 Then $range = "AO6:AO41" If $run = 41 Then $range = "AP6:AP41" If $run = 42 Then $range = "AQ6:AQ41" If $run = 43 Then $range = "AR6:AR41" If $run = 44 Then $range = "AS6:AS41" If $run = 45 Then $range = "AT6:AT41" If $run = 46 Then $range = "AU6:AU41" If $run = 47 Then $range = "AV6:AV41" If $run = 48 Then $range = "AW6:AW41" If $run = 49 Then $range = "AX6:AX41" If $run = 50 Then $range = "AY6:AY41"  
      Normally, if it was going down the rows, i'd use this:
       
      For $i = 0 To UBound($iRowCount) - 1 $row = $i + 1 $range = "B"&$row&":B"&$row+1 Next  
      so something like this, but i don't know how to code sequential columns:
      For $i = 0 To UBound($iColCount) - 1 $col = $i + 1 $range = $col&"1:"&$col&"40" Next  
      If I don't make sense, let me know.
      Any help would be great. thanks
    • Ascer
      By Ascer
      Hello,
      Do you have any idea to resize Vector graphic using some maths trick?
      It's example to create Vector image 10x10px and write A
      Local $a10x10 = [ _ 1,1,1,1,1,1,1,1,1,1, _ 1,1,1,0,0,0,0,1,1,1, _ 1,1,0,0,1,1,0,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,1,0,0,0,0,0,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,0,0,0,1,1,0,0,0,1, _ 1,1,1,1,1,1,1,1,1,1 _ ] Local $oVector = ObjCreate("WIA.Vector.1") If Not IsObj($oVector) Then ConsoleWrite("+++ Error " & @error & " durning create a Vector.object." & @CRLF) Exit EndIf Local $iBlue = 0xFF0000FF ; ARGB color Local $iWhite = 0xFFFFFFFF ; adding pixels to vector For $i = 0 To UBound($a10x10) - 1 Local $iPixel = $a10x10[$i] Local $iColor = $iBlue If $iPixel = 0 Then $iColor = $iWhite $oVector.Add($iColor) Next ; create a img 10x10 px Local $oImg = $oVector.ImageFile(10, 10) ; path to file Local $sPath = @ScriptDir & "\Vector.bmp" ; delete previous file if exits. FileDelete($sPath) ; save img to script direction. $oImg.SaveFile($sPath) ; show result, you have to use 800% size to see effects. ShellExecute("Vector.bmp")  
    • Ascer
      By Ascer
      1. Description.
      Udf working with MSDN System.Collections.ArrayList. Allow you to make fast operations on huge arrays, speed is even x10 better than basic _ArrayAdd.  Not prefered for small arrays < 600 items. 2. Requirements
      .NET Framework 1.1 - 4.5 (on this version Microsoft destroy old rules) System Windows 3. Possibilities.
      ;=============================================================================================================== ; UDF Name: List.au3 ; ; Date: 2018-02-17, 10:52 ; Description: Simple udf to create System Collections as ArrayList and make multiple actions on them. ; ; Function(s): _ListCreate -> Creates a new list ; _ListCapacity -> Gets a list size in bytes ; _ListCount -> Gets items count in list ; _ListIsFixedSize -> Get bool if list if fixed size ; _ListIsReadOnly -> Get bool if list is read only ; _ListIsSynchronized -> Get bool if list is synchronized ; _ListGetItem -> Get item on index ; _ListSetItem -> Set item on index ; ; _ListAdd -> Add item at end of list ; _ListClear -> Remove all list items ; _ListClone -> Duplicate list in new var ; _ListContains -> Get bool if item is in list ; _ListGetHashCode -> Get hash code for list ; _ListGetRange -> Get list with items between indexs ; _ListIndexOf -> Get index of item ; _ListInsert -> Insert a new item on index ; _ListInsertRange -> Insert list into list on index ; _ListLastIndexOf -> Get index last of item ; _ListRemove -> Remove first found item ; _ListRemoveAt -> Remove item in index ; _ListRemoveRange -> Remove items between indexs ; _ListReverse -> Reverse all items in list ; _ListSetRange -> Set new value for items in range ; _ListSort -> Sort items in list (speed of reading) ; _ListToString -> Get list object name ; _ListTrimToSize -> Remove unused space in list ; ; Author(s): Ascer ;=============================================================================================================== 4. Downloads
      List.au3 5. Examples
      SpeedTest _ArrayAdd vs ListAdd SpeedTest ArraySearch vs ListIndexOf Basic usage - crating guild with members  
    • nacerbaaziz
      By nacerbaaziz
      can we  create a list box with  Columns?
      welcome everybody
      Dears I have a question if you let me
      can we  create a list box with  Columns?
      i know we can create a list view with Columns
      but my question is about the list box
      I'm waiting your responses
      Thank you in advance
×