Jump to content

Search the Community

Showing results for tags 'list'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • 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 FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

  1. Hi dear friends!, i'm sorry for creating a new thread (a new problem), i have over than 9 lists that i want to combine them to be this (in this example, there are 3 test files): I've written a little code for splitting main information, but i really confused how to make results as "Output.txt", here is that code: $sRegex_1 = StringRegExp(FileRead("1.txt"), '(?s:(?<=\=\=\r\n)(.*?)(?=\r\n\=\=))', 3) $sRegex_2 = StringRegExp(FileRead("2.txt"), '(?s:(?<=\=\=\r\n)(.*?)(?=\r\n\=\=))', 3) $sRegex_3 = StringRegExp(FileRead("3.txt"), '(?s:(?<=\=\=\r\n)(.*?)(?=\r\n\=\=))', 3) For $i = 0 To UBound($sRegex_1) - 1 ConsoleWrite($sRegex_1[$i] & @CRLF) For $j = 0 To UBound($sRegex_2) - 1 ConsoleWrite($sRegex_2[$j] & @CRLF) For $k = 0 To UBound($sRegex_3) - 1 ConsoleWrite($sRegex_3[$k] & @CRLF) Next Next Next
  2. Hi guys!, i have a problem to convert Python code to AutoIt code, in fact i had not coded with Python yet!, this code is about permutation a string's case, i will be happy with your comments :)❤; Python code: # Python code to print all permutations # with respect to cases # Function to generate permutations def permute(inp): n = len(inp) # Number of permutations is 2^n mx = 1 << n # Converting string to lower case inp = inp.lower() # Using all subsequences and permuting them for i in range(mx): # If j-th bit is set, we convert it to upper case combination = [k for k in inp] for j in range(n): if (((i >> j) & 1) == 1): combination[j] = inp[j].upper() temp = "" # Printing current combination for i in combination: temp += i print(temp), # Driver code permute("Hello") # This code is contributed by Sachin Bisht My code in AutoIt: ; https://www.geeksforgeeks.org/permute-string-changing-case/ _PermuteCase("ABC") Func _PermuteCase($sText) If StringRegExp($sText, "^[A-Za-z]{1,}$") Then Local $iLength = StringLen($sText) ; Get length of the text. Local $iMaxPerm = 2 ^ $iLength ; Number of permutations is 2^n Local $sLow_Text = StringLower($sText) ; Converting string to lower case Local $asChrs = StringToASCIIArray($sLow_Text) ; Split the text into array of chars. For $i = 1 To $iMaxPerm Step 1 For $j = 0 To $asChrs[0] ;................................................... Next Next Else Return SetError(-1, 0, "Error: Input is incorrect!") EndIf EndFunc ;==>_PermuteCase ====================== SOLUTION by @TheXman ======================
  3. I'm working on a script that needs to work with a huge database inside a combobox. I'm looking for the best way to link a multidimensional array to that data to load that data on to textfields. example: combo item 0 = "A", data = [index linked to combo item 0] [1,0,5,4,87,9,"xyz"] combo item 1 = "B", data = [index linked to combo item 1] [1,6,5,4,87,9,"zzz"] combo item 3 = "A", data = [index linked to combo item 3] [1,6,4,4,87,9,"aaa"] ; yes also double items! Would also like to be able to delete and add items on the fly btw.. Local $INDEX[0][10] ; ubound wil be resized like a stack while loading from a textfile ;inside gui: local $Combo = GUICtrlCreateCombo('...', 10, 10, 290, 25) ;gui loop: While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Combo display() ; how do i link my array index to the combo labels to know what to show in the textfields? ; NOTE: (there are duplicate items in the combobox!) EndSwitch WEnd Any toughs are welcome. I was thinking about using _GUICtrlComboBox_GetCurSel($Combo) and use that integer to refer to the index (dimension 1) of the array Thanks, TheAutomator
  4. good morning all. first lit me give you all a thinks to your help you're help me allot thank you all. sirs today i've a new problem it's not a problem but thing i want to add it to blind accessability. the ListBox can send a notification when the user send a double click on it items but as we know that the blind users can't use the mouse for that they use the keybord to navigate. as we know that the enter replace the double click on the keybord for that i need when the user send a inter above any listBox item the list send a double click notification. i know some of you tell me that i can use the GUISetAccelerators function but the enter has a other tasks such as leav a blanc line on edits and activate the defaultButton and other tasks. that what i need and i hope that you can help me this is a simple example. #include <GUIConstantsEx.au3> #include <StructureConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <ListBoxConstants.au3> Example() Func Example() Local $sMESSAGE = "The following buttons have been clicked" GUICreate("My GUI list") ; will create a dialog box that when displayed is centered Local $idButton_Add = GUICtrlCreateButton("Add", 64, 32, 75, 25) Local $idButton_Clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) global $idMylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97) GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling GUICtrlSetData(-1, $sMESSAGE) global $DummyList = GUICtrlCreateDummy() GUICtrlSendToDummy($DummyList, 1) Local $idButton_Close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25) GUIRegisterMsg($WM_command, "WM_command") GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton_Add GUICtrlSetData($idMylist, "You clicked button No1|") Case $idButton_Clear GUICtrlSetData($idMylist, "") Case $idButton_Close MsgBox($MB_SYSTEMMODAL, "", "the closing button has been clicked", 2) Exit case $DummyList $g_iTemp = GUICtrlRead($DummyList) if $g_iTemp = $LBN_DBLCLK then ;$LBN_DBLCLK then msgBox(64, "", "") endIf GUICtrlSendToDummy($DummyList, 0) EndSwitch WEnd EndFunc ;==>Example Func WM_command($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = $lParam $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case GUICtrlGetHandle($idMylist) Switch $iCode Case $LBN_SELCHANGE, $LBN_DBLCLK, $LBN_SELCANCEL, $LBN_SETFOCUS GUICtrlSendToDummy($DummyList, $iCode) case else ;GUICtrlSendToDummy($DummyTreeview, 1) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc
  5. 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!
  6. 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
  7. 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
  8. 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
  9. 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 ?..
  10. 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!
  11. 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
  12. 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
  13. 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.
  14. 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
  15. 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
  16. 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
  17. Version 1.0.3.2

    1,896 downloads

    Do a backup of a folders list
  18. 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
  19. 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?
  20. 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!
  21. 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.
  22. 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
  23. 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.
  24. 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
  25. 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
×
×
  • Create New...