Leaderboard
Popular Content
Showing content with the highest reputation on 07/13/2018 in all areas
-
Hello you could do this: (tested with Excel 2013) #include <Array.au3> #include <WinAPI.au3> Local $aBooks[0][3] Local Const $OBJID_NATIVEOM = 0xFFFFFFF0 Local $hExcelControl = ControlGetHandle("[CLASS:XLMAIN]", "", "EXCEL71") Local $tGUID = _WinAPI_GUIDFromString('{00020400-0000-0000-C000-000000000046}') ;IID_IDispatch Local $pGUID = DllStructGetPtr($tGUID) Local $aCall = DllCall("Oleacc.dll", "long", "AccessibleObjectFromWindow", "hwnd", $hExcelControl, "dword", $OBJID_NATIVEOM, "ptr", $pGUID, "idispatch*", 0) If $aCall[0] = $S_OK Then Local $oExcel = $aCall[4].Application ReDim $aBooks[$oExcel.Workbooks.Count][3] Local $iIndex = 0 For $oWorkbook In $oExcel.Workbooks $aBooks[$iIndex][0] = $oWorkbook $aBooks[$iIndex][1] = $oWorkbook.Name $aBooks[$iIndex][2] = $oWorkbook.Path $iIndex += 1 Next _ArrayDisplay($aBooks) EndIf Tested with 100 workbooks. It takes about 500 milliseconds for listing in my machine. Saludos2 points
-
In the forums you can find several questions about how to edit the text in a ListView cell with a standard control eg. an Edit control or a ComboBox. The zip below contains three examples with an Edit control, a ComboBox and a DateTimePicker. How? A description from MicroSoft of how to edit a ListView cell with a ComboBox can be found here. When you click a cell the position and size is calculated, and the ComboBox is created on top of the cell. The text is shown in the Edit box. You can edit the text or select a value in the Listbox. Press Enter to save the text in the ListView cell and close the ComboBox. The ComboBox exists only while the text is edited. Code issues Especially because the control to edit the ListView cell is created on top of the ListView and is not part of the ListView, there are some issues you should be aware of. To get everything to look as good as possible most actions should be carried out when a mouse button is pressed and not when it's released. You should also be aware that the new code you add, does not conflict with existing functionality for example multiple selections. The examples consists of small but fairly many pieces of code to respond to events and messages. Keyboard support To edit a text value you are more or less forced to use the keyboard to type in the text. It would be nice if you could also select the current cell in the ListView with the keyboard. Cell selection with the keyboard is not too hard to implement with custom draw code. The current cell is drawn with a specific background color. It looks like this. You can select the current cell with the arrow keys. Open the control There must be a way to initiate the creation of the control. This is typically done with a single or double click in the ListView. Or with Enter or Space key in the examples with keyboard support. Default in the examples is double click and Enter key. You can change this in global variables in top of the scripts. A WM_NOTIFY message handler created with GUIRegisterMsg is used to watch for single and double click in the ListView. This message handler is also used to handle custom draw messages for keyboard support. Because the control is created on top of the ListView cell, it's very important that the ListView is set as the parent window. This ensures that mouse clicks and key presses are captured by the control and not by the ListView. Events in the control In a ComboBox and a DateTimePicker an additional control (Listbox and MonthCal, respectively) is opened if you click the Dropdown arrow (or press <Alt+Down arrow> on the keyboard). Click the Dropdown arrow again to close the control (or press <Alt+Up arrow> on the keyboard). The interesting messages (DROPDOWN, SELECTION, CLOSEUP) from such an additional control are usually contained in WM_COMMAND or WM_NOTIFY messages which are sent to the parent window. The parent window is the ListView. To catch the messages the ListView must be subclassed. Messages from the Edit control, the Edit box of the ComboBox, or the client area of the DateTimePicker are catched by subclassing the controls (Edit control, Edit box and DateTimePicker) directly. The interesting information here is dialog codes to accept (Enter) or cancel (Esc) the value and close the control. Dialog codes are sent as $WM_GETDLGCODE messages. In all examples the value in the control can also be accepted and saved with a double click. Close the control A mouse click in the ListView outside the control should close the control and cancel editing of the current cell. Because the control is not part of the ListView in particular mouse clicks on the Scrollbars should close the control immediately. The control will not be repainted properly on scrolling. Mouse clicks in the ListView and on Scrollbars can be identified by WM_LBUTTONDOWN and WM_NCLBUTTONDOWN messages. The area which is filled by Scrollbars in a ListView is non-client area. Mouse clicks in non-client area generates WM_NCLBUTTONDOWN messages. To catch the messages you have to subclass the ListView. A mouse click in the GUI outside the ListView and in non-client GUI area (eg. the Titlebar) should also close the control. Mouse clicks in GUI are catched through GUI_EVENT_PRIMARYDOWN messages. Mouse clicks in non-client GUI area are catched through WM_NCLBUTTONDOWN messages by subclassing the GUI. Finish the code A great part of the code is running in message handlers created with GUIRegisterMsg or created by subclassing a window. Lengthy code to open or close the control should not be executed in these message handlers. Instead of a message is sent to the AutoIt main loop where the control is opened or closed. Some of the message handlers are only needed while the control is open. They are created and deleted as part of the control open and close code. In the context of the updates May 26 the $LVS_EX_HEADERDRAGDROP extended style (rearranging columns by dragging Header items with the mouse) is added to all ListViews. See post 20 and 21. A few lines of code are added to better support usage of the keyboard. See image above. The code provides for horizontal scrolling of the ListView to make sure that a subitem (or column) is fully visible when it's selected with left or right arrow. Among other things, the code takes into account rearranging and resizing of columns as well as resizing of the GUI and ListView. A new example EditControlKeyboardTenCols.au3 demonstrates the features. See post 22. A few lines of code is added to handle multiple selections. Multiple selections is enabled in all examples. Pressing the Tab key in the control closes the control. The image shows a DateTimePicker control. Zip file The zip contains three examples with an Edit control, a ComboBox and a DateTimePicker. For each control there are two scripts with and without keyboard support. In the script with keyboard support you can select the current cell in the ListView with the arrow keys and open the control with the Enter (default) or the Space key. You need AutoIt 3.3.10 or later. Tested on Windows 7 32/64 bit and Windows XP 32 bit. Comments are welcome. Let me know if there are any issues. (Set tab width = 2 in SciTE to line up comments by column.) ListViewEditingCells.7z1 point
-
... and you think this will make it clearer for me? How does this align with the first post? So, let's try again and this time try to make some sense for an old fart like me that doesn't have the faintest clue what you are on about. Jos1 point
-
So i think @iamtheky is right. Every Solution Change Number seems to be unique. I've checked in a SQLite database and made a quick look over of ID's + handpicked a few for manual match test. Edit: Copying a row from table A to table B and running the Query in reverse is evidence enough, i would say? Query: SELECT * FROM (SELECT * FROM A UNION SELECT * FROM B) WHERE SolutionChange IN (SELECT SolutionChange FROM A WHERE A.SolutionChange IN (SELECT SolutionChange FROM B) UNION SELECT SolutionChange FROM B WHERE B.SolutionChange IN (SELECT SolutionChange FROM A)) Note: I changed the type and DescriptionofIssue column values before adding it to table B1 point
-
so @Chimp's result would be expected with input where A and B do not share any commonalities (like the files provided...)? Do you get two sets of the headers if you include row 0?1 point
-
Drag and Drop
FrancescoDiMuro reacted to JLogan3o13 for a topic
@Meg did you happen to notice this post is over 9 years old? Autoit is constantly growing and changing as a language; what worked a decade ago may not work the same now (hopefully it is easier). This is one reason we discourage people from resurrecting very old threads. You will get a lot better response if you simply create a new thread, explaining what you are trying to do (in as much detail as possible), what you have tried on your own (post your code) and what issues, errors, etc. you're having.1 point -
You're right, here is a mod. #include <Excel.au3> #include <Array.au3> #include <WinAPI.au3> Local $oExcel1 = _Excel_Open() Local $oExcel2 = _Excel_Open(True, False, True, True, True) Local $oExcel3 = _Excel_Open(True, False, True, True, True) For $i = 1 To 5 _Excel_BookNew($oExcel1, 1) _Excel_BookNew($oExcel2, 1) _Excel_BookNew($oExcel3, 1) Next Local $hTimer = TimerInit() Local $aWorkBooks = _Excel_BookList() _ArrayDisplay($aWorkBooks, " _Excel_BookList Time: " & TimerDiff($hTimer)) $hTimer = TimerInit() Local $aWorkBooks = _Excel_BookListEx() _ArrayDisplay($aWorkBooks, " _Excel_BookListEx Time: " & TimerDiff($hTimer)) _Excel_Close($oExcel1) _Excel_Close($oExcel2) _Excel_Close($oExcel3) Func _Excel_BookListEx($oExcel = Default) Local Const $OBJID_NATIVEOM = 0xFFFFFFF0 Local $aBooks[0][3], $iIndex = 0 If IsObj($oExcel) Then If ObjName($oExcel, 1) <> "_Application" Then Return SetError(1, 0, 0) Local $iTemp = $oExcel.Workbooks.Count ReDim $aBooks[$iTemp][3] For $iIndex = 0 To $iTemp - 1 $aBooks[$iIndex][0] = $oExcel.Workbooks($iIndex + 1) $aBooks[$iIndex][1] = $oExcel.Workbooks($iIndex + 1).Name $aBooks[$iIndex][2] = $oExcel.Workbooks($iIndex + 1).Path Next Else If $oExcel <> Default Then Return SetError(1, 0, 0) Local $aExcelInstances = __GetExcelInstances() Local $tGUID = _WinAPI_GUIDFromString('{00020400-0000-0000-C000-000000000046}') ;IID_IDispatch Local $pGUID = DllStructGetPtr($tGUID) Local $hExcelControl = 0 Local $aCall = 0 For $i = 0 To UBound($aExcelInstances) - 1 $hExcelControl = ControlGetHandle($aExcelInstances[$i], "", "EXCEL71") $aCall = DllCall("Oleacc.dll", "long", "AccessibleObjectFromWindow", "hwnd", $hExcelControl, "dword", $OBJID_NATIVEOM, "ptr", $pGUID, "idispatch*", 0) If $aCall[0] = $S_OK Then $oExcel = $aCall[4].Application ReDim $aBooks[UBound($aBooks) + $oExcel.Workbooks.Count][3] For $oWorkbook In $oExcel.Workbooks $aBooks[$iIndex][0] = $oWorkbook $aBooks[$iIndex][1] = $oWorkbook.Name $aBooks[$iIndex][2] = $oWorkbook.Path $iIndex += 1 Next EndIf Next EndIf Return ($iIndex > 0 ? SetError(0, $iIndex, $aBooks) : SetError(1, 0, $aBooks)) EndFunc ;==>_Excel_BookListEx Func __GetExcelInstances() Local $aIntances[0] Local $aWindowIntances[0] Local $aWindows = WinList("[CLASS:XLMAIN]") If IsArray($aWindows) Then Local $iFind = 0 Local $iPID = 0 For $i = 1 To $aWindows[0][0] $iPID = WinGetProcess($aWindows[$i][1]) $iFind = _ArraySearch($aIntances, $iPID) If $iFind = -1 Then _ArrayAdd($aIntances, $iPID) _ArrayAdd($aWindowIntances, $aWindows[$i][1]) EndIf Next EndIf Return $aWindowIntances EndFunc ;==>__GetExcelInstances Saludos1 point
-
Function _PathSplit should do what you want.1 point
-
Try For $i = 0 To $iCols - 1 $aRows = _FFXPath($sTable & "//tr//td[" & $i + 1 & "]", $sReturnMode, 6, $iFilter) If IsArray($aRows) Then _ArrayDisplay($aRows) EndIf If $aRows[0] > 0 Then For $j = 0 To $iRows - 1 $aTable[$j][$i] = $aRows[$i + 1] Next EndIf Next And see how many rows there are. And then compare it to [$I + 1]1 point
-
Hi @Deye. here's what i expect are the solution you want? #AutoIt3Wrapper_Res_File_Add=C:\Users\me\Desktop\88x31.jpg #AutoIt3Wrapper_Res_Icon_Add=C:\Users\me\Desktop\logo.ico #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include 'WinAPIFiles.au3' #include "File.au3" ; Script Start - Add your code below here Local $bFileInstall = False ; Change to True and ammend the file paths accordingly. ; This will install the file C:\Test.bmp to the script location. If $bFileInstall Then FileInstall("C:\Test.bmp", @ScriptDir & "\Test.bmp") $sFile = FileRead(@ScriptFullPath) $pattern = '(?(DEFINE) (?<string>(["''''])((?!\2).)*\2))(?:#include ((?&string))|FileInstall\(((?&string))|#AutoIt3Wrapper_Res_[a-zA-Z]+_Add=([^\n]+))' $aResults = StringRegExp($sFile, $pattern, 3) _ArrayDisplay($aResults) Dim $aResult[0] For $i=0 To UBound($aResults)-1 If StringLen($aResults[$i])>0 Then ReDim $aResult[UBound($aResult)+1] $aResult[UBound($aResult)-1] = StringRegExpReplace($aResults[$i], '^(["''''])(.*)\1', "$2") EndIf Next _ArrayDisplay($aResult)1 point
-
https://www.autoitscript.com/forum/topic/194687-image-search-error/1 point
-
image search - (Moved)
ibrahem reacted to JLogan3o13 for a topic
Moved to the appropriate forum. Moderation Team1 point -
Those who post vague questions are not only wasting their own time but also the time of those replying. So please provide the following to help those who help you. #include <Misc.au3> ; Version: 1.00. AutoIt: V3.3.8.1 ; Retrieve the recommended information of the current system when posting a support question. Local $sSystemInfo = 'I have a valid AutoIt support question and kindly provide the details of my system:' & @CRLF & @CRLF & _ 'AutoIt Version: V' & @AutoItVersion & ' [' & _Iif(@AutoItX64, 'X64', 'X32') & ']' & @CRLF & _ 'Windows Version: ' & @OSVersion & ' [' & @OSArch & ']' & @CRLF & _ 'Language: ' & @OSLang & @CRLF & @CRLF & _ 'The following information has been copied to the clipboard. Use Ctrl + V to retrieve the following information.' MsgBox(4096, 'System Info', $sSystemInfo) ClipPut($sSystemInfo)1 point
-
image search - (Moved)
ibrahem reacted to anthonyjr2 for a topic
Do you have the .dlls for the architecture you're trying to run in the correct folder? This UDF is super finicky when it comes to seeing the libraries.0 points