Leaderboard
Popular Content
Showing content with the highest reputation on 02/11/2015 in all areas
-
Chrome UDF
Velislav reacted to seangriffin for a topic
Chrome support for AutoIT is here! This UDF includes a Chrome Extension (http://developer.chrome.com/extensions/getstarted.html) and Native Messaging Host (http://developer.chrome.com/extensions/messaging.html#native-messaging-host) that integrate with a new Chrome UDF (Chrome.au3) to provide automation support for the Chrome browser. Several steps are required to install the Chrome Extension and Native Messaging Host prior to using the UDF. Please read the INSTALLATION section below. REQUIREMENTS: Windows XP 32-bit, Windows 7 32-bit or Windows 7 64-bit AutoIt3 3.2 or higher Chrome v29 or later (earlier versions are untested) AutoIT for Google Chrome (Chrome extension - see below) AutoIT Chrome Native Messaging Host (see below) INSTALLATION: STEP 1: Install the AutoIT extension into Chrome. Open the following link and download the file named AutoIT for Google Chrome.crx: https://docs.google.com/file/d/0B_6JmwNIIZ06enotRTVFNVdKOXM/edit?usp=sharing Note - you may be prompted to login with a Google account as this file is hosted on Google Drive. In your Chrome browser click on the Chrome menu, then select Tools -> Extensions. Drag the AutoIT for Google Chrome.crx file that you downloaded above, from Windows Explorer, into this page in Chrome. You should now see AutoIT for Google Chrome listed in the Extensions page in Chrome. Ensure that the Enabled checkbox next to AutoIT for Google Chrome is checked. Also make sure the Allow access to file URLs box is checked (very important to make EXAMPLE 2 work below)!! STEP 2: Install the AutoIT Chrome Native Messaging Host. Open the following link and download the file named autoit_chrome_native_messaging_host_install.exe: https://docs.google.com/file/d/0B_6JmwNIIZ06eDgxaVJPNUNxa28/edit?usp=sharing Note - you may be prompted to login with a Google account as this file is hosted on Google Drive. Run this file (autoit_chrome_native_messaging_host_install.exe). An installation window will display. Click the Install button. The window will display "Completed" and you can click the Close button. STEP 3: Install the Chrome UDF into AutoIT. Scroll to the DOWNLOAD section below, and save the Chrome.au3 file into your AutoIT Include folder (C:Program FilesAutoIt3Include). Please close your Chrome browser once you've completed these steps. LIST OF FUNCTIONS: EXAMPLE #1: This following example starts up Chrome and navigates to the URL http://www.december.com/html/demo/form.html. It then automatically completes the HTML form in this page (a series of text, radio, and checkbox input elements and select elements) and clicks the Send this survey button. The script waits for the next page to load, and retrieves the various elements from the page to the AutoIT console. chrome_example.au3 EXAMPLE #2: The following is an example of the automation of an offline HTML page (file URL). First, download the file named chrome_udf_example_2.html to your C: folder: https://docs.google.com/file/d/0B_6JmwNIIZ06SWduMjZGTVViNlU/edit?usp=sharing Then run the following AutoIT script: chrome_example_2.au3 Note that you must have checked the Allow access to file URLs box in the Chrome extension to make this work! DOWNLOAD: Latest Version - v0.5 (29/09/13) Chrome.au31 point -
For those who use ListViews and wish to call a Function to grab the contents of the ListView into a 2D array, then _GUICtrlListView_CreateArray() is for you. It will Return an array with the contents of the ListView inc. the number of rows, columns & column names. Simply run the Example to get an idea of the output. Thanks. Function: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GUICtrlListView_CreateArray ; Description ...: Creates a 2-dimensional array from a listview. ; Syntax ........: _GUICtrlListView_CreateArray($hListView[, $sDelimeter = '|']) ; Parameters ....: $hListView - Control ID/Handle to the control ; $sDelimeter - [optional] One or more characters to use as delimiters (case sensitive). Default is '|'. ; Return values .: Success - The array returned is two-dimensional and is made up of the following: ; $aArray[0][0] = Number of rows ; $aArray[0][1] = Number of columns ; $aArray[0][2] = Delimited string of the column name(s) e.g. Column 1|Column 2|Column 3|Column nth ; $aArray[1][0] = 1st row, 1st column ; $aArray[1][1] = 1st row, 2nd column ; $aArray[1][2] = 1st row, 3rd column ; $aArray[n][0] = nth row, 1st column ; $aArray[n][1] = nth row, 2nd column ; $aArray[n][2] = nth row, 3rd column ; Author ........: guinness ; Remarks .......: GUICtrlListView.au3 should be included. ; Example .......: Yes ; =============================================================================================================================== Func _GUICtrlListView_CreateArray($hListView, $sDelimeter = '|') Local $iColumnCount = _GUICtrlListView_GetColumnCount($hListView), $iDim = 0, $iItemCount = _GUICtrlListView_GetItemCount($hListView) If $iColumnCount < 3 Then $iDim = 3 - $iColumnCount EndIf If $sDelimeter = Default Then $sDelimeter = '|' EndIf Local $aColumns = 0, $aReturn[$iItemCount + 1][$iColumnCount + $iDim] = [[$iItemCount, $iColumnCount, '']] For $i = 0 To $iColumnCount - 1 $aColumns = _GUICtrlListView_GetColumn($hListView, $i) $aReturn[0][2] &= $aColumns[5] & $sDelimeter Next $aReturn[0][2] = StringTrimRight($aReturn[0][2], StringLen($sDelimeter)) For $i = 0 To $iItemCount - 1 For $j = 0 To $iColumnCount - 1 $aReturn[$i + 1][$j] = _GUICtrlListView_GetItemText($hListView, $i, $j) Next Next Return SetError(Number($aReturn[0][0] = 0), 0, $aReturn) EndFunc ;==>_GUICtrlListView_CreateArrayExample use of Function: #include <Array.au3> ; Required only for _ArrayDisplay(). #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <WindowsConstants.au3> Example() Func Example() Local $iWidth = 600, $iHeight = 400, $iListView = 0 Local $hGUI = GUICreate('_GUICtrlListView_CreateArray()', $iWidth, $iHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) _CreateListView($hGUI, $iListView) Local $iGetArray = GUICtrlCreateButton('Get Array', $iWidth - 90, $iHeight - 28, 85, 25) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM) Local $iRefresh = GUICtrlCreateButton('Refresh', $iWidth - 180, $iHeight - 28, 85, 25) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM) GUISetState(@SW_SHOW, $hGUI) Local $aReturn = 0, $aStringSplit = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $iGetArray $aReturn = _GUICtrlListView_CreateArray($iListView, Default) ; Use | as the default delimeter. _ArrayDisplay($aReturn, '_GUICtrlListView_CreateArray() array.') $aStringSplit = StringSplit($aReturn[0][2], '|') _ArrayDisplay($aStringSplit, 'StringSplit() to retrieve column names.') Case $iRefresh GUICtrlDelete($iListView) _CreateListView($hGUI, $iListView) EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Func _CreateListView($hGUI, ByRef $iListView) ; Thanks to AZJIO for this function. Local $aClientSize = WinGetClientSize($hGUI) $iListView = GUICtrlCreateListView('', 0, 0, $aClientSize[0], $aClientSize[1] - 30) GUICtrlSetResizing($iListView, $GUI_DOCKBORDERS) Sleep(250) Local $iColumns = Random(1, 5, 1) __ListViewFill($iListView, $iColumns, Random(25, 100, 1)) ; Fill the ListView with Random data. For $i = 0 To $iColumns _GUICtrlListView_SetColumnWidth($iListView, $i, $LVSCW_AUTOSIZE) _GUICtrlListView_SetColumnWidth($iListView, $i, $LVSCW_AUTOSIZE_USEHEADER) Next EndFunc ;==>_CreateListView Func __ListViewFill($hListView, $iColumns, $iRows) ; Required only for the Example. If Not IsHWnd($hListView) Then $hListView = GUICtrlGetHandle($hListView) EndIf Local $fIsCheckboxesStyle = (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_CHECKBOXES) = $LVS_EX_CHECKBOXES) _GUICtrlListView_BeginUpdate($hListView) For $i = 0 To $iColumns - 1 _GUICtrlListView_InsertColumn($hListView, $i, 'Column ' & $i + 1, 50) _GUICtrlListView_SetColumnWidth($hListView, $i - 1, -2) Next For $i = 0 To $iRows - 1 _GUICtrlListView_AddItem($hListView, 'Row ' & $i + 1 & ': Col 1', $i) If Random(0, 1, 1) And $fIsCheckboxesStyle Then _GUICtrlListView_SetItemChecked($hListView, $i) EndIf For $j = 1 To $iColumns _GUICtrlListView_AddSubItem($hListView, $i, 'Row ' & $i + 1 & ': Col ' & $j + 1, $j) Next Next _GUICtrlListView_EndUpdate($hListView) EndFunc ;==>__ListViewFill1 point
-
Since the Raspberry Pi 2 uses an ARMv7 CPU, I don't think it will be able to run AutoIt or any other x86 applications in Windows 10 for Raspberry Pi.1 point
-
debuging 2.0
SorryButImaNewbie reacted to Melba23 for a topic
SorryButImaNewbie, Assuming you run the full SciTE4AutoIt3 package, adding the following directives will show you every line that ran in the SciTE console: #AutoIt3Wrapper_Run_Debug_Mode= ;(Y/N) Run Script with console debugging. Default=N #AutoIt3Wrapper_Run_Debug= ;(On/Off) Switch debugging on/off However, I have always found that having it switched on for the whole script is a bit of an overkill, so I tend only to use it on small sections after having used other debugging methods (ConsoleWrite/MsgBox) to narrow down the area causing the problem. In fact, doing that high level debugging usually points out the error without having to resort to the more detailed "line by line" approach. M231 point -
gius, The error occurs because you have declared the $listview variable inside the aGUI function and so it is invisible to anything outside. Declare the variable as Global at the top of your script so that it is visible inside the message handler and the script will run. You might want to read the Variables - using Global, Local, Static and ByRef tutorial in the Wiki to learn more about scoping variables. M231 point