Jump to content

rony2006

Active Members
  • Posts

    196
  • Joined

  • Last visited

Recent Profile Visitors

349 profile views

rony2006's Achievements

Prodigy

Prodigy (4/7)

0

Reputation

  1. Yes, you are right. Sorry. But anyway I didnt knew until now that i need to put "execute". Thanks!
  2. Thanks a lot. you saved me at least 1 hour.
  3. is true, but we use a remote MySQL database, multiple people use this software and sometimes they work on same sheet of checkboxes so there should be some sync between them.
  4. No because the array is 0 based. Look at the pic. [3][0] is the name of checkbox and [3][1] tells me if i should set it checked or unchecked.
  5. Hello, In my gui i have 90 checkboxes that I read and I store their value in a MySQL database. In this way I am able to save state of each checkbox. Now I also need to be able to read what is in database stored and then check or uncheck the boxes. For $iz = 3 To $iRows - 1 if $linknew11a[$iz][1] = "True" Then GUICtrlSetState($linknew11a[$iz][0], $GUI_CHECKED) EndIf Next $linknew11a[$iz][0] - tell me if the checkbox is True (checked) or False (Unchecked). $linknew11a[$iz][1] - is the controlID of the checkbox (including $ sign). The problem is that GUICtrlSetState($linknew11a[$iz][0], $GUI_CHECKED) doesnt work because instead of $linknew11a[$iz][0] which basically is the string of controlID and I need to somehow convert this string into the real variable of the controlID. Any ideas how I can do this? If not I will need to write 90 times the if condition...
  6. Thanks, I found a working example for this and I adapted to my code: #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #Include <GuiListView.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Purple Sheets", 376, 550, -1,-1) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $ListViewExp = GUICtrlCreateListView("", 8, 16, 106, 382, $LVS_SHOWSELALWAYS) $ListViewLind = GUICtrlCreateListView("", 130, 16, 106, 382, $LVS_SHOWSELALWAYS) $ListViewScott = GUICtrlCreateListView("", 256, 16, 106, 382, $LVS_SHOWSELALWAYS) _GUICtrlListView_AddColumn($ListViewExp, "Expected", 85) _GUICtrlListView_AddColumn($ListViewLind, "Lindsey", 85) _GUICtrlListView_AddColumn($ListViewScott, "Scott", 85) _GUICtrlListView_AddItem($ListViewExp, "testing1", 0) _GUICtrlListView_AddItem($ListViewLind, "testing2", 0) _GUICtrlListView_AddItem($ListViewScott, "testing3", 0) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ;~ Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($ListViewExp)] GUISetState(@SW_SHOW) While 1 Sleep (100) Wend Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView1 = GUICtrlGetHandle($ListViewExp) $hWndListView2 = GUICtrlGetHandle($ListViewLind) $hWndListView3 = GUICtrlGetHandle($ListViewScott) ;~ If Not IsHWnd($ListViewExp) Then $hWndListView = GUICtrlGetHandle($ListViewExp) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView1 Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $text = _GUICtrlListView_GetItemText ($ListViewExp, DllStructGetData($tInfo, "Index")) MsgBox (0, "you clicked on", $text) EndSwitch Case $hWndListView2 Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $text = _GUICtrlListView_GetItemText ($ListViewLind, DllStructGetData($tInfo, "Index")) MsgBox (0, "you clicked on", $text) EndSwitch Case $hWndListView3 Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $text = _GUICtrlListView_GetItemText ($ListViewScott, DllStructGetData($tInfo, "Index")) MsgBox (0, "you clicked on", $text) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _Exit () Exit EndFunc
  7. Hello, In my script i have 2 different listview and I need for each of them to trigger different functions for double click on listview item. Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ;~ Local $tBuffer $hWndListView = $lista_poze If Not IsHWnd($lista_poze) Then $hWndListView = GUICtrlGetHandle($lista_poze) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView if $iCode = $NM_DBLCLK Then $lapofilename = _GUICtrlListView_GetItemText($lista_poze, _GUICtrlListView_GetHotItem($lista_poze)) shellexecute(@ScriptDir & "\Dosare\" & GUICtrlRead($nr_inmatriculare) & "\Poze\Initiale\Resize\" & $lapofilename) EndIf if $iCode = $NM_CLICK Then $lapofilename = _GUICtrlListView_GetItemText($lista_poze, _GUICtrlListView_GetHotItem($lista_poze)) ;msgbox(0, "", $lapofilename) ;shellexecute(@ScriptDir & "\Dosare\" & GUICtrlRead($nr_inmatriculare) & "\Poze\Initiale\Resize\" & $lapofilename) GUICtrlSetImage($imagine, @ScriptDir & "\Dosare\" & GUICtrlRead($nr_inmatriculare) & "\Poze\Initiale\Resize\" & $lapofilename) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY This code works good for list $lista_poze but I have another list and I dont know how to integrate it in WM_notify. How can I make $hWndListView to accept 2 different listviews?
  8. Hi, How I can use this to predict middle words? My array contains strings like "word1 another" If I write "wor" then the string gets predicted and is fine, but how I can predict same string by typing "anot" for example (first letters from 2nd word from the string). Thanks!
  9. Hi, Sorry if has been discussed already but I have no idea what to search for. I have a small project for someone that want a software to be able to fill some forms and then to generate a PDF with data from the forms. The PDF should have a standard format. I was thinking to do an Excel template and then using Autoit Excel functions to write data to it and save it as a PDF file. The problem is that I need somehow to hide that excel template. I can have an .au3 or .exe file and a folder where I put all resources but I dont want to let other people by themselves to edit the template and to generate other kind of PDF. I am thinking if is possible to convert the excel template into a string, store the string inside a text file and when software is using it to convert the string back to excel and then to delete it after PDF is generated. What do you think?
  10. Thanks @Melba23 I implemented and it seams that it works but there is a issue: I dont get actually the row select the same as I click on it (the blue color). But row is getting selected some how because on my list I have only 10 rows available without scroll. If i sent _GUIListViewEx_SelectItem(15), my list automatically scrolls so I will have item 15 on the screen visible. I disabled _GUIListViewEx_LoadColour() but the effect is the same. I am using 2 listview on the gui. And also i used _GUIListViewEx_SetActive($iLVIndex_1) before the function. I will try to make a simple script to show you the issue.
  11. Hello, I am using _GUIListViewEx to display a list with some elements. I was able to double click on a element and get the row of selected item. Now I need to select a row, without double click, meaning I need to be able programmatically to select a item in the list. I dont think I can use colors because my list is already colored based on values from cells. I tried to change the color of a specific row, but then when i change the color of the next one, the previous one doesnt reset his color to the color set by the value. Is there an equivalent of the following? _GUICtrlListView_SetItemSelected($idListview, 1)
  12. Sorry i think i didnt explained correctly. Let me give another example: I have a slider, minimum value return by slider is 0 and maximum value returned by slider is 100. I have a car that have a speed between 20 km/h (minimum) and 120 km/h maximum. In my function I will input 20 as min and 120 as max (considering that 0 and 100 are always standard). Now I will move my slider at a value of 64 (as I said, slider can go from 0 to 100), and I want to have the speed of my car. How I can calculate this?
  13. Hi, I dont remember what is the name of an AutoIT function that allows you to set a value to another value. For example I have 2 variables: a = 4 and b = 14 this function allows me to say that 4 = 0 and 14 = 100 then if i would use the function value of 50, my return value is the middle between 4 and 14. Sorry if i didnt explained it correctly.
  14. Hello, I have a problem: Basically i want to sort a 2d array using one column that contains numeric values. My code looks like this: For $iz = 1 To UBound($CCinvoices) -1 $CCinvoices[$iz][1] = StringReplace($CCinvoices[$iz][1], " ", "") $CCinvoices[$iz][1] = Number($CCinvoices[$iz][1]) Next _Arraydisplay($CCinvoices, "$CCinvoices") _ArraySort($CCinvoices, 1, 0, 0,1) _Arraydisplay($CCinvoices, "$CCinvoices") This is how array looks before sorting. After i sort the array, I got the following result: As you see 227.21 was sorted after 29.79 so i dont know why i got this. I tried the following solutions: 1) Removing blank spaces 2) Converting strings to Number before sorting. Any ideas?
  15. #include <Array.au3> $iRequiredSum = 3591226 Global $aArray = [1378908,1634314,15713665,1149042,1797187,18754341,1429697,1509035,13257814,1811223,1508925,13817384,2100215,1540744,12836514,1616225,1444406,12190430,1653099,620083,4901735] Global $Valori[1][3] ; Increase the number of factors on each pass For $iSet = 1 To UBound($aArray) ; Determine the possible combinations $aCombinations = _ArrayCombinations($aArray, $iSet, "+") ; For each combination For $j = 1 To $aCombinations[0] ; Break into factors $aFactors = StringSplit($aCombinations[$j], "+") ; Sum factors $iSum = 0 For $k = 1 To $aFactors[0] $iSum += $aFactors[$k] Next ConsoleWrite($j & @crlf) if abs($iRequiredSum - $iSum) < $iRequiredSum / 4 Then _ArrayAdd($Valori, $aCombinations[$j] & "=" &$iSum & "=" & abs($iRequiredSum - $iSum), 0,"=") endif ; If sum is required value Next Next ;_ArraySort($Valori, 0, 0, 0, 2) ;_arraydisplay($Valori) exit #include <Excel.au3> #include <MsgBoxConstants.au3> ; Create application object and create a new workbook Local $oExcel = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookNew($oExcel) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf ; Write a part of a 2D array to the active sheet in the active workbook ;Local $aArray2D[3][5] = [[11, 12, 13, 14, 15], [21, 22, 23, 24, 25], [31, 32, 33, 34, 35]] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $Valori, "B1") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 3", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 3", "2D array successfully written.") I adjusted the code to fit my needs but I noticed 2 problems: If I store the resulted sum in a array and then I sort that array to get the smallest different then sorting is not correct. Another things is that is taking a lot of time to calculate. I added there a condition that the array should be filled only if the difference is smaller then 25% of the required sum but still didnt improved a lot the speed. Current code finished filling the array in >Exit code: 0 Time: 479.3 Any ideas?
×
×
  • Create New...