Jump to content

Search the Community

Showing results for tags 'select'.

  • 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

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. Usually when I collect data from DataBase I need to give EndUser a possibility to select rows which should be taken in the processing loop. I was searching on the forum and I'm not able to find any UDF or even example of how to select data from array. I have my own solutions but I think they are not worth posting on the forum as it is very old code and I am looking for a better solution. Could anybody point me to some examples/solutions ? Thank you in advance. @mLipok
  2. Hello, I just made another TCP server. I will use the server for data collection and a lot of clients can get the data from TCP. I now use it for UDP broadcast some devices to get their IP's. You can also use it for chat's. It is very low level, but so you have more options than with the pure AutoIt functions. Just start the server in SciTE to see the console outputs. Then you can start up to 63 clients to talk to the server. I hope you like it. Server script: #include "socket_UDF.au3" ;funkey 2013.06.21 _WSAStartup() Global $iSocket Global $iReturn Global $iPort = 20500 Global $sIP_Connected Global $iPort_Connected Global $tBuffer = DllStructCreate("char buffer[512]") $iSocket = _socket($AF_INET, $SOCK_STREAM, $IPPROTO_TCP) ConsoleWrite("Listen Socket: " & $iSocket & @CRLF) Global $tReUse = DllStructCreate("BOOLEAN reuse") DllStructSetData($tReUse, "reuse", True) ; enable reusing the same port $iReturn = _setsockopt($iSocket, $SOL_SOCKET, $SO_REUSEADDR, $tReUse) ; set reusing option for the port If $iReturn Then ConsoleWrite("SetSockOpt error setting reusing the same port!. Windows Sockets Error Codes: " & _WSAGetLastError() & @CRLF) EndIf $iReturn = _bind($iSocket, @IPAddress1, $iPort) ;local IP-Address and port to use If $iReturn Then ConsoleWrite("Bind error: " & $iReturn & @CRLF) ; 0 is OK EndIf $iReturn = _listen($iSocket, 1) If $iReturn Then ConsoleWrite("Listen error: " & $iReturn & @CRLF) ; 0 is OK EndIf Global $iNewSocket Global $tReadFds = DllStructCreate($tagFd_set) Global $tReadFds_Copy = DllStructCreate($tagFd_set) _FD_ZERO($tReadFds) _FD_SET($iSocket, $tReadFds) Global $iSocketMax = $iSocket Global $iSocketNow Global $sDataRcv While 1 DllCall('ntdll.dll', 'none', 'RtlMoveMemory', 'struct*', $tReadFds_Copy, 'struct*', $tReadFds, 'ULONG_PTR', DllStructGetSize($tReadFds)) $iReturn = _select($iSocketMax + 1, $tReadFds_Copy, 2000) ;timeout 2 seconds If _FD_ISSET($iSocket, $tReadFds_Copy) Then $iNewSocket = _accept($iSocket, $sIP_Connected, $iPort_Connected) _FD_SET($iNewSocket, $tReadFds) _FD_SHOW($tReadFds) If $iNewSocket > $iSocketMax Then $iSocketMax = $iNewSocket ConsoleWrite("New connected socket: " & $iNewSocket & @TAB & "IP: " & $sIP_Connected & @TAB & "Port: " & $iPort_Connected & @LF) EndIf For $i = 2 To DllStructGetData($tReadFds, "fd_count") $iSocketNow = DllStructGetData($tReadFds, "fd_array", $i) If _FD_ISSET($iSocketNow, $tReadFds_Copy) Then DllCall('ntdll.dll', 'none', 'RtlZeroMemory', 'struct*', $tBuffer, 'ULONG_PTR', DllStructGetSize($tBuffer)) If _recv($iSocketNow, $tBuffer) = $SOCKET_ERROR Then _closesocket($iSocketNow) _FD_CLR($iSocketNow, $tReadFds) Else $sDataRcv = DllStructGetData($tBuffer, 1) ConsoleWrite("Data received: " & $sDataRcv & @LF) If $sDataRcv == "CloseServer!" Then ExitLoop 2 EndIf EndIf EndIf Next WEnd For $i = 1 To DllStructGetData($tReadFds, "fd_count") _closesocket(DllStructGetData($tReadFds, "fd_array", $i)) Next _WSACleanup() Func _FD_SHOW(ByRef $tFd_set) For $i = 1 To DllStructGetData($tFd_set, "fd_count") ConsoleWrite($i & ":" & @TAB & DllStructGetData($tFd_set, "fd_array", $i) & @LF) Next EndFunc ;==>_FD_SHOWsocket_UDF and example.rar
  3. I have a windows 10 pc and Im trying to create an automatic solving in calculator with a simple worded question (example: What is 45 x 53 ?). thou I cant make the select...Case...EndSelect statement work, here is my code #include <AutoItConstants.au3> HotKeySet("{F4}", "ExitProg") Func ExitProg() Exit 0 EndFunc MouseClick($MOUSE_CLICK_LEFT, 417, 659, 2, 1) Send("^c") Func valData() $Chek = "What " If ClipGet() == $Chek Then Check() Else Do MouseClick($MOUSE_CLICK_LEFT, 417, 659, 2, 3) Send("^c") Sleep(500) Until ClipGet() == $Chek EndIf EndFunc Func Check() $Chek2 = "?" c1() c2() c3() c4() c5() c6() c7() Select Case c1() = $Chek2 ;two MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("^v") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 474, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("*") Send("^v") Send("{NUMPADENTER}") Case c2() = $Chek2 ;three MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("^v") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 482, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("*") Send("^v") Send("{NUMPADENTER}") Case c3() = $Chek2 ;four MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("^v") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 487, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("*") Send("^v") Send("{NUMPADENTER}") Case c4() = $Chek2 ;five MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("^v") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 495, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("*") Send("^v") Send("{NUMPADENTER}") Case c5() = $Chek2 ;six MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("^v") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 495, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("*") Send("^v") Send("{NUMPADENTER}") Case c6() = $Chek2 ;seven MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("^v") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 509, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("*") Send("^v") Send("{NUMPADENTER}") Case c7() = $Chek2 ;eight MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("^v") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 509, 645, 2, 1) Send("^c") Sleep(150) MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1) Send("*") Send("^v") Send("{NUMPADENTER}") Case Else Exit EndSelect EndFunc Func c1() MouseClick($MOUSE_CLICK_LEFT, 485, 643, 2, 1) Send("^c") EndFunc Func c2() MouseClick($MOUSE_CLICK_LEFT, 493, 644, 2, 1) Send("^c") EndFunc Func c3() MouseClick($MOUSE_CLICK_LEFT, 498, 645, 2, 1) Send("^c") EndFunc Func c4() MouseClick($MOUSE_CLICK_LEFT, 508, 647, 2, 1) Send("^c") EndFunc Func c5() MouseClick($MOUSE_CLICK_LEFT, 514, 645, 2, 1) Send("^c") EndFunc Func c6() MouseClick($MOUSE_CLICK_LEFT, 523, 645, 2, 1) Send("^c") EndFunc Func c7() MouseClick($MOUSE_CLICK_LEFT, 530, 645, 2, 1) Send("^c") EndFunc valData() MouseClick($MOUSE_CLICK_LEFT, 1349, 196, 1, 1) ;clicking the answer in calc Send("^c") Send("{DEL}") MouseClick($MOUSE_CLICK_LEFT, 499, 706, 1, 1) Send("^v") Exit
  4. Hello Guru's, I'm trying to write an autoit script to select from the dropdown list as you see in the attached picture. I read the help page for _IEFormElementOptionSelect, but I cannot grasp how to correlate that with the source code that I'm seeing. any suggestions?
  5. I am trying to build a list from a query run against a sybase db. This part works fine. My problem is this, I want to display values in a list depending on the value of certain fields i.e. See below which works for two. Unfortunately, I need it to work for 3 values. I don't know how I can do this for 3. I did try doing a select case but I was getting errors. i.e. if value =0 then "Card Check" if Value = - Then "Card Spend" Else "Money Added" The below immediate iif works brilliantly for two but as I say I need to build this with 3 different values. $idItem = GUICtrlCreateListViewItem( _iif($adoRs.Fields("TransactionAmount").value =0, "Card check","Money Added") Any help appreciated.
  6. @JLogan3o13 I apologize, I did not think of it that way. I have attached all the code and the Ini File information. Please let me know if I need to add anything else to help understand what is happening. thank you. Guys, I apologize in advance as I did not search for my answer before posting. I just could not figure out a way to search that made since so I decided to go ahead and post my question. Getting to it. Background: this is being used to validate file names before moving to a new location. though i have not included all the code, below is what i am having a problem with. I have an ini file that i am reading values from. Func ConfigDefineVars() -- I read the value of $ValidationRDA and everything is good then I set $CaseRDALocationCheck = '$SplitFile[$ValidationRDALocation]' <> $ValidationRDA the code that will be used in the select case in Func FileSplitCount(). The problem i have is that even though the numbers = each other they are not recognizing as =. This is what i am getting in my log file i create. 2017-12-04 14:09:53 : RDA was 2403 should have been 2403: If I move $SplitFile[$ValidationRDALocation] <> $ValidationRDA to the Case line under the function it works correctly. I think this has to do with my use of ' ' around the '$SplitFile[$ValidationRDALocation]' but i don't know what option i have in Func ConfigDefineVars I am not ready to define $SplitFile. I have tried adding it to my Global Vars at the top of my script but that did not seem to help. There will be more fail this is just the first one in the select case. Any help or ideas would be greatly appreciated. thanks, Damon Example of a filename used. DWRSSD-37087-95-026.%-064.00-Tatum Family %-%-1230 Academy Rd-%-PERM-TRUE-2403.pdf This file will fail on the 95, it should be 095. The problem i am getting is with the 2403 it fails even though the ini file value ValidationRDA = 2403 Ini File: [SSD_FolderPaths] pendingFolder=C:\Users\bg01152\Desktop\SSD Test\pending reviewFolder=C:\Users\bg01152\Desktop\SSD Test\review completedFolder=C:\Users\bg01152\Desktop\SSD Test\Completed FileNetProperties=DocumentTitle,ZipCode,County,MapAndGroupID,ParcelID,PropertyOwner,Subdivision,StreetAddress,LotNumber,DocumentType,Approved,RDANumber ValidationDocumentTitle=DWRSSD ValidationDocumentTitleLocation=1 ValidationCountyCodeLocation=3 ValidationRDA=2403 ValidationRDALocation=12 Validation3=TRUE Validation3Location=11 Validation4=PERM Validation4Location=10 #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> ;------------Global Vars --------------------- Global $SplitFile, $aFileList, $FileLog, $dFolder, $sFolder, $cFolder, $ConfigFile, $t Global $ValidationDocumentTitle, $ValidationDocumentTitleLocation, $ValidationCountyCodeLocation, $ValidationRDA Global $ValidationRDALocation, $Validation3, $Validation3Location, $Validation4, $Validation4Location, $FileNetPropertiesSplit Global $CaseCountyCheck, $CaseRDALocationCheck, $CaseValidation3LocationCheck, $CaseValidation4LocationCheck, $SplitFile ;;--------------------------------Check and Read Config files-------------------------------- $SysConfigFile = @ScriptDir & "\SysConfig.ini" ;----------------PreCheck for Config File-------------- If FileExists ($SysConfigFile) <> 1 Then Exit EndIf ;----------------End PreCheck-------------------------- $FileNetEXE = @ScriptDir & "\" & IniRead ($SysConfigFile, "FileNetUploader","FileName","") $delimiter = IniRead ($SysConfigFile, "FileInformation", "Delimiter","") $Filter = IniRead ($SysConfigFile, "FileInformation", "Filter", "") $ConfigFile = @ScriptDir & "\Config.ini" ;----------------PreCheck for Config File-------------- If FileExists ($ConfigFile) <> 1 Then Exit EndIf ;----------------End PreCheck-------------------------- ;;-------------------------------------------------------------------------------------------- $Sections = IniReadSectionNames ($ConfigFile) ;MsgBox (0,"test", $Sections[0] & @CRLF & $Sections[1] & @CRLF & $Sections[2] & @CRLF & $Sections[3] & @CRLF & $Sections[4]);TESTING ONLY - DELETE WHEN DONE $p = 0 Do $t = 0 ;used for precheck $p = $p + 1 ConfigDefineVars($Sections[$p]) ;MsgBox(0,"ConfigDefineVars", $sFolder & @CRLF & $dFolder & @CRLF & $cFolder);TESTING ONLY - DELETE WHEN DONE PreCheck($dFolder, $sFolder, $cFolder) ;Runs a Pre-check to make sure folder structure exists before running the program If $t = 0 Then ;MsgBox(0,"PreCheck Run", "Running next functions");TESTING ONLY - DELETE WHEN DONE ListArray($sFolder, $Filter) ;Puts File Names in String Array ;_ArrayDisplay ($aFileList, $Sections[$p]) If $t = 0 Then FileSplitCount($dFolder, $aFileList) ;Takes filename String Array and splits by $delimiter ;MsgBox(0,"PreCheck Run2", "Running split function");TESTING ONLY - DELETE WHEN DONE Else ;MsgBox(0,"PreCheck Run2", "Skipping split function");TESTING ONLY - DELETE WHEN DONE EndIf Else ;MsgBox(0,"PreCheck Run", "Skipping next functions");TESTING ONLY - DELETE WHEN DONE EndIf Until $p = $Sections[0] ExitScript() ;Exit script Function Func ConfigDefineVars($SectionsNum);Defines Variables from config file Sections $sFolder = IniRead ($ConfigFile, $SectionsNum, "pendingFolder","") ;Pending Folder, Folder that is awaiting the process $dFolder = IniRead ($ConfigFile, $SectionsNum, "reviewFolder","") ;Review Folder, Files that did not pass validation check and division needs to review $cFolder = IniRead ($ConfigFile, $SectionsNum, "completedFolder","") ;Completed Folder, Once process is completed this would be location files get moved to $FileNetProperties = IniRead ($ConfigFile, $SectionsNum, "FileNetProperties","") $FileNetPropertiesSplit = StringSplit ($FileNetProperties,",") $ValidationDocumentTitle = IniRead ($ConfigFile, $SectionsNum, "ValidationDocumentTitle","") $ValidationDocumentTitleLocation = IniRead ($ConfigFile, $SectionsNum, "ValidationDocumentTitleLocation","") $ValidationCountyCodeLocation = IniRead ($ConfigFile, $SectionsNum, "ValidationCountyCodeLocation","") $ValidationRDA = IniRead ($ConfigFile, $SectionsNum, "ValidationRDA","") $ValidationRDALocation = IniRead ($ConfigFile, $SectionsNum, "ValidationRDALocation","") $Validation3 = IniRead ($ConfigFile, $SectionsNum, "Validation3","") $Validation3Location = IniRead ($ConfigFile, $SectionsNum, "Validation3Location","") $Validation4 = IniRead ($ConfigFile, $SectionsNum, "Validation4","") $Validation4Location = IniRead ($ConfigFile, $SectionsNum, "Validation4Location","") If $ValidationCountyCodeLocation = 999 Then $CaseCountyCheck = 1 <> 1 Else ;MsgBox (0,"test of county code", "location = " &$ValidationCountyCodeLocation) $CaseCountyCheck = StringLen('$SplitFile[$ValidationCountyCodeLocation]') <> 3 ; Checks for 3 digit County Code EndIf If $ValidationRDALocation = 999 Then $CaseRDALocationCheck = 1 <> 1 Else $CaseRDALocationCheck = '$SplitFile[$ValidationRDALocation]' <> $ValidationRDA ; Checks for 4 Digit RDA EndIf If $Validation3Location = 999 Then $CaseValidation3LocationCheck = 1 <> 1 Else $CaseValidation3LocationCheck = '$SplitFile[$Validation3Location]' <> $Validation3 ; Checks that Approved = True EndIf If $Validation4Location = 999 Then $CaseValidation4LocationCheck = 1 <> 1 Else $CaseValidation3LocationCheck = '$SplitFile[$Validation4Location]' <> $Validation4 ; Checks that Document Type = PERM EndIf EndFunc Func ValidationCheck ($check1) $blank = StringLen ($check1) If $check1 Then EndIf EndFunc Func PreCheck($dFolder, $sFolder, $cFolder) ;----------------PreCheck for Destination Folder-------------- If FileExists ($dFolder) <> 1 Then $t = 1 Return Else $FileLog = FileOpen($dFolder & "\FileLog.log", 1) EndIf ;----------------End PreCheck-------------------------- ;----------------PreCheck for Source Folder-------------- If FileExists ($sFolder) <> 1 Then _FileWriteLog($FileLog, "Path to Pending Folder -- " & $sFolder & " -- does not exist") $t = 1 Return EndIf ;----------------End PreCheck-------------------------- ;----------------PreCheck for Completed Folder--------- If FileExists ($cFolder) <> 1 Then _FileWriteLog($FileLog, "Path to Completed Folder -- " & $cFolder & " -- does not exist") $t = 1 Return EndIf ;----------------End PreCheck-------------------------- EndFunc Func ListArray($sFolder, $Filter) $aFileList = _FileListToArray($sFolder, $Filter, 1) ;Create an array of files from the source folder filtering by filetype ;in the config.ini files for the specified section If @error = 1 Then ;MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") _FileWriteLog($FileLog, "Path to File(s) is Invalid") $t = 1 Return EndIf If @error = 4 Then ;MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") _FileWriteLog($FileLog, "No File(s) were found, exiting.") $t = 1 Return EndIf EndFunc ;==>ListArray
  7. Hello Today I'm working on listbox but there might be something that I'm missing... I made a little script that allow the user to swap 2 items for the listbox. So the user select for example the 3rd item, press the button "Up" and it switch with the 2nd one, same with the "Down" button that switch with the 4th one. But when I select the 3rd item and switch it the item become unselected and I would like to select it again after the manipulation : As you can see in the comment of the script, _GUICtrlListBox_SetSel don't highlight/select them once the swap process is done.. What am I missing ?
  8. Hey guys I hope that I can get a little help with this one In this GUI example using GUIListViewEx, I have a list based on items found in test.txt. _____________________________________________ item1 item2 item3 ____________________________________________ etc.... When an item is selected, and I click the GetInfo button, a message will show the text of that item. Is it possible to activate a case like that as soon as the item is selected, so I don't need a button to start the case? #include <GUIConstantsEx.au3> #include <GUIListViewEx.au3> Global $MainGUI_ManageItemList Global $File = "test.txt" Global $FileToArray = FileReadToArray("test.txt") Call ("MainGUI_ManageItemList") Func MainGUI_ManageItemList() Local $Button1 $MainGUI_ManageItemList = GUICreate("Manage Item List", 800, 400, -1, -1) $cLV = GUICtrlCreateListView("[items]", 10, 10, 400, 775, $LVS_NOCOLUMNHEADER) GUICtrlSetFont(-1, 12, 800, 0, "@Arial Unicode MS") _GUICtrlListView_SetColumnWidth($cLV, 0, 378) $Button1 = GUICtrlCreateButton("Button 1", 425, 10, 80, 30) $RemoveItem = GUICtrlCreateButton("Remove Item", 425, 50, 80, 30) $GetInfo = GUICtrlCreateButton("GetInfo", 425, 120, 80, 30) GUISetState(@SW_SHOW, $MainGUI_ManageItemList) ; Intialise ListView Global $iLV_Index = _GUIListViewEx_Init($cLV) ; Insert lines _GUIListViewEx_Insert($FileToArray, True) ; Register required messages _GUIListViewEx_MsgRegister(True, False, False, False) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button1 MsgBox(0,"","Button 1 is pressed") Case $RemoveItem _GUIListViewEx_Delete() Case $GetInfo $ItemSelected = _GUICtrlListView_GetSelectedIndices($cLV, True) If IsArray($ItemSelected) And $ItemSelected[0] <> 0 Then ;This part makes sure it doesn't crash when no item is selected. $ItemSelectedText = _GUICtrlListView_GetItemText($cLV, $ItemSelected[1]) msgbox (0, "Selected item", $ItemSelectedText) EndIf EndSwitch WEnd EndFunc ;==>Main
  9. Hi, I want to tell pixelsearch to search for red color shades in for example 5 different x,y,h,w of the screen. If color red was not found in these 5 area, then do something. I wrote this, but it's working only if the first case is not found. Is select a good choice? or it's better to use switch or if or something else? ٍEdit: all "do something"s are same function. (search for red color untill in these 5 areas, it couldnot find red color, then if it couldn't find red color, perform that 1 function) Thanks Select Case 1 $color1 = PixelSearch(67, 614, 77, 617, 0xE62121, 10) If @error Then do something... EndIf Case 2 $color2 = PixelSearch(165, 614, 175, 617, 0xE62121, 10) If @error Then do something... EndIf Case 3 $color3 = PixelSearch(265, 614, 275, 617, 0xE62121, 10) If @error Then do something... EndIf Case 4 $color4 = PixelSearch(365, 614, 375, 617, 0xE62121, 10) If @error Then do something... EndIf Case 5 $color5 = PixelSearch(465, 614, 475, 617, 0xE62121, 10) If @error Then do something... EndIf EndSelect
  10. Hello, I am interested in looking at a chunk of text, selecting the string that is in quotes, and copying it to the clipboard. It will always have quotes at the beginning and end, start with https:// and will always contain .mp3 . But everything else is pretty random. This is an example of a piece of text I tried doing something like this but it didn't like the quotes. $sStart = "file: "" $sEnd = ""," $aExtract = _StringBetween($sStart, $sEnd) ClipPut($aExtract) Or is there a better/easier way to do this?
  11. Hello, I've writing this code and I'm a little stuck in what i want to do. When I select the combobox I want to get the ini information inside the multiline input field. I know that what I'm doing now is wrong but maybe this helps to clearify things in what I want to do. Does somebody knows how to do this , or can help me? #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <File.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <Array.au3> #include <Date.au3> check_file_exist() $Form1 = GUICreate("Form1", 320, 260, 192, 324);(b,h,,),30 $Tab1 = GUICtrlCreateTab(5, 5, 310, 250) ;(,,b,h) $TabSheet3 = GUICtrlCreateTabItem("Edit") $Label_tab_select = GUICtrlCreateLabel("select", 40, 50, 80, 25) $tab_select = GUICtrlCreateCombo(" tab 1", 40, 70, 80, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, " tab 2") $Label_BtnSelect = GUICtrlCreateLabel("nr", 125, 50, 80, 25) $BtnSelect = GUICtrlCreateCombo(" 1", 125, 70, 60, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, " 2 ") $Label_BtnName = GUICtrlCreateLabel("name", 190, 50, 80, 25) $BtName = GUICtrlCreateInput("", 190, 70, 80, 21) $multiline = GuiCtrlCreateEdit("this text needs to be changed at selection of combobox",15, 105, 290, 110) ;the next line is to clearify things :) ;$multiline = GuiCtrlCreateEdit(IniRead($ini_location_buttons, "btn00" & GUICtrlRead($BtnSelect), "text"),15, 105, 290, 110) $Btn301 = GUICtrlCreateButton("Cancel", 40, 220, 75, 25) $Btn302 = GUICtrlCreateButton("Save", 152, 220, 75, 25) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Btn301 Exit Case $Btn302 Exit EndSwitch WEnd Func check_file_exist() If FileExists(@SCRIPTDIR & "\ini.ini") Then Global $ini_location_buttons = @SCRIPTDIR & "\ini.ini" Else If Not _FileCreate(@SCRIPTDIR & "\buttons.ini") Then MsgBox($MB_SYSTEMMODAL, "Error", " Error Creating/Resetting ini. error:" & @error) Else Global $ini_location_buttons = @SCRIPTDIR & "\ini.ini" create_new_ini() EndIf EndIf EndFunc Func create_new_ini() $file = FileOpen($ini_location_buttons, 1) Local $i = 1 local $j = 0 Do if $i = 10 then $j = "" FileWrite($file, "[btn0" & $j & $i & "]"& @CRLF) FileWrite($file, "button_name=Button " & $i & @CRLF) FileWrite($file, "text=lorum ipsum" & $i & @CRLF) $i = $i + 1 Until $i = 3 FileClose($file) EndFunc
  12. Hello All: I am reading data from a ListView and based on criteria I want to have the script select certain rows in the ListView. The script would loop through the ListView data and would select multiple rows out-of-sequence. At the end, the script would press a button on the form which would remove the selected rows. I'd originally had the script read a row and if criteria was met it would click on the button and remove that row. In some cases there can be thousands of rows in the listview and clicking a button and then moving back to the listview was slow. Selecting all affected rows and then pressing the button once would speed things up. I've tried various functions and GUI UDF's to select a row but each time I ran the script I'd only get 1 row selected when I know there are dozens of records that should be selected. What I think is happening is that the ControlSend method I was using to move down the rows by sending the ListView a Down key may have been deselecting each selected row as soon as the Down Arrow was sent. Everything except for the Selection piece is working. I've looked through the help files and the forums and could not find information on another way to cycle through the ListView rows. I've included the code below along with each of the functions or UDF's I tried. Could someone let me know if there is another way to move through the Listview rows other than using ControlSend that won't deselect Selected records? If that's not an option, can someone let me know if there's another way to select rows in a ListView that won't be affected by the Down Arrow key? Thank you. Bill #AutoIt3Wrapper_UseX64=Y #include <MsgBoxConstants.au3> #include <array.au3> #include <GuiListbox.au3> #include <GuiToolbar.au3> #include <GuiListView.au3> HotKeySet("!{Esc}", "Terminate") Opt("MustDeclareVars", 1) ; Must declare variables Opt("WinTitleMatchMode", 2) ; Can match substrings in title Dim $hWnd ; main Title handle Dim $hCntrlLV1 ; List View handle ("SysListView328") Dim $sSubject ; Column 0 Dim $sStatus ; Column 1 Dim $sSize ; Column 2 Dim $sDate ; Column 3 Dim $sPoster ; Column 4 Dim $sGroup ; Column 5 Dim $bDelete = False Dim $iMaxRows ; Total Rows in List View Dim $iMaxCols ; Total Columns in List View Dim $iCurRow ; Current Row being read Dim $iSelected ; Total items Selected Dim $sTitle1 = "Main Title" If WinExists($sTitle1, "") Then $hWnd = WinActivate($sTitle1, "") If @error Then MsgBox(48, $sTitle1, "Could not activate the form.") Terminate EndIf $hCntrlLV1 = ControlGetHandle($hWnd, "", "SysListView328") ControlFocus($hWnd, "", $hCntrlLV1) $iMaxRows = ControlListView($hWnd, "", $hCntrlLV1, "GetItemCount") $iMaxCols = _GUICtrlListView_GetColumnCount($hCntrlLV1) ControlSend($hWnd, "", $hCntrlLV1, "{Home}") $iCurRow = 0 ; Zero based row in listview Do $bDelete = False ; Default ; This reads the data - (tested - no problem). $sSubject = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 0) $sStatus = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 1) $sSize = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 2) $sDate = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 3) $sPoster = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 4) $sGroup = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 5) ; Identifies if a row should be deleted and sets the flag $bDelete to True (tested - no problem). Select Case StringLeft($sStatus, 8) = "Idle/Old" $bDelete = True Case StringInStr($sGroup, "Test1") > 0 $bDelete = True Case StringInStr($sSubject, "Test2") > 0 $bDelete = True EndSelect ; If the row should be deleted, select it in the same way as a Ctrl+Left Mouse Click. ; (tested the following but the "select" didn't stick. See note below regarding ControlSend Down. If $bDelete = True Then ; ;_GUICtrlListView_SetItemSelected($hCntrlLV1,$iCurRow) ; ControlListView($hWnd, "", $hCntrlLV1,"Select", $iCurRow) ;_GUICtrlListView_SetSelectionMark($hCntrlLV1, $iCurRow) $bDelete = False ; Reset the flag EndIf ; Move to the next row and increment the current row counter. (tested - no problem). ; Pressing the down arrow deselects any Selected records. ; Is there another method for moving up or down a listview? ControlSend($hWnd, "", $hCntrlLV1, "{Down}") $iCurRow = $iCurRow + 1 ; Keep going until the end of the List View is reached. Until $iCurRow = $iMaxRows ; Get the number of items "Selected" in the List View. (tested - Both show 1 record selected.) $iSelected = 0 $iSelected = ControlListView($hWnd, "", $hCntrlLV1, "GetSelectedCount") MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$iSelected' & @CRLF & @CRLF & 'Return:' & @CRLF & $iSelected) ;### Debug MSGBOX $iSelected = 0 $iSelected = _GUICtrlListView_GetSelectedCount($hCntrlLV1) MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$iSelected' & @CRLF & @CRLF & 'Return:' & @CRLF & $iSelected) ;### Debug MSGBOX If $iSelected > 0 Then ; MouseClick("left",506,70,1) ; This clicks a button to remove records. (tested by clicking button when cycling through each record - no problem) EndIf Else MsgBox(0, "Error", "Form not active.") ; If the program isn't running then error out and quit EndIf Func Terminate() Exit EndFunc ;==>Terminate
  13. I'm not quite sure what keywords to search for. What I need is to have the user select an area on the screen just like in snipping tool. Can anyone lead me from here? Thanks.
  14. Hello I have been going to this forum regularly for a couple weeks, getting all sorts of good info from you people. So first off thanks, you are all gentlemen/women and scholars. I just wanted to point out that I think it would be neat if you could double click either side of the quotation marks in the Scite editor to select the string of text within. Instead of having to manually select all the text within, which is not hard, but u may sometimes miss a extra character or something. Just like how you can select variables and single words by double clicking. Thanks to all those who have worked on and continue to work on Autoit, I love it.
  15. Hello, I,m connecting to a access mdb, it works fine except when i use a select query and the requested data does not exists, then i get an error. ; Example Local $dbName = @ScriptDir & "\test.mdb" $dbCon = ObjCreate("ADODB.Connection") ; Create DataBase connection $dbCon.Open("Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & $dbName) $sQuery = "select * from sourcefiles where Text='test'" $result = $dbCon.Execute($sQuery) MsgBox(0, "", $result.Fields( "ID" ).Value)If "test" exists in column Text then i get the ID number from column ID But if it doesn't exist i get an error: MsgBox(0, "", $result.Fields( "ID" ).Value) MsgBox(0, "", $result.Fields( "ID" )^ ERROR If the value "test"does not exist i just want $result to be 0 or "" Someone an idea?
  16. $oie = _IECreate("https://tw.edit.yahoo.com/registration?intl=tw&origIntl=&done=http%3A%2F%2Fmail.yahoo.com&src=ym&last=&partner=yahoo_default&domain=&yahooid=",0,1,1,0) $oform = _IEFormGetObjByName($oie,"info-form",0) $yyyy = _IEFormElementGetObjByName($oForm, "yyyy") _IEFormElementOptionSelect($yyyy, "1976", 1, "byText") but i can't select to "1976" , help me to check that plz ~
  17. I'm a bit ashamed of asking this but.... I can't figure out why a simple select statement which checks a variable which contains mouse coordinates doesn't work while used with a Select Statement, while it works with an If-Else conditional statement. Select statements always returns false or 0. This isn't working Func StartIt() If CanIStart() Then MsgBox(0, "jj", "Start " & CanIStart()) Else MsgBox(0, "Kk", "NoStart" & CanIStart()) EndIf EndFunc ;==>StartIt Func CanIStart() Select Case UBound($M1Pos)<1 Return False Case UBound($M2Pos)<1 Return False Case UBound($M3Pos)<1 Return False Case UBound($M4Pos)<1 Return False EndSelect EndFunc ;==>CanIStart While this does the job pretty well Func StartIt() If CanIStart() Then MsgBox(0, "jj", "Start " & CanIStart()) Else MsgBox(0, "Kk", "NoStart" & CanIStart()) EndIf EndFunc ;==>StartIt Func CanIStart() If UBound($M1Pos)<1 Then Return False ElseIf UBound($M2Pos)<1 Then Return False ElseIf UBound($M3Pos)<1 Then Return False ElseIf UBound($M4Pos)<1 Then Return False Else Return True EndIf EndFunc ;==>CanIStart Thanks
  18. Hi, i am trying to create a FileManager, now i know there are better programs out there to do it, but i think its fun to try and learn nu things. Now i am getting stuck in my code i created a button to select a driver/folder after that i put's in the driver/folder contant in the TreeView, but when i select something and click on my button copy. It returns a 0 instead of something else, when i add a value to the TreeView with: GuiCtrlCreateTreeViewItem and i select that one, then my copy button works. Hope you guys can help me find out/point in the right direction where i am going wrong with this. Any pointers to a nicer GUI or a cleaner script would be appreciated Below find my code: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <ProgressConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> ;------------------------------------------------------------------------------------------------------------------------------------------- #NoTrayIcon ;------------------------------------------------------------------------------------------------------------------------------------------- If @OSVersion = "WIN_XP" Then $OS = "Windows XP" EndIf If @OSVersion = "WIN_VISTA" Then $OS = "Windows Vista" EndIf If @OSVersion = "WIN_7" Then $OS = "Windows 7" EndIf If @OSVersion = "WIN_8" Then $OS = "Windows 8" EndIf If @OSVersion = "WIN_81" Then $OS = "Windows 8.1" EndIf ;------------------------------------------------------------------------------------------------------------------------------------------- $Form1 = GUICreate("", 615, 470, -1, -1, $WS_POPUPWINDOW) $TITLE = GUICtrlCreateLabel("FileManager", 256, 8, 103, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetState($TITLE, $GUI_DISABLE) $INFO = GUICtrlCreateLabel("Hostname:" & @TAB & @ComputerName & @CRLF & "OS:" & @TAB & @TAB & $OS, 16, 437, 200, 60) GUICtrlSetState($INFO, $GUI_DISABLE) GUICtrlCreateLabel("Source", 16, 16) $SOURCEPROGRESS = GUICtrlCreateProgress(16, 72, 289, 17, $PBS_SMOOTH) $SOURCETREE = GUICtrlCreateTreeView(16, 104, 289, 305, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) GUICtrlCreateTreeViewItem("Test1", $SOURCETREE) $SOURCEINPUT = GUICtrlCreateInput("", 16, 40, 121, 21) GUICtrlSetState($SOURCEINPUT, $GUI_DISABLE) $SELECTSOURCE = GUICtrlCreateButton("...", 144, 42, 43, 17) GUICtrlCreateLabel("Target", 568, 16) $TARGETPROGRESS = GUICtrlCreateProgress(312, 72, 289, 17, $PBS_SMOOTH) $TARGETTREE = GUICtrlCreateTreeView(312, 104, 289, 305, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $TARGETINPUT = GUICtrlCreateInput("", 480, 40, 121, 21) GUICtrlSetState($TARGETINPUT, $GUI_DISABLE) $SELECTTARGET = GUICtrlCreateButton("...", 432, 42, 43, 17) $COPY = GUICtrlCreateButton("Copy", 182, 440, 75, 25) $MOVE = GUICtrlCreateButton("Move", 270, 440, 75, 25) $DELETE = GUICtrlCreateButton("Delete", 358, 440, 75, 25) $RENAME = GUICtrlCreateButton("Rename", 446, 440, 75, 25) $CLOSE = GUICtrlCreateButton("Exit", 534, 440, 75 , 25) GUISetState(@SW_SHOW) ;------------------------------------------------------------------------------------------------------------------------------------------- While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $CLOSE Exit Case $SELECTSOURCE SELECTSOURCE() Case $SELECTTARGET SELECTTARGET() Case $COPY COPY() EndSwitch WEnd ;------------------------------------------------------------------------------------------------------------------------------------------- Func SELECTSOURCE() $VAR = FileSelectFolder("Select Source drive/folder", "") GUICtrlSetData($SOURCEINPUT, $VAR) Local $iWait = 10 Local $iSavPos = 0 Do For $i = $iSavPos To 100 GUICtrlSetData($SOURCEPROGRESS, $i) Sleep($iWait) $iSavPos = $i Next Until $iSavPos = 100 _GUICtrlTreeView_BeginUpdate($SOURCETREE) ListFiles_FolderSOURCE($VAR & "\", 0) _GUICtrlTreeView_EndUpdate($SOURCETREE) EndFunc ;------------------------------------------------------------------------------------------------------------------------------------------- Func SELECTTARGET() $VAR = FileSelectFolder("Select Source drive/folder", "") GUICtrlSetData($TARGETINPUT, $VAR) Local $iWait = 10 Local $iSavPos = 0 Do For $i = $iSavPos To 100 GUICtrlSetData($TARGETPROGRESS, $i) Sleep($iWait) $iSavPos = $i Next Until $iSavPos = 100 _GUICtrlTreeView_BeginUpdate($TARGETTREE) ListFiles_FolderTARGET($VAR & "\", 0) _GUICtrlTreeView_EndUpdate($TARGETTREE) EndFunc ;------------------------------------------------------------------------------------------------------------------------------------------- Func ListFiles_FolderSOURCE($SourceFolder, $Item) Local $File If StringRight($SourceFolder, 1) <> "" Then $SourceFolder &= "" Local $Search = FileFindFirstFile($SourceFolder & "*.*") If $Search = -1 Then Return While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If @extended Then ListFiles_FolderSOURCE($SourceFolder & $File, _GUICtrlTreeView_AddChild($SOURCETREE, $Item, $File)) Else _GUICtrlTreeView_AddChild($SOURCETREE, $Item, $File) EndIf WEnd FileClose($Search) EndFunc ;------------------------------------------------------------------------------------------------------------------------------------------- Func ListFiles_FolderTARGET($TargetFolder, $Item) Local $File If StringRight($TargetFolder, 1) <> "" Then $TargetFolder &= "" Local $Search = FileFindFirstFile($TargetFolder & "*.*") If $Search = -1 Then Return While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If @extended Then ListFiles_FolderTARGET($TargetFolder & $File, _GUICtrlTreeView_AddChild($TARGETTREE, $Item, $File)) Else _GUICtrlTreeView_AddChild($TARGETTREE, $Item, $File) EndIf WEnd FileClose($Search) EndFunc ;------------------------------------------------------------------------------------------------------------------------------------------- Func COPY() $VAR = GUICtrlRead($SOURCETREE) If $VAR = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning!", "No item currently selected") Else $sText = GUICtrlRead($VAR, 1) ; Get the text of the treeview item If $sText == "" Then MsgBox($MB_SYSTEMMODAL, "Warning!", "Error while retrieving info about selected item") Else MsgBox($MB_SYSTEMMODAL, "FileManager", "Current item selected is: " & $sText) EndIf EndIf EndFunc ;------------------------------------------------------------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------------------------------------------------------------
  19. I know this ain't much (nothing for autoit experts) but can help someone who was looking for a selectable label (I used the hex values to avoid #include <EditConstants.au3>, the vars are in comment in front of the 2nd line) $Form1 = GUICreate("Test", 351, 50) $Label1 = GUICtrlCreateEdit("Selectable Label", 10, 4, 176, 20, 0x0800,0x00000020) ;$ES_READONLY, $WS_EX_TRANSPARENT GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit EndSwitch WEnd PS: I think the same could be accomplished with GUICtrlCreateInput()
  20. I have 2 listviews and two buttons to move the items from one list to the other (One ">>" button and one "<<"). Now, when I select an item and press the >> button (The left listview1 is full while the right listview2 is empty) it puts this item into the other list. Now it seems like no item on the left list is selected, but when I press the >> button again, it copys the item that was below the item I moved over to the other list. (Now this item is on both lists) I can repeat that, so the item is on hte right list multiple times. Why? And how can I stop that? Here's the code I am using: $selectedwah = _GUICtrlListView_GetItemTextString($List1wah, _GUICtrlListView_GetSelectionMark($List1wah)) If $selectedwah = "|" OR $selectedwah = "||" Then Else MsgBox(0,"",$selectedwah) GUICtrlCreateListViewItem($selectedwah, $List2wah) _GUICtrlListView_DeleteItemsSelected($List1wah) $aSorting = False _GUICtrlListView_SimpleSort($List2wah, $aSorting, 0) $selMessd = _GUICtrlListView_GetItemCount($List2wah) GUICtrlSetData($Label3wah, $selMessd & " Messdiener") EndIf
  21. This code loads the result of a regread into a variable and then parses the result: $RegResult = RegRead($HKLM & "\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters", "AutoShareWks") Select Case $RegResult = "" $RegWriteResult = RegWrite($HKLM & "\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters", "AutoShareWks", "REG_DWORD", "0") TrayTip("Registry Read", "AutoShareWks Reg key not found and was created. The read result was: " & $RegResult & " " & @error & _ ". The write result was: " & $RegWriteResult & " " & @error, 5) Case $RegResult = "0" ; 0 indicates sharing is off TrayTip("Registry Read", "Auto Drive Sharing is currently DISABLED.", 5) Case $RegResult = "1" ; 1 indicates sharing is on TrayTip("Registry Read", "Auto Drive Sharing is currently ENABLED", 5) EndSelect The problem is that the value of AutoShareWks is boolean and either 1 or 0. The documentation for regread states that if failure of the regread, "" is returned. However it seems to also interpret 0 as "" and trigger a false failure. Even @error has the same issue. If the reading value is 0, @error will trigger. So, how can I get around this false failure trigger? EDIT: I figured out a work around like this: $RegResult = RegRead($HKLM & "\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters", "AutoShareWks") Select Case $RegResult = "0" ; 0 indicates sharing is off TrayTip("Registry Read", "Auto Drive Sharing is currently DISABLED.", 5) Case $RegResult = "1" ; 1 indicates sharing is on TrayTip("Registry Read", "Auto Drive Sharing is currently ENABLED.", 5) Case Else ; Default Actions TrayTip("Registry Read", "AutoShareWks value not present in registry. Auto Drive Sharing is currently ENABLED.", 5) EndSelect However, still....... Why is the error process not catching it correctly?
  22. so my script was made to load drivers based on a selection from a combo box. i've created a VERY robust system to load drivers when imaging with wds or ghost using a winPE wim. WDS does not work correctly with injected drivers. so comes into play my script/program that loads from a winPE wim after wds loads. anyone knows WDS is pretty powerful but it does not always have proper drivers once the winPE loads. so my program loads drivers into winPE based on the model / device. so if we get a new model of laptop or desktop and we want to save up that image to wds we find 32bit drivers and we load them into my program. wds then in turn loads my winPE with my program set to autolaunch and presenting all these options. if winPE contained a generic driver then all is good. if not then we go through my list and usually one of the drivers does work but in case it doesn't we add to my list. that's just the pre-amble incase anyone asks what i'm doing. reminder that this has worked flawlessly for the better part of a year. but now with more devices it's getting cumbersome to manually edit my code, then compile, then mount edit and recompile the winPE wim and inject my autoit program into it. takes a maximum of 5 minutes but when you're constantly testing it gets VERY bad. here's a snippet of the array for the combobox. Local $aList[300][2] = [["___________", "___________"], _ ["ASUS", "ASUS"], _ ["HP Probook 4430s", "HP Probook 4430s"], _ ["Lenovo S10-3", "Lenovo S10-3"], _ ["Lenovo x200/x230", "Lenovo x200/x230"], _ so this populates a combo box that lists these entries. i use a case select to determine which box was selected. very manual editing when i need to add another device. Func selection() $sSel = GUICtrlRead($cb_platform) $iIndex = _ArraySearch($aList, $sSel) Select Case $iIndex = 1 ;~ ASUS $driver = (@scriptdir & "\drivers\hp32\Netrtl32.inf") $nothing = $option Case $iIndex = 2 ;~ HP Probook 4430s $driver = (@scriptdir & "\drivers\hp4430\hp86win7.inf") $nothing = $option Case $iIndex = 3 ;~ Lenovo S10-3 $driver = (@scriptdir & "\drivers\lenovos103\Netrtl32.inf") $nothing = $option EndFunc this is the part of the script which i'm trying to revamp. right now my script works very awesome for what we're doing. however i want it more streamlined. as you can see once a combobox selection is selected, then it goes to that CASE and populates those variables then it kicks down to a function that i have that continues either ghost or wds depending on a selected radio box. this is what i have now for the array for the combobox. $drivers_folder=_FileListToArray(@scriptdir & "\drivers\","*",2) $cb_platform = GUICtrlCreateCombo("",10,40,600,120,-1,-1) For $i=1 To Ubound($drivers_folder)-1 GUICtrlSetData($cb_platform,$drivers_folder[$i]) Next this populates the combox based on the folder i have with each individual device. instead of creating a long winded array. the problem i have now is i don't know how to make it load the driver within that folder without a case select. i was thinking maybe something that got the name of the folder selected, then appended a "*.inf" at the end to load. but i'm totally in the dark of how to do this. if you'd like me to post all my code to help, please let me know.
  23. I'm just learning sqlite3 forgive me if my concepts are not right, anyway I'm trying to add two variables to a SELECT statement: The variables would be $start and $end that the user would choose from a Combobox. The database holds 1 table (Distances) that has the distances between two locations ($start and $end). In the code that follows (if possible) how can I place $start where "Midlothian MS" is and $end where "School Board" is in the Select statement? I've tried several types of concatenation but no joy. Here is the schema: CREATE TABLE fulldata (id integer primary key autoincrement, Start text,End text ,Distance integer); _SQLite_Startup() ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF) _SQLite_Open('distance.db') ; open Database _SQLite_QuerySingleRow(-1, "SELECT distance FROM fulldata WHERE Start = 'Midlothian MS' AND End = 'School Board';", $aRow) _SQLite_Close() _SQLite_Shutdown() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0, "The distance is:",$aRow[0]) Case $Button2 _ArrayToClip($aRow, 0) ;send result to clipboard EndSwitch WEnd Thanks for your help, ihudson
  24. I'm creating a small MsgBox-style GUI window for a login, and I'm giving my $Username input box the default text "DOMAIN\Username". When I run it, the default text is highlighted as expected, but it'd be nicer if I could highlight only the username portion. I realize I could use multiple input fields, but I'd rather not. I'm currently accomplishing this by: GUISetState(@SW_SHOW) Send("{END}+{LEFT 8}")and that technically works, but I was wondering if there was a "right" way to do this.
  25. I want to do several Pixelsearches on my Screen to find out if i can find the Chrome Browser ^^ Instead of one big search on the screen i run $pixesearch1,$pixesearch2,$pixesearch3 etc. on a sliced up Screen. I have done something similar before.. But i wanted to ask if i should use Switch or Select? Do they only run ONE of their cases? or run as many cases that are True?
×
×
  • Create New...