Search the Community

Showing results for tags 'list'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Chat
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 39 results

  1. So I having issues with this GUI/Listview. My main GUI works like it needs to but the ListView GUIs don't. The exit buttons do not work on them and om have a hard time getting them to work. And I'm trying to make the listview GUI resizeable. But I'm not sure how to fix either of these issues any thoughts. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <ScreenCapture.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <ListviewConstants.au3> #include 'MultiPing.au3' Opt("GUIOnEventMode", 1) #Region ;Declares ; Reads text file for the base list of IP's Global $aBase_IPlist = _FileReadToArray_mod(".\IP_List.txt") Global $replace2 = "Second" Global $replace3 = "Thrid" ;Global $userdata1 = GUICtrlRead($data1) ;Global $userdata2 = GUICtrlRead($data2) Global $savefolder = "C:\Users\" Global $paths = "\Desktop\PingChecks" Global $1stpaths = "\~~~Store" Global $2ndpaths = "~~~" Global $results = FileExists($savefolder & @UserName & $paths) ;Global $foldercheck = FileExists($savefolder & @UserName & $paths & $1stpaths & $userdata1 & $userdata2 & $2ndpaths) ;Global $savefile = "C:\Users\" & @UserName & "\Desktop\PingChecks\~~~Store" & $userdata1 & $userdata2 & "~~~\" #EndRegion ;Declares #Region ### START Koda GUI section ### Form= $IPMonkey = GUICreate("IP Monkey", 573, 254, -1, -1) GUISetIcon("C:\Users\Dlex\Pictures\monkeyicon.ico", -1) GUISetFont(16, 800, 0, "Arial") GUISetBkColor(0xFFFFFF) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents") $data1 = GUICtrlCreateInput("1", 184, 120, 89, 32, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER)) GUICtrlSetColor(-1, 0x000000) $data2 = GUICtrlCreateInput("23", 280, 120, 89, 32, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER)) GUICtrlSetColor(-1, 0x000000) $GOButton = GUICtrlCreateButton("GO", 80, 192, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "Arial") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetTip(-1, "Runs A Live Continuous Ping" & @CRLF & _ "Until Told Other Wise") GUICtrlSetOnEvent(-1, "GOButtonClick") $quickscan = GUICtrlCreateButton("Quick Scan", 224, 192, 107, 25) GUICtrlSetFont(-1, 12, 800, 0, "Arial") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xFFFF00) GUICtrlSetOnEvent(-1, "quickscanClick") GUICtrlSetTip(-1, "Quickly Scans, Then Saves" & @CRLF & _ "Results In Your 'PingChecks' " & @CRLF & _ "Folder Under Your Store Number Folder") Global $exitbutton = GUICtrlCreateButton("Exit", 416, 192, 75, 25) GUICtrlSetFont(-1, 12, 800, 0, "Arial") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetTip(-1, "What Do You Think This Button Does?") GUICtrlSetOnEvent(-1, "exitbuttonClick") $titlebar = GUICtrlCreateLabel("IP Monkey", 16, 120, 107, 28) GUICtrlSetColor(-1, 0x000000) $Pic1 = GUICtrlCreatePic("C:\Users\Dlex\Pictures\monkeyicon-0.jpg", 16, 16, 100, 100) GUICtrlSetOnEvent(-1, "Pic1Click") $infobutton = GUICtrlCreateButton("?", 536, 8, 27, 25) GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xFF8000) GUICtrlSetTip(-1, "Unsure what to do?" & @CRLF & _ "This will get give you " & @CRLF & _ "the help for IP Monkey") GUICtrlSetOnEvent(-1, "infobuttonClick") $Whatstorelabel = GUICtrlCreateLabel("What Store?", 208, 56, 130, 28) GUICtrlSetColor(-1, 0x000000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### #Region ;ping gui ; ------ pinger GUI ------------------- Global $StopPing = 0 Local $Win_X = 1200, $Win_Y = 880 ; dimension of window Global $PingGui = GUICreate("IP Monkey", $Win_X, $Win_Y, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") Global $listview = GUICtrlCreateListView("", 10, 10, $Win_X - 20, $Win_Y - 40) GUICtrlSetFont(-1, 8) $button1 = GUICtrlCreateLabel("Hit Exit To Quit", 10, $Win_Y - 25, $Win_X - 20, 20, -1,$ES_CENTER) GUICtrlSetFont(-1, 10, 800) GUICtrlSetTip(-1, "exit") GUICtrlSetOnEvent(-1, 'SpecialEvents') GUICtrlSetStyle($listview, $LVS_ICON) ; + $LVS_NOLABELWRAP) GUISetState(@SW_HIDE) ; hidden at startup ; --------- end of pinger gui ------------- #EndRegion ;ping gui ; Generate colored square images $hImage = _GUIImageList_Create(30, 30) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFFFF00, 30, 30)) ; yellow _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFF0000, 30, 30)) ; red _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x00FF00, 30, 30)) ; green _GUICtrlListView_SetImageList($listview, $hImage, 0) While 1 Sleep(100) WEnd Func exitbuttonClick() MsgBox(0,'0','0') Exit EndFunc ;==>exitbuttonClick Func GOButtonClick() $userdata1 = GUICtrlRead($data1) $userdata2 = GUICtrlRead($data2) ; pass the wanted new octet replace_And_Go($userdata1, $userdata2) ; generate a list of new IP and Go EndFunc ;==>GOButtonClick Func infobuttonClick() EndFunc ;==>infobuttonClick Func Pic1Click() EndFunc ;==>Pic1Click Func quickscanClick() $userdata1 = GUICtrlRead($data1) $userdata2 = GUICtrlRead($data2) replace_And_Go2($userdata1, $userdata2) EndFunc ;==>quickscanClick Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE _button1() Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE Case @GUI_CtrlId = $GUI_EVENT_RESTORE Case @GUI_CtrlId = $GUI_EVENT_MAXIMIZE EndSelect EndFunc ;==>SpecialEvents #Region ; Main_GO/Replace_and_GO #cs ############################## second script ############################################# ; this is to ping continuously a list of IP addresses, get and display ping result "live" ; it simulates the dos "ping -t" command but performed simultaneously on many IP ; presenting the results in a ListView highlighting not responding devices with a red box #ce Func replace_And_Go($s_2, $s_3) ; Create a new array wit a new list of IP according to passed second and third octet Local $aNew_IPlist = $aBase_IPlist For $i = 0 To UBound($aNew_IPlist) - 1 $aNew_IPlist[$i][1] = StringReplace(StringReplace($aBase_IPlist[$i][1], $replace2, $s_2), $replace3, $s_3) Next GUISetState(@SW_HIDE, $IPMonkey) GUISetState(@SW_SHOW, $PingGui) ; pass the new list to the pinger Main_GO($aNew_IPlist) GUISetState(@SW_HIDE, $PingGui) GUISetState(@SW_SHOW, $IPMonkey) EndFunc ;==>replace_And_Go Func Main_GO($IPlist) HotKeySet("{esc}", "exitbuttonClick") $StopPing = 0 ; $IPlist = _FileReadToArray_mod(".\IP_List.txt") ; Reads text file for list of IP's ; ; the above command, it loads in the $IPlist array the values contained in the file IP_List.txt ; values in the file should be separated by a semicolon, something like in the following example: ; ; hostname1;192.168.0.1 ; hostname2;192.168.0.5 ; hostnameX;10.59.7.200 ; etc.... ; ; if values in the file are not separated by a semicolon, but another char is used, for example a comma, ; then just pass it as second parameter of the function: $IPlist = _FileReadToArray_mod(".\IP_List.txt", ",") ; _GUICtrlListView_BeginUpdate($listview) _GUICtrlListView_DeleteAllItems($listview) _GUICtrlListView_AddArray($listview, $IPlist) ; fill ListView _GUICtrlListView_EndUpdate($listview) While Not $StopPing ; 1 ; continuously ping addresses of the previously loaded file (IP_List.txt) Sleep(10) ; ; $IPlist is the array loaded with all the IP to be pinged (a 2d array in this case) ; | ; | 1 means the IP are in the second column of the $IPlist array (first colun is nr. 0) ; | | ; | | +--> 0 means return back an array loaded with results from all pinged addresses (responding and not responding) ; | | | if you use 1 then only responding addresses are loaded in the returned array [default] ; | | | if you use 2 then only NOT responding addresses are loaded in the returned array ; | | | In this case we do not need an array to be returned, we only need to perform all pings and pass results ; | | | directly (on the fly) to the "_refresh" callback function that will refresh the listview ; | | | ; | | | 0 means NO lookup name resolution must be performed ; | | | | ; | | | | +--> this is the callback function to be called for each pinged address each time the ping has finished ; | | | | | (see the MultiPing.au3 file for info on all passed params) ; | | | | | 6 parameters are passed to this function, but only 2 are used by the called function in this case: ; | | | | | [4] roundtrip of the responding ping or -1 if IP is down ; | | | | | [5] Index (position) of this IP within the caller's passed array ; | | | | | ; v v v v v _nPing($IPlist, 1, 0, 0, "_refresh") WEnd EndFunc ;==>Main_GO #EndRegion ; Main_GO/Replace_and_GO #Region ; QuickScan/Replace_and_GO2 Func replace_And_Go2($s_2, $s_3) ; Create a new array wit a new list of IP according to passed second and third octet Local $aNew_IPlist = $aBase_IPlist For $i = 0 To UBound($aNew_IPlist) - 1 $aNew_IPlist[$i][1] = StringReplace(StringReplace($aBase_IPlist[$i][1], $replace2, $s_2), $replace3, $s_3) Next GUISetState(@SW_HIDE, $IPMonkey) GUISetState(@SW_SHOW, $PingGui) ; pass the new list to the pinger QuickRun($aNew_IPlist) GUISetState(@SW_HIDE, $PingGui) GUISetState(@SW_SHOW, $IPMonkey) EndFunc ;==>replace_And_Go2 Func QuickRun($IPlist) $userdata1 = GUICtrlRead($data1) $userdata2 = GUICtrlRead($data2) HotKeySet("{esc}", "_button1") Local $Win_X = 1200, $Win_Y = 880 ; dimension of window $PingGui = GUICreate("IP Monkey" & "~~~" & @UserName & "~~~" & "Store" & $userdata1 & $userdata2 & "~~~" & @MON & "." & @MDAY & "." & @YEAR & "~~~" & @HOUR & "." & @MIN, $Win_X, $Win_Y, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_button1", $PingGui) $listview = GUICtrlCreateListView("", 10, 10, $Win_X - 20, $Win_Y - 40) GUICtrlSetFont(-1, 8) GUICtrlSetStyle($listview, $LVS_ICON) ; + $LVS_NOLABELWRAP) ; Generate colored square images $hImage = _GUIImageList_Create(30, 30) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFFFF00, 30, 30)) ; yellow _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFF0000, 30, 30)) ; red _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x00FF00, 30, 30)) ; green _GUICtrlListView_SetImageList($listview, $hImage, 0) $button1 = GUICtrlCreateButton("Exit", 10, $Win_Y - 25, $Win_X - 20, 20) GUICtrlSetTip(-1, "End of program") GUICtrlSetOnEvent(-1, "exitbuttonClick") GUISetState(@SW_SHOW) ;~ $IPlist = _FileReadToArray_mod(".\IP_List.txt") ; Reads text file for list of IP's _GUICtrlListView_BeginUpdate($listview) _GUICtrlListView_AddArray($listview, $IPlist) ; fill ListView _GUICtrlListView_EndUpdate($listview) ;While 1 ; perform Pings and update ListView by the "_refresh" callback function $aFinalResult = _nPing($IPlist, 1, 0, 0, "_refresh") ;~ _ArrayDisplay($aFinalResult) ;DirCheck() EndFunc ;==>QuickRun #EndRegion ; QuickScan/Replace_and_GO2 #Region ; Misc Funcs (network) Func _refresh($Params) ; this receive ping results and displays them in the ListView _GUICtrlListView_SetItemImage($listview, $Params[5], 0) ; set colour to Yellow Sleep(50) ; a little wait If $Params[4] = -1 Then ; Device not responding to ping _GUICtrlListView_SetItemImage($listview, $Params[5], 1) ; set colour to RED _GUICtrlListView_EnsureVisible($listview, $Params[5]) ; Position view to this item Else ; Device responds to ping _GUICtrlListView_SetItemImage($listview, $Params[5], 2) ; set colour to GREEN EndIf EndFunc ;==>_refresh Func _button1() ; Button 1 clicked ;~ $StopPing = 1 Exit EndFunc ;==>_button1 #EndRegion ; Misc Funcs (network) MultiPing.au3 IP_List.txt
  2. Hello everyone ! I was looking for a parameter to set a List. Not a ComboList in ReadOnly. I've already found a topic about The readonly on a ComboList : But nothing on List Does someone know how to ?..
  3. I am trying to read all the files in a folder, then whatever file is newest, keep only that one and delete the rest. Example files: (these all have version numbers embedded in them, I dont want to rely on the file name) Faint.exe Faint-v2.0.exe Faint-v3.0.exe Faint-v4.0.exe What I have so far: #include <File.au3> RemoveOldFiles() ConsoleWrite(FileGetVersion("C:\WB Resources\FAINT_DONT_LINK_THESE\Faint-v4.0.0.exe") &@CRLF) Func RemoveOldFiles() Local $aFileList = _FileListToArray("C:\WB Resources\FAINT_DONT_LINK_THESE\", "*.exe",$FLTA_FILES) For $i = 0 To UBound($aFileList) - 1 $aFileVersion = FileGetVersion($aFileList[$i]) ConsoleWrite($aFileList[$i] & @CRLF) ConsoleWrite($aFileVersion & @CRLF) Next EndFunc OUTPUT: >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\bot\ownCloud\WellBeats\Delete Old Files\delete-test.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop 3 0.0.0.0 a.exe 0.0.0.0 b.exe 0.0.0.0 Faint-v4.0.0.exe 0.0.0.0 4.0.0.18 <-- This is the correct file version.... +>07:34:26 AutoIt3.exe ended.rc:0 +>07:34:26 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.6647 Not sure what I am missing here? Thanks!
  4. Hi! I want to send by mail some files with a certain extension (.xml in my case). These files are located in the script folder. First, I thought to use _FileListToArrayRec function to have a list of these files. But than I don't know how to send them all at once. I know that I can attach multiple files in this way: path1;path2;path3; etc. and so I have tried to make a string of this type with the path of the files (with a for loop) but It doesn't attach any file (only instructions.txt). How could I do? ( what I did is just an idea, if there's something better that would be great) Thanks! $aArrayXml = _FileListToArrayRec(@ScriptDir, "*.xml", $FLTAR_FILES) _ArrayDisplay($aArrayXml, "LIST XML") $LenghtArrayXml = UBound($aArrayXml) If ($LenghtArrayXml > 2) Then For $i = 2 To $LenghtArrayXml - 1 $temp = "&@ScriptDir&""\"&$aArrayXml[$i]&";"&"""" $XmlListFile = $XmlListFile & $temp Next EndIf $XmlListFile = StringTrimLeft($XmlListFile, 1) if($LenghtArrayXml = 2)Then $rc =_INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ScriptDir&"\"&$aArrayXml[1]&";"&@ScriptDir&"\instructions.txt", $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl) Else $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ScriptDir&"\"&$aArrayXml[1]&$XmlListFile&@ScriptDir&"\instructions.txt", $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl) EndIf
  5. I'd just like to find an example of a multi select list box that outputs the selections to a file. Finding lots of complex examples in examples folder and cannot find and simple ones. like simple single select list box. I'm trying to put together a selection criteria. where listbox 1 has a list of environment names - when selected it will open up another control (overlay is good to cover first GUI) it then lists Applications. When selected I will use the selection to list some items from excel as a multi select list box. So are there simple examples of these that i can look at and use to create a gui that I can understand? Joe
  6. 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.
  7. 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 i wish some one can help me fix this without having to choose the images manually and i know that the script is messy but am still new in the world of autoit some bear with me . thanks for your time
  8. At my work I was creating a music player (truly the project is bigger than it but it doesn't come to the case right now) and, given some conditions, it should start playing songs randomly. I've used Random() function to sort any song from the list, but the "random wasn't so random" sometimes, and some songs used to repeat multiple times, although the song list wasn't so small. So I needed to keep a list of all the played songs. However, I couldn't feed up an array forever as this system I'm working on is meant to work 24/7 with no pause and the array could really reach huge values, while just the latest X values would really be used (to check if a random song was played recently before playing it). So I managed to create this simple stack/buffer/heap script. It works just like Assembly stacks (although the target is totally different). You'll have an array, you can define its max size and start adding items into it. Once the array limit is reached, the first added item is automatically removed, all the other items are reindexed and your new item will then be added. You can also change the array (stack) limit at any time, reset it as well as pull/remove or read the last added item. In the best Assembly stack way, you shouldn't be able to read all the items, except the last added item. But, well, we are talking about AutoIt arrays. It's just a list, where the 0 index brings the actual items count. This means you can easily create loops and read the array as you want (just be very careful if you want to modify the array without _Buffer* functions). It's also useful if you want to generate random values with Random() with repeating values, but they're repeating more than you want (instead of "1-2-2-2-3-1-2-3-4" you would have "1-3-2-4-3-1-2-4" - the values would only start repeating after it's too long since they were generated in last). Here's an example: #inclcude 'buffer.au3' ; the lib #include <Array.au3> ; needed only to do _ArrayDisplay ; Example 1 $aBuffer = _BufferCreate(3) _BufferPush($aBuffer, 12) _BufferPush($aBuffer, 23) _BufferPush($aBuffer, 34) _BufferPush($aBuffer, 45) MsgBox(0, '', _BufferPull($aBuffer)) ; 45 (and remove it) _BufferPush($aBuffer, 56) _BufferPush($aBuffer, 67) _ArrayDisplay($aBuffer) ; Example 2 $aBuffer = _BufferCreate(3) _BufferPush($aBuffer, 12) _BufferPush($aBuffer, 23) _BufferPush($aBuffer, 34) _BufferPush($aBuffer, 45) _BufferChangeLimit($aBuffer, 6) _BufferPush($aBuffer, 56) _BufferPush($aBuffer, 67) _ArrayDisplay($aBuffer) MsgBox(0, "", "Buffer items count: " & _BufferItemsCount($aBuffer) & @CRLF & "Buffer max size: " & _BufferLimit($aBuffer) & @CRLF & "Last item (without pulling/removing it): " & _BufferGetLastItem($aBuffer)) ; Example 3 $aBuffer = _BufferCreate(3) _BufferPush($aBuffer, 'ab') _BufferPush($aBuffer, 'cd') _BufferPush($aBuffer, 'ef') _BufferPush($aBuffer, 'gh') _ArrayDisplay($aBuffer) _BufferReset($aBuffer) _ArrayDisplay($aBuffer) ; Example 4 $aBuffer = _BufferCreate(2) _BufferPush($aBuffer, 'Song 1') _BufferPush($aBuffer, 'Music 2') _BufferPush($aBuffer, 'Hit 3') If _BufferCheckValue($aBuffer, 'Song 1') Then ; False MsgBox(0, "", "Song 1 was played too recently.") EndIf If _BufferCheckValue($aBuffer, 'Music 2') Then ; True MsgBox(0, "", "Music 2 was played too recently.") EndIf The lib source code: #include-once #cs Buffer/stack/heap UDF made by Jefrey <jefrey[at]jefrey.ml> Licensed under WTFPL: http://www.wtfpl.net/txt/copying/ #ce ; Creates a new buffer ; Arguments: $iSize - size of the buffer (limit) Func _BufferCreate($iSize) Local $aBuffer[$iSize+1] $aBuffer[0] = 0 Return $aBuffer EndFunc ; Adds an item to the buffer ; If the buffer limit was reached, then the first item will be removed. ; Arguments: $aBuffer - buffer to change (reference) / $mItem - item to add Func _BufferPush(ByRef $aBuffer, $mItem) If $aBuffer[0]+1 > UBound($aBuffer)-1 Then ; remove first item and reindex $aBuffer[1] = Null For $i = 2 To $aBuffer[0] $aBuffer[$i - 1] = $aBuffer[$i] Next Else $aBuffer[0] += 1 EndIf $aBuffer[$aBuffer[0]] = $mItem Return $aBuffer EndFunc ; Removes the last added item of the buffer and returns its value ; Arguments: $aBuffer - buffer to change (reference) Func _BufferPull(ByRef $aBuffer) If $aBuffer[0] = 0 Then Return $mReturn = $aBuffer[$aBuffer[0]] $aBuffer[$aBuffer[0]] = Null $aBuffer[0] -= 1 Return $mReturn EndFunc ; Returns the actual items count (how many items were added to the buffer, and not its limit) ; Arguments: $aBuffer - the buffer Func _BufferItemsCount($aBuffer) Return $aBuffer[0] EndFunc ; Returns the actual items count (how many items were added to the buffer, and not its limit) ; Arguments: $aBuffer - the buffer Func _BufferGetLastItem($aBuffer) Return $aBuffer[$aBuffer[0]] EndFunc ; Returns the buffer limits (that were set by you) ; Arguments: $aBuffer - the buffer Func _BufferLimit($aBuffer) Return UBound($aBuffer)-1 EndFunc ; Changes a buffer limit ; Arguments: $aBuffer - the buffer to change / $iSize - new buffer size Func _BufferChangeLimit(ByRef $aBuffer, $iSize) ReDim $aBuffer[$iSize + 1] Return $aBuffer EndFunc ; Resets a buffer (removes all items) ; Arguments: $aBuffer - the buffer to change Func _BufferReset(ByRef $aBuffer) Local $j = UBound($aBuffer)-1 For $i = 1 To $j $aBuffer[$i] = Null Next $aBuffer[0] = 0 EndFunc ; Checks if a value exists in a buffer ; Returns: 0 if not found or index (>0) of where it was found Func _BufferCheckValue($aBuffer, $mValue) If Not $aBuffer[0] Then Return 0 For $i = 1 To $aBuffer[0] If $aBuffer[$i] = $mValue Then Return $i Next Return 0 EndFunc
  9. Hi, I have written a programm offering me a lot of hotkeys to work with windows. All in all there are 40 hotkeys defined now. Now I made a portable version of it. But in this there are a lot of hotkeys useless. So I had to change some things. But that's not my point. Because of all these many hotkeys I sometimes know I made a hotkey but what were the keys I have to press. So I want to make a little help GUI or html or whatever. Now I'm interested to automate my own list of hotkeys. How can I collect all my hotkeys and necessary keys for this in a list? Regard, Conrad
  10. Hello everybody, i've spent hours to google and find out how to get content of scrollable list view of our CMS Software... i checked it with the "AutotIT window info" tool, but the only things I get are this: Class: Qt5QWindowIcon Instance: 18 but how can I get list contents of a class like that? I was using AutoIT couple a months ago (but it was a ListView32 box) <-- was easy Thanks for any hints... Rickey P.S: I also checked the AutoIT Editors help pages (Keywords: "Qt5QWindowIcon" "Qt5Q", nut cant find nothing... Thanks!
  11. Hi Everyone, Happy New Year Well, I have a script that gather information about a given switch here at work that output data in a txt file: What I'd like to do first is to put the file in a list view with the possibility to sort the ports by VLAN, by ports or by Status (and also delete all that concern Duplex / Speed / Type). In a second time, I'd like to bold and color "connected" in green / "disconnected" in red and "err-disabled" in gray. Then, I'd like also to apply a certain color depending on the VLAN number (I have the list of them). And to finish (sorry ^^) when I double click on a list item, I'd like to retrieve information of the selected line for me to do some operation on it. I know this is quite an ask but this is something I don't know how to (don't worry, I've done some researches before) do and also, I'm not familiar with arrays at all. Many thanks for those who can help I've uploaded the output txt file: EPES18.txt
  12. How can I get a list of all the headings in a Microsoft Word document by using AutoIt? I tried: #include <Word.au3> #include <MsgBoxConstants.au3> Global Const $wdRefTypeHeading = 1 ; Heading $Headings = $oDoc.GetCrossReferenceItems($wdRefTypeHeading) $Count = UBound($Headings) MsgBox($MB_SYSTEMMODAL, "Debug", $Count) But it did not function well.. For example, it just get 1 heading from my rich document that have many headings! I also tried this: #include <Word.au3> #include <MsgBoxConstants.au3> $Count = $oDoc.Paragraphs.Count For $i = 0 To $Count - 1 $oRange = _Word_DocRangeSet($oDoc, -1, $wdParagraph, $i, $wdParagraph, 1) If StringInStr($oRange.text, "Header Text") Then MsgBox($MB_SYSTEMMODAL, "Debug", $oRange.Style) EndIf Next And this: #include <Word.au3> #include <MsgBoxConstants.au3> $Count = $oDoc.Paragraphs.Count For $i = 0 To $Count - 1 $oRange = _Word_DocRangeSet($oDoc, -1, $wdSentence, $i, $wdSentence, 1) If StringInStr($oRange.text, "Header Text") Then MsgBox($MB_SYSTEMMODAL, "Debug", $oRange.Style) EndIf Next But the Range.Style property didn't work in AutoIt.. Could someone help me how to get a list of all the headings in a Word document?
  13. Been using GUICtrlCreateList for the first time in the last few days and am wondering for how many currently perceived shortcomings I am still to blame... Been scanning some of the special settings here and there, but currently still wondering about these... Even "yes" or "no" can be helpful. More is welcome if it saves me some hours 1) When wanting to hilite a List item with the help of GUICtrlSetData ( $myList, data, $hiliteThisItem ), my impression is that this is not case sensitive? If not, can this be set to be so? [solved, if *not* using $LBS_EXTENDEDSEL only?] 2) Is it possible to have right-clicking an item also immediately making it the active item (highlight it)...? 3) Is manually dragging items for custom sorting possible? 4) While using my scroll wheel inside a List, I've been hearing some beeps, as if it wanted to tell me when I got to the edge of either end. However, it does not seem to work consistently and I don't want these sounds anyway. Are they from AutoIt and can I disable them? 5) Is it possible to multi-select items? (à la Ctrl-click) [solved with $LBS_EXTENDEDSEL] 6) [non-List question] Is it possible that using the Return key inside a GUICtrlCreateInput field activates a Function? Thanks for any tips!
  14. Hello, I want get the items of a table. The table is in a window of an deskpot application. I hava upload a image of the table. I want read the values of all items and columns for I select the item that I am finding. I have used ListBox and ListView methods and I get the number of items but I can't get the text of columns and I can`t select one item. Can you help me? Thank you.
  15. Hi, i have problem to get all files from server in list, it say in help file that u can get data from current session but it wont work #RequireAdmin #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIListBox.au3> #include <GUIListView.au3> #include <FTPEx.au3> #include <Array.au3> #Region ### START Koda GUI section ### $GUI = GUICreate("FTP tool", 754, 613, 691, 157) GUICtrlCreateLabel("Host", 16, 16, 26, 17) GUICtrlCreateLabel("Port", 192, 16, 23, 17) GUICtrlCreateLabel("Username", 16, 56, 52, 17) GUICtrlCreateLabel("Password", 16, 88, 50, 17) GUICtrlCreateLabel("Status : ", 8, 152, 43, 17) $status = GUICtrlCreateLabel("Not connected", 52, 152, 221, 17) $host = GUICtrlCreateInput("", 48, 12, 121, 21) $port = GUICtrlCreateCombo("", 224, 12, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "21|80") $username = GUICtrlCreateInput("", 79, 52, 121, 21) $password = GUICtrlCreateInput("", 79, 81, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) $connectBtn = GUICtrlCreateButton("CONNECT", 56, 192, 75, 25) $disconnectBtn = GUICtrlCreateButton("DISCONNECT", 143, 192, 107, 25) $List = GUICtrlCreateList("", 16, 240, 721, 340, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### If GUICtrlRead($status) = 'Not connected' Then GUICtrlSetState($disconnectBtn, $GUI_DISABLE) ; disable disconnect button if not connected GUICtrlSetData($port, '21') ; default port Global $status, $host, $port, $username, $password, $FTPopen, $FTPConnect, $List While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $connectBtn _connectFTP() Case $disconnectBtn _disconnectFTP() EndSwitch WEnd ; connection to FTP server Func _connectFTP() Local $_host = GUICtrlRead($host) ; host name Local $_username = GUICtrlRead($username) ; username Local $_password = GUICtrlRead($password) ; password Local $_port = GUICtrlRead($port) ; port Local $FTPopen = _FTP_Open('FTP connection test') ; name of connection Local $FTPConnect = _FTP_Connect($FTPopen, $_host, $_username, $_password, '', $_port) ; connect ; try to connect to server If Not @error Then ; if not error GUICtrlSetData($status, 'Connected') ; set status to connected GUICtrlSetState($connectBtn, $GUI_DISABLE) ; disable connect button GUICtrlSetState($disconnectBtn, $GUI_ENABLE) ; enable disconnect button _listData() Else MsgBox(48, 'FTP connection error', "Can't connect to server, error = " & @error) ; if there is connection error EndIf EndFunc ; disconnect from FTP server Func _disconnectFTP() _FTP_Close($FTPopen) _FTP_Close($FTPConnect) GUICtrlSetState($disconnectBtn, $GUI_DISABLE) GUICtrlSetState($connectBtn, $GUI_ENABLE) GUICtrlSetData($status, 'Not connected') _GUICtrlListBox_ResetContent($List) EndFunc ; list all files on FTP server Func _listData() ; get current dir on server $FTPdirData = _FTP_DirGetCurrent($FTPopen) ; Add files in list box _GUICtrlListBox_BeginUpdate($List) _GUICtrlListBox_ResetContent($List) _GUICtrlListBox_Dir($List, "", $FTPdirData, False) _GUICtrlListBox_EndUpdate($List) EndFunc
  16. Hello all! With your help I have been able to conquer every problem I've faced thus far in using AutoIt, but I've come across something that I 1) don't fully understand and 2) am not sure how to even begin tackling. I have the following list box in a GUI that I am trying to automate that I cannot read any data from. I have discussed this in a previous thread and tried several solutions, but the conclusion was that OCR would probably be the best way to go. You can see the list info and the list box(the data has been edited out) below: I need to find a way to view the data in the list box and choose the user parameter(in this case, the correct library). There will also be instances where I will simply need to get data from another list and validate it it. I believe the major issue is that the list is populated at runtime(this was discussed in a previous thread) and that is why I cannot directly access the data in the list. I have viewed both of these threads: but am not able to full grasp how I should be using either of them. Unfortunately this means that I also don't really have a script to post at this point in time either. If anyone that has experience with this can help me out or point me in the right direction, that would be a huge help. This is the last piece of the puzzle for me and it has absolutely driven me crazy I am trying to incorporate everything into AutoItx4Java, but am prepared to run an executable for these portions if necessary. Thanks in advance for any help you might be able to give! I will do my best to get back to you with any questions as soon as I can.
  17. Hello, i was wondering how i would go about opening a random URL from a predefined list? i am trying to create a small game for the kids, where they have a question and they have to find out the answer (finish the story) from the pages that open...but i need all the pages to be at random, so they need to work out which part comes first, second, third...etc. the code i use to open the URL is and to close the browser: shellexecute("THE URL") If ProcessExists("firefox.exe") Then ProcessClose("firefox.exe") endif is it possible to creaet like a shellexecute("$random") and then add my url's as a ranodm variables? or would it be better to add each script with URL / porcessclose and randomly pick which "url" to open? all help much appreciated MrYonG
  18. I have been trying to get this to work in my script...after creating an example script to ask a question, my original reason for writing the example was resolved. But I then found another issue that I am having trouble figuring out. What I want is a combo list that is dynamic. I want the list to remove items that have been selected, and add items that have been changed. I have am still trying to resolve, but thought I would post it and see if I can get an answer. ; example of removing combo items, and updating the combo list for all remaining combos - including those that already have been asigned #include <GUIConstantsEx.au3> #include <array.au3> Global $aComboList[16], $ahCombo[16], $iCount = 0 ; create the value of the combo list - using array to create values For $x = 1 To UBound($aComboList) - 1 $aComboList[$x] = $x Next ;_ArrayDisplay($aComboList) Global $aTempArray = $aComboList ; convert the array into a string that can be used on a combo control Global $sComboString = _ArrayToString($aComboList) ; create the gui Global $hGUI = GUICreate('Combo Remove Test', 250, 475) ; create the combos For $x = 1 To UBound($ahCombo) - 1 If $x = 1 Then $ahCombo[$x] = GUICtrlCreateCombo('', 10, 10) GUICtrlSetData(-1, $sComboString) Else $ahCombo[$x] = GUICtrlCreateCombo('', 10, 10 + $iCount) GUICtrlSetData(-1, $sComboString) EndIf $iCount += 30 Next ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; main loop While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop ; check if values have been updated in on the combo controls For $x = 1 To UBound($ahCombo) - 1 If $ahCombo[$x] = $msg Then RemoveIndex($ahCombo[$x]) ; delete the value from the string, so it cannot be used in other combos EndIf Next WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) Func RemoveIndex($hItem) ;_GUICtrlComboBox_GetList (not being used) Local $sTempComboValue = '' Local $sComboListTemp ConsoleWrite('Removing Item from Array - ' & GUICtrlRead($hItem) & @CRLF) For $x = UBound($aTempArray) - 1 To 0 Step -1 If GUICtrlRead($hItem) = $aTempArray[$x] Then _ArrayDelete($aTempArray, $x) ; ExitLoop EndIf Next ;_ArrayDisplay($aTempArray) ; update all combos to the new string $sComboListTemp = _ArrayToString($aTempArray) For $x = 0 To UBound($ahCombo) - 1 If GUICtrlRead($ahCombo[$x]) = '' Then ; if nothing has been selected, update with new combo list for future selection GUICtrlSetData($ahCombo[$x], '') GUICtrlSetData($ahCombo[$x], $sComboListTemp) ElseIf GUICtrlRead($ahCombo[$x]) <> '' Then ; if value already exist then keep value $sTempComboValue = GUICtrlRead($ahCombo[$x]) ; set new combo list for this item For $y = UBound($aTempArray) - 1 To 0 Step -1 If $aTempArray[$y] = '' Then _ArrayDelete($aTempArray, $y) $sComboListTemp = _ArrayToString($aTempArray) EndIf Next ; need a way to add the value back, if there was an item removed from selection for the calling control, and it is not being used elsewhere #cs ;If Not StringInStr($sComboListTemp, $sTempComboValue) Then $sComboListTemp &= '|' & $sTempComboValue ; check for selected value being used, if it is not being used, then reinsert Local $sNewComboList = '' For $z = 1 To UBound($ahCombo) - 1 If $z = UBound($ahCombo) - 1 Then ExitLoop $sNewComboList &= GUICtrlRead($ahCombo[$z]) & '|' Next Local $aNewComboList = StringSplit($sNewComboList, '|', 2) ;_ArrayDisplay($aNewComboList) ; Compare the strings $sNewComboList &= $sComboListTemp & $sComboString $aTempArray = _ArrayUnique($aNewComboList) _ArrayDisplay($aTempArray) _ArrayAdd($aTempArray, '') $sNewComboList = _ArrayToString($aTempArray) #ce GUICtrlSetData($ahCombo[$x], '') GUICtrlSetData($ahCombo[$x], $sTempComboValue & '|' & $sComboListTemp, $sTempComboValue) ;GUICtrlSetData($ahCombo[$x], $sTempComboValue & '|' & $sNewComboList, $sTempComboValue) ;GUICtrlSetData($ahCombo[$x], $sNewComboList, $sTempComboValue) EndIf Next EndFunc ;==>RemoveIndex
  19. Thanks to the help of a couple forum members I got a web png loaded onto a button. I also want to do this with an image list. *Jump to the last code snippet (Slim Version) if you want to just see what I have so far. Here is a basic example image list that works from locally stored bmp files. I would like to replace the bitmaps with jpegs or png's from the internet: #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Example() Func Example() Local $idListview, $hImage Local $sWow64 = "" If @AutoItX64 Then $sWow64 = "\Wow6432Node" Local $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Advanced\Images" GUICreate("ImageList AddBitmap", 400, 300) $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW) ; Load images $hImage = _GUIImageList_Create(16, 32) _GUIImageList_AddBitmap($hImage, $sPath & "\Red.bmp") _GUICtrlListView_SetImageList($idListview, $hImage, 1) ; Add columns _GUICtrlListView_AddColumn($idListview, "Items", 120) ; Add items _GUICtrlListView_AddItem($idListview, "Item 1", 0) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example I tried integrating code from the working button example below that grabs a png file #include <GDIplus.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> _GDIPlus_Startup() Global $myImage = "http://icons.iconarchive.com/icons/hopstarter/soft-scraps/64/User-Administrator-Blue-icon.png" Global $GDIbmpLarge = _GDIPlus_BitmapCreateFromMemory(InetRead($myImage), 1) ;this is a GDI bitmap Global $GDIplusLarge = _GDIPlus_BitmapCreateFromHBITMAP($GDIbmpLarge) ;convert GDI to GDIPlus bitmap Global $hGUI = GUICreate("Bitmap from inet", 540, 396, -1, -1) GUISetBkColor(0xFFFFFF) Global $iBtnL = GUICtrlCreateButton("", 65, 89, 72, 72, $BS_BITMAP) , $hBtnL = GUICtrlGetHandle($iBtnL) _WinAPI_DeleteObject(_SendMessage($hBtnL, $BM_SETIMAGE, $IMAGE_BITMAP, $GDIbmpLarge)) ;this needs a GDI bitmap!!! GUISetState() Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPlus_BitmapDispose($GDIplusLarge) _WinAPI_DeleteObject($GDIbmpLarge) _GDIPlus_Shutdown() GUIDelete() Exit Case $iBtnL MsgBox(0, "Info", "Large Image Downloaded from web and used directly without saving to disk first!") EndSwitch Until False Here is what I tried but it doesn't work: #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GDIplus.au3> ; Needed for GDI functions Example() Func Example() Local $idListview, $hImage Local $sWow64 = "" If @AutoItX64 Then $sWow64 = "\Wow6432Node" Local $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Advanced\Images" GUICreate("ImageList AddBitmap", 400, 300) $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW) ; Load images $hImage = _GUIImageList_Create(16, 32) $webImage = "http://icons.iconarchive.com/icons/hopstarter/soft-scraps/64/User-Administrator-Blue-icon.png" ; This line works-> _GUIImageList_AddBitmap($hImage, $sPath & "\Red.bmp") Global $GDIbmpLarge = _GDIPlus_BitmapCreateFromMemory(InetRead($webImage), 1) ;this is a GDI bitmap Global $GDIplusLarge = _GDIPlus_BitmapCreateFromHBITMAP($GDIbmpLarge) ;convert GDI to GDIPlus bitmap ; This doesn't work -> _GUIImageList_AddBitmap($hImage, _GDIPlus_BitmapCreateFromHBITMAP($GDIbmpLarge)) ; This doesn't work -> _GUIImageList_AddBitmap($hImage, _GDIPlus_BitmapCreateFromHBITMAP($GDIplusLarge)) _GUICtrlListView_SetImageList($idListview, $hImage, 1) ; Add columns _GUICtrlListView_AddColumn($idListview, "Items", 120) ; Add items _GUICtrlListView_AddItem($idListview, "Item 1", 0) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example *Slim version (No comments) #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GDIplus.au3> Example() Func Example() Local $idListview, $hImage GUICreate("ImageList AddBitmap", 400, 300) $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW) ; Load images $hImage = _GUIImageList_Create(16, 32) $webImage = "http://icons.iconarchive.com/icons/hopstarter/soft-scraps/64/User-Administrator-Blue-icon.png" Global $GDIbmpLarge = _GDIPlus_BitmapCreateFromMemory(InetRead($webImage), 1) ;this is a GDI bitmap Global $GDIplusLarge = _GDIPlus_BitmapCreateFromHBITMAP($GDIbmpLarge) ;convert GDI to GDIPlus bitmap ; This doesn't work -> _GUIImageList_AddBitmap($hImage, _GDIPlus_BitmapCreateFromHBITMAP($GDIplusLarge)) _GUICtrlListView_SetImageList($idListview, $hImage, 1) _GUICtrlListView_AddColumn($idListview, "Items", 120) _GUICtrlListView_AddItem($idListview, "Item 1", 0) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc
  20. Hello guys! I've got a simple question: - Is it possible to display a ToolTip on ListBox Item? - I want to display it when an Item is too long for the ListBox width, and a part of it is hidden (Just like a ListView does, but for a ListBox) Thanks!
  21. Probably there are billions of posts about it, but this is my version It lists all files of the selected path and the files in its subdirectories. It can be easily converted in a function like _FileListToArray or it can be used to work on those files. Local $path = InputBox("Path", "Enter the path", @DesktopDir, " M") If @error Then Exit Local $count_sub = 0, $k = 0 #forcedef $dir_array ;necessary for tidy.exe If FileExists($path) Then ;adds or replaces "/" with "\" at the end of the path If StringRight($path, 1) <> "\" Then If StringRight($path, 1) == "/" Then $path = StringTrimRight($path, 1) & "\" Else $path &= "\" EndIf EndIf Else MsgBox(0,"Error","The selected folder doesn't exist") Exit EndIf While 1 Local $search = FileFindFirstFile($path & "*.*") If $search = -1 Then If @error == 1 Then ;the folder is empty If Not IsDeclared("dir_array") Then MsgBox(0, "Info", "The folder is empty") Exit EndIf Else ;other errors, for example an error occurs if there aren't admin rights for some folder If IsDeclared("dir_array") Then ConsoleWrite($path & " ->>> Some errors occurred with this folder" & @CRLF) ;doesn't work with #requireadmin Else MsgBox(0, "Error", "No files/directories matched the search pattern" & @CRLF & $path) Exit EndIf EndIf EndIf While 1 Local $file = FileFindNextFile($search) If @error Then ;files are finished FileClose($search) If $count_sub <> 0 Then ;if there aren't subdirectories If IsDeclared("dir_array") Then ;$dir_array contains every found subdirectory, it has 2 dimensions: the first is the level, the second is the subdirectories list If $count_sub > UBound($dir_array, 2) Then ReDim $dir_array[UBound($dir_array) + 1][$count_sub] Else ReDim $dir_array[UBound($dir_array) + 1][UBound($dir_array, 2)] EndIf Else Dim $dir_array[1][$count_sub] EndIf $count_sub = 0 Local $search = FileFindFirstFile($path & "*.*") While 1 ;saves all found subdirectories in the last level Local $subfolder = FileFindNextFile($search) If @error Then ExitLoop if @extended == 1 Then $dir_array[UBound($dir_array) - 1][$k] = $subfolder $k += 1 EndIf WEnd $k = 0 FileClose($search) $path &= $dir_array[UBound($dir_array) - 1][0] & "\" ;"c:\windows\system32\" --> "C:\windows\system32\drivers\" ExitLoop Else ;if the directory hasn't subdirectories If IsDeclared("dir_array") Then If UBound($dir_array) > 1 Then ;if there is more than one level if UBound($dir_array, 2) > 1 Then If $dir_array[UBound($dir_array) - 1][1] <> "" Then ;if there is more than one subdirectory in the last level For $i = 0 To (UBound($dir_array, 2) - 2) ;deletes the first subdirectory of the last level and replace it with the second subdirectory $dir_array[UBound($dir_array) - 1][$i] = $dir_array[UBound($dir_array) - 1][$i + 1] Next $dir_array[UBound($dir_array) - 1][UBound($dir_array, 2) - 1] = "" $path = StringRegExpReplace($path, "[^\\]*\\$", "") ;"C:\windows\system32\drivers\" --> "c:\windows\system32\" $path &= $dir_array[UBound($dir_array) - 1][0] & "\" ExitLoop Else $path = StringRegExpReplace($path, "[^\\]*\\[^\\]*\\$", "") ;"C:\windows\system32\drivers\etc\" --> "c:\windows\system32\" While 1 ReDim $dir_array[UBound($dir_array) - 1][UBound($dir_array, 2)] ;deletes the last level If $dir_array[UBound($dir_array) - 1][1] = "" Then If UBound($dir_array) == 1 Then ExitLoop(3) Else $path = StringRegExpReplace($path, "[^\\]*\\$", "") ContinueLoop EndIf Else ExitLoop EndIf WEnd For $i = 0 To (UBound($dir_array, 2) - 2) $dir_array[UBound($dir_array) - 1][$i] = $dir_array[UBound($dir_array) - 1][$i + 1] Next $dir_array[UBound($dir_array) - 1][UBound($dir_array, 2) - 1] = "" $path &= $dir_array[UBound($dir_array) - 1][0] & "\" ExitLoop EndIf Else ExitLoop(2) EndIf Else If UBound($dir_array, 2) > 1 Then If $dir_array[0][1] <> "" Then For $i = 0 To (UBound($dir_array, 2) - 2) $dir_array[0][$i] = $dir_array[0][$i + 1] Next $dir_array[0][UBound($dir_array, 2) - 1] = "" $path = StringRegExpReplace($path, "[^\\]*\\$", "") $path &= $dir_array[0][0] & "\" ExitLoop Else ExitLoop(2) EndIf Else ExitLoop(2) EndIf EndIf Else ExitLoop(2) EndIf EndIf EndIf if @extended = 1 Then ;it's a folder, not a file $count_sub += 1 ContinueLoop EndIf #cs ENTER YOUR CODE HERE, FOR EXAMPLE: ConsoleWrite("File: " & $path & $file & @CRLF) #ce ConsoleWrite("File: " & $path & $file & @CRLF) WEnd WEnd
  22. How can I programatically find the styles of all the sentences on a Microsoft Word document? I tried this code but it didn't work: #include <Word.au3> Global $oWord, $oDoc $oWord = _Word_Create() $oDoc = _Word_DocGet($oWord, 1) Local $sCount = $oDoc.Sentences.Count For $i = 0 To $sCount - 1 Local $oRange = _Word_DocRangeSet($oDoc, -1, $wdSentence, $i, $wdSentence, 1) ConsoleWrite("The style of this sentence is: " & $oRange.Style & @LF) Next
  23. I'm Trying to get all computers returned in the active domain that have been active within the last 90 days, I'm currently stuck at just getting the full list of computers in the domain. I'm using the ADfunctions UDF. Here's my code: #include "XXX/ADfunctions.au3" _GetADComputers() Func _GetADComputers() Local $aComputers $sOU = $strDNSDomain _ADGetObjectsInOU($aComputers,$sOU,"(objectclass=computer)",2,"name") _ArrayDisplay($aComputers) Return($aComputers) EndFunc Any help is greatly appreciated!
  24. Hi all, I need your help to learn how can I implement the data structure as described in the attachment Thanks!
  25. For example I have a list like this.. How can I store all the list items on that GUI program into a string with the following format: $IniKey = "item1, item2, item3" Thanks in advanced!