Leaderboard
Popular Content
Showing content with the highest reputation on 10/13/2016 in all areas
-
Control Viewer - AutoIt Window Info Tool
mythicalzxc reacted to Yashied for a topic
LAST VERSION - 1.1 18-May-12 Control Viewer (CV) is a replacement of AutoIt Window Info with a number of advantages. I tried to stick to the interface of the last, so you almost do not have to be retrained. During testing, I never managed to find any controls that could not be identified by CV (on the contrary, shows a lot of hidden controls, especially for the system windows). The all program settings are stored in the following registry key: HKEY_CURRENT_USERSoftwareY'sControl Viewer The main differences CV from AWI Shows the complete list of all existing controls for the window that are interested (visible, hidden and deleted controls are displayed with different colors that can be changed to any other).Dynamically changing information during search for the windows and their controls.Ability to quickly switch between controls in the list.Ability to show/hide any controls from the list (useful for the overlaping controls).Information for the Style and ExStyle parameters shown in the form of hexadecimal values, and as its flags.Added the PID and Path parameters in the Window tab and ability to quickly open a folder that containing the process file.Added the coordinate system relative to the selected control.Shows a color of the selected pixel in RGB and BGR formats.Shows an example fill of the selected color.Ability to select the text encoding (affects the Text parameter in the Control tab).The complete change the appearance of pop-up frame for the selected controls.Simple and convenient tool to get a screenshot of the part screen of interest for publication on the forum (Capture tab).Create a report in the clipboard or a text file for subsequent publication on the forum.Search all running AutoIt scripts and their windows in the system (AutoIt tab).User-friendly interface. Used shortcuts Ctrl+Alt+T - Enable/Disable "Always On Top" mode (also available from the menu). Ctrl+Alt+H - Enable/Disable highlight selected controls (also available from the menu). Ctrl+A - Select all text (works in any input field). Ctrl - Hold down when moving the mouse to scroll the screenshot (Capture tab). Shift - Hold down when stretching/compression of the contour frame for an equilateral resizing screenshots (Capture tab). DoubleClick (on the screenshot) - Save the image to a file (Capture tab). DoubleClick (on any list item) - Open a folder with the file of the process or AutoIt script (AutoIt tab). Del (on any list item) - Close process (AutoIt tab). F5 - Updating the list (AutoIt tab). If anyone have any questions or comments about CV, please post it in this thread. I will be glad to any feedback and suggestions. Files to download Binary (x86 and x64) Redirection to CV_bin.zip, 1.14 MB CV_bin.html Source Redirection to CV_source.zip, 691 KB CV_source.html1 point -
Version 1.6.3.0
17,291 downloads
Extensive library to control and manipulate Microsoft Active Directory. Threads: Development - General Help & Support - Example Scripts - Wiki Previous downloads: 30467 Known Bugs: (last changed: 2020-10-05) None Things to come: (last changed: 2020-07-21) None BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort1 point -
Virtual listviews are lightning fast and can handle millions of rows. Virtual listviews are of interest when you have to insert more than 10,000 rows. When there are less than 10,000 rows, the standard listviews are sufficiently rapid. See the section "Using standard listviews" below. In a virtual listview data are not stored directly in the listview. Data are stored in an array, a structure (DllStructCreate), a flat fixed-length record file, a database or similar. The listview only contains the rows which are visible depending on the height of the listview. See About List-View Controls in the MicroSoft documentation for more information. An array or a structure can be used for listviews with 10,000 - 100,000 rows. If there are more than 100,000 rows a fixed-length record file or a database seems to be the best solution, because they have low impact on memory usage. But you get nothing for free. The costs is that a part of the built-in features does not work, and you will have to implement these features yourself. Because data isn't stored in the listview the Set- and Get-functions to manipulate data doesn't work. You have to manipulate the data source directly. And sorting is not supported at all by virtual listviews. If you need sorting, a database seems to be the best solution in all cases, because sorting can be handled by the database. Below you'll find the following sections: Data stored in arrays Data stored in databases Data stored in fixed-length record files Sorting rows in a virtual listview $LVN_ODFINDITEM notifications Using standard listviews Updates Zip file Examples The next two sections shows how to use virtual listviews, when data are stored in arrays or databases. In first section data are stored in 3 arrays with 10,000/50,000/100,000 rows and 10 columns. In second section data are stored in 3 databases with 100,000/1,000,000/10,000,000 rows and 10 columns. Data stored in arrays For a virtual listview rows are displayed with $LVN_GETDISPINFO notifications and the $tagNMLVDISPINFO structure. Code for $LVN_GETDISPINFO messages in the WM_NOTIFY function can be implemented in this manner: Case $LVN_GETDISPINFOW Local $tNMLVDISPINFO = DllStructCreate( $tagNMLVDISPINFO, $lParam ) If BitAND( DllStructGetData( $tNMLVDISPINFO, "Mask" ), $LVIF_TEXT ) Then Local $sItem = $aItems[DllStructGetData($tNMLVDISPINFO,"Item")][DllStructGetData($tNMLVDISPINFO,"SubItem")] DllStructSetData( $tText, 1, $sItem ) DllStructSetData( $tNMLVDISPINFO, "Text", $pText ) DllStructSetData( $tNMLVDISPINFO, "TextMax", StringLen( $sItem ) ) EndIf Run LvVirtArray.au3. It takes some time to create the arrays. But when the arrays are created, switching from one array to another (which means updating the listview) is instantaneous. Data stored in databases When data are stored in a database, $LVN_ODCACHEHINT notifications and the $tagNMLVCACHEHINT structure is used to insert the rows in an array cache before they are displayed with $LVN_GETDISPINFO messages. The $tagNMLVCACHEHINT structure is defined in this way: Global Const $tagNMLVCACHEHINT = $tagNMHDR & ";int iFrom;int iTo" Note that $tagNMLVCACHEHINT is not included in GuiListView.au3 or StructureConstants.au3. Code for $LVN_ODCACHEHINT messages in the WM_NOTIFY function can be implemented in this manner: Case $LVN_ODCACHEHINT Local $tNMLVCACHEHINT = DllStructCreate( $tagNMLVCACHEHINT, $lParam ), $iColumns $iFrom = DllStructGetData( $tNMLVCACHEHINT, "iFrom" ) Local $sSQL = "SELECT * FROM lvdata WHERE item_id >= " & $iFrom & _ " AND item_id <= " & DllStructGetData( $tNMLVCACHEHINT, "iTo" ) & ";" _SQLite_GetTable2d( -1, $sSQL, $aResult, $iRows, $iColumns ) $aResult is the array cache. The purpose of the cache is to limit the number of SELECT statements. When the listview is displayed for the first time, all visible rows (in this example about 20) have to be updated. In this case $aResult will contain 20 rows and 10 columns. 20 rows is also the maximum number of rows in $aResult. A virtual listview will never update more than the visible number of rows at one time. Code for $LVN_GETDISPINFO messages can be implemented in this way: Case $LVN_GETDISPINFOW Local $tNMLVDISPINFO = DllStructCreate( $tagNMLVDISPINFO, $lParam ) If BitAND( DllStructGetData( $tNMLVDISPINFO, "Mask" ), $LVIF_TEXT ) Then Local $iIndex = DllStructGetData( $tNMLVDISPINFO, "Item" ) - $iFrom + 1 If $iIndex > 0 And $iIndex < $iRows + 1 Then Local $sItem = $aResult[$iIndex][DllStructGetData($tNMLVDISPINFO,"SubItem")] DllStructSetData( $tText, 1, $sItem ) DllStructSetData( $tNMLVDISPINFO, "Text", $pText ) DllStructSetData( $tNMLVDISPINFO, "TextMax", StringLen( $sItem ) ) EndIf EndIf The zip below contains a small GUI, CreateDB.au3, to create 3 SQLite databases with 100,000/1,000,000/10,000,000 rows. The databases will use about 10/100/1000 MB of diskspace, and the creation will take about ½/5/40 minutes (on an old XP). You must select a database and click a button to start the creation. If you get tired of waiting, you can cancel (checked for every 10,000 rows) the process and continue another time. The process will continue where it stopped. You can run the examples even though the databases might only contain 30,000/200,000/1,500,000 rows. You do not have to create all three databases. Run LvVirtDB.au3. Data stored in fixed-length record files (update 2015-04-01) Extracting data directly from a fixed-length record file by setting the file pointer to the current record and reading the required number of bytes is another example, where $LVN_ODCACHEHINT messages should be used to insert records in an array cache before they are displayed. Code for $LVN_ODCACHEHINT and $LVN_GETDISPINFO messages can be implemented as shown: Case $LVN_ODCACHEHINT Local $tNMLVCACHEHINT = DllStructCreate( $tagNMLVCACHEHINT, $lParam ) $iFrom = DllStructGetData( $tNMLVCACHEHINT, "iFrom" ) $iRows = DllStructGetData( $tNMLVCACHEHINT, "iTo" ) - $iFrom + 1 FileSetPos( $hFile, $iFrom * 12, 0 ) ; Each line is 10 chars + CR + LF $aCache = StringSplit( FileRead( $hFile, $iRows * 12 - 2 ), @CRLF, 3 ) The purpose of the cache is to limit the number of FileRead statements. Case $LVN_GETDISPINFOW Local $tNMLVDISPINFO = DllStructCreate( $tagNMLVDISPINFO, $lParam ) If BitAND( DllStructGetData( $tNMLVDISPINFO, "Mask" ), $LVIF_TEXT ) Then Local $iIndex = DllStructGetData( $tNMLVDISPINFO, "Item" ) - $iFrom If -1 < $iIndex And $iIndex < $iRows Then DllStructSetData( $tText, 1, $aCache[$iIndex] ) DllStructSetData( $tNMLVDISPINFO, "Text", $pText ) DllStructSetData( $tNMLVDISPINFO, "TextMax", 10 ) ; Each line is 10 chars EndIf EndIf Run LvVirtFile.au3. A fixed-length record file with 10,000 records (LvVirtFile.txt) is included in the zip. I have tested this example on a 1,1 GB file and 100,000,000 rows. The listview responds immediately. The solution with a flat fixed-length record file is extremely fast. Much faster than a database. But also with very much limited functionality compared to a database. Sorting rows in a virtual listview (update 2015-04-01) Sorting is not supported at all by virtual listviews. If you want rows to be sorted, you have to feed the listview with the rows in sorted order. If the rows are stored in an array, you have to sort the array before you feed the listview. If you want to sort the rows by two or more columns, you have to store the rows in two or more arrays which are sorted for the current column. Or you have to create two or more indexes to handle the sorting. Sorting arrays and creating indexes is time consuming. If you need sorting, a database seems to be the best solution, because sorting can be handled by the database. Nevertheless, here's an example that stores 10,000/20,000/30,000 rows and 3 columns in arrays, and creates indexes to handle the sorting. The columns are strings, integers and floating point numbers, and indexes are calculated for all 3 columns. To be able to create the indexes as fast as possible, structures (DllStructCreate) are used to create the indexes. This is the function to create indexes for integers and floating point numbers. The function for strings is equivalent. $tIndex = DllStructCreate( "uint[" & $iRows & "]" ) Func SortNumbers( ByRef $aItems, $iRows, $iCol, $pIndex, $tIndex ) Local $k, $n, $lo, $hi, $mi, $gt HourglassCursor( True ) WinSetTitle( $hGui, "", "Virtual ListViews. Sort numbers: 0 rows" ) For $i = 0 To $iRows / 10000 - 1 $k = $i * 10000 For $j = 0 To 9999 $n = $aItems[$k+$j][$iCol] ; Binary search $lo = 0 $hi = $k + $j - 1 While $lo <= $hi $mi = Int( ( $lo + $hi ) / 2 ) If $n < $aItems[DllStructGetData($tIndex,1,$mi+1)][$iCol] Then $gt = 0 $hi = $mi - 1 Else $gt = 1 $lo = $mi + 1 EndIf WEnd ; Make space for the new value DllCall( $hKernel32Dll, "none", "RtlMoveMemory", "struct*", $pIndex+($mi+1)*4, "struct*", $pIndex+$mi*4, "ulong_ptr", ($k+$j-$mi)*4 ) ; Insert new value DllStructSetData( $tIndex, 1, $k+$j, $mi+1+$gt ) Next WinSetTitle( $hGui, "", "Virtual ListViews. Sort numbers: " & $k + 10000 & " rows" ) Next HourglassCursor( False ) WinSetTitle( $hGui, "", "Virtual ListViews (sorted)" ) EndFunc Run LvVirtArraySort.au3. It takes some time to create the arrays and indexes. But when everything is created, sorting by different columns and switching from one array to another is instantaneous. Because it's easy and fast to save/load a structure to/from a binary file, it may be advantageous to calculate the arrays and indexes in another script before the GUI is opened. $LVN_ODFINDITEM notifications (update 2015-04-01) Three notifications are important for virtual listviews. $LVN_GETDISPINFO (to get information about the rows to display in the listview) and $LVN_ODCACHEHINT (to store rows from a file or database in an array cache before they are displayed with $LVN_GETDISPINFO messages) are already mentioned above. The last is $LVN_ODFINDITEM, which is used to find a row when you press one or a few keys on the keyboard. Information from $LVN_ODFINDITEM is stored in the $tagNMLVFINDITEM structure. The codebox shows the code for $LVN_ODFINDITEM notifications: Case $LVN_ODFINDITEMW Local $tNMLVFINDITEM = DllStructCreate( $tagNMLVFINDITEM, $lParam ) If BitAND( DllStructGetData( $tNMLVFINDITEM, "Flags" ), $LVFI_STRING ) Then Return SearchText( DllStructGetData( $tNMLVFINDITEM, "Start" ), _ ; Start DllStructGetData( DllStructCreate( "wchar[20]", DllStructGetData( $tNMLVFINDITEM, "Text" ) ), 1 ) ) ; Text EndIf Start is the row where you start the search. Text contains the key presses to search for. You have to implement the search function (here SearchText) yourself. If the function finds a row, it should return the index of the row. If not, it should return -1. Run LvVirtArrayFind.au3. Using standard listviews (update 2015-04-01) If not more than 10,000 rows have to be inserted in a listview, a standard listview is sufficiently rapid. Because of speed you should use native (built-in) functions to fill the listview and not functions in GuiListView.au3 UDF. When the listview is filled, you can use all the functions in the UDF. This code shows how to quickly fill a listview with native functions: Func FillListView( $idLV, ByRef $aItems, $iRows ) Local $tLVITEM = DllStructCreate( $tagLVITEM ) Local $pLVITEM = DllStructGetPtr( $tLVITEM ), $k, $s DllStructSetData( $tLVITEM, "Mask", $LVIF_IMAGE ) ; Icon (or image) DllStructSetData( $tLVITEM, "SubItem", 0 ) ; First column HourglassCursor( True ) For $i = 0 To $iRows / 10000 - 1 $k = $i * 10000 For $j = 0 To 9999 ; Text $s = $aItems[$k+$j][0] For $l = 1 To 9 $s &= "|" & $aItems[$k+$j][$l] Next GUICtrlCreateListViewItem( $s, $idLV ) ; Add item and all texts ; Icon Select Case Mod( $k + $j, 3 ) = 0 DllStructSetData( $tLVITEM, "Image", 2 ) ; Icon index Case Mod( $k + $j, 2 ) = 0 DllStructSetData( $tLVITEM, "Image", 1 ) Case Else DllStructSetData( $tLVITEM, "Image", 0 ) EndSelect DllStructSetData( $tLVITEM, "Item", $k + $j ) ; Row GUICtrlSendMsg( $idLV, $LVM_SETITEMW, 0, $pLVITEM ) ; Add icon Next WinSetTitle( $hGui, "", "GUICtrlCreateListViewItem ListViews. Fills listview: " & $k + 10000 & " rows" ) Next HourglassCursor( False ) WinSetTitle( $hGui, "", "GUICtrlCreateListViewItem ListViews" ) EndFunc Run LvStandard.au3. LvStandardIni.au3 shows how to quickly load an inifile (LvStandardIni.ini, created with IniWriteSection) into a listview. Because an inifile is a small file (only the first 32767 chars are read) it should always be loaded into a standard listview. Updates Update 2015-03-24 Added two array-examples. An example (LvVirtArrayIcons.au3) that shows how to use checkboxes and icons, and an example (LvVirtArrayColors.au3) that shows how to draw every second row with a different background color. In this post you can find an example where all items are drawn with a random background color. Update 2015-04-01 Cleaned up code in previous examples. Added more examples as described above. Zip updated. UDF versions (2018-04-27) Over the past weeks, new display functions have been added to Data display functions based on virtual listviews, and new functions have been added to use the listviews as embedded GUI controls. All the functions work and are used in much the same way. Apart from the data source, the function parameters are the same for all functions. The display functions support a wide range of features, all specified via a single function parameter $aFeatures, which is the last parameter. The central code to handle $LVN_ODCACHEHINT and $LVN_GETDISPINFO notifications is very optimized code. First of all, the code is implemented through the subclassing technique. This means that messages are received directly from the operating system and not from AutoIt's internal message management code. Messages are returned again directly to the operating system and again without interference with AutoIt's internal message handling code. Next, the code is divided into different include files each taking care of a particular feature. That way, it's avoided that a lot of control statements makes the code slow. And it's enough to include the code that's actually used. One reason why so much work has been done in optimizing code and developing features is that these functions will also work as UDF versions for the examples here. It's far from a trivial task to develop UDF versions of examples like these. Since the first version of the display functions was created in this thread 2½ years ago and then has been continuously developed, it's obvious to use the functions as UDF versions of these examples. The following examples are implemented as UDF versions: Data stored in arrays Data stored in CSV files Data stored in SQLite databases Zip file Examples in zip: LvVirtArray.au3 - Data stored in arrays LvVirtArrayColors.au3 - Alternating row colors LvVirtArrayFind.au3 - $LVN_ODFINDITEM notifications LvVirtArrayIcons.au3 - Checkboxes and icons LvVirtArraySort.au3 - Sorting rows in a virtual listview LvVirtDB.au3 - Data stored in databases (use CreateDB.au3 to create DBs) LvVirtFile.au3 - Data stored in fixed-length record files LvStandard.au3 - Using standard listviews LvStandardIni.au3 - Load inifile into a listview The size of the zip is caused by a 118 KB txtfile, LvVirtFile.txt, used by LvVirtFile.au3, and a 28 KB inifile, LvStandardIni.ini, used by LvStandardIni.au3. Tested with AutoIt 3.3.10 on Windows 7 64 bit and Windows XP 32 bit. Should work on all AutoIt versions from 3.3.10 and all Windows versions. Virtual ListViews.7z Examples Examples based on virtual listviews. Array examples: A lot of rows and random background colors for each cell - This post in another thread Incremental search (update as you type) in a virtual listview - Post 29 Sorting arrays: Rows can be sorted by strings, integers, floats and checkboxes, checked rows in top - Post 48 File sources: A CSV-file with 100,000 rows and 10 columns is data source - Post 56 SQLite examples: Various issues related to the use of a database - Post 34, 35, 43 An example that shows a way to implement a search box - Post 411 point
-
military time convert or calc
SorryButImaNewbie reacted to orbs for a topic
AutoIt it shipped with a UDF that handles time computations. first you must convert your military time to a calculable format, then diff the times and present in hours, like this: #include <Date.au3> Global $iTimeDiff = _DateDiff('n', _TimeConvert_MilitaryToCalc('0730'), _TimeConvert_MilitaryToCalc('1000')) / 60 MsgBox(0, '', $iTimeDiff) Func _TimeConvert_MilitaryToCalc($sTime) Return @YEAR & '/' & @MON & '/' & @MDAY & ' ' & StringLeft($sTime, 2) & ':' & StringRight($sTime, 2) & ':' & '00' EndFunc ;==>_TimeConvert_MilitaryToCalc look at the help for _DateDiff() and see why you need to convert the military time to calculable.1 point -
Select and Bool value
SorryButImaNewbie reacted to JLogan3o13 for a topic
So then, what about something short and sweet? Global $A = 1, $B = 0, $C = 0 If $A Then _MyFuncForA($A) If $B Then _MyFuncForB($B) If $C Then _MyFuncForC($C)1 point -
1 point
-
ah, yet another one of Windows 10 "improvements"! so this means that whichever method we work with the Task Scheduler should be thoroughly tested on every version, edition, update and architecture of Windows. that's just great.1 point
-
Oh, just read you're only looking for the drive numbers ... https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_GetDriveNumber.htm1 point
-
For SMF (see my sig) I developed this some time ago (I think with trancexx's help), though still in AutoIt 3.3.8.1 . #include <array.au3> #include <winapi.au3> $a = _Drive_GetHardwareInfos("c") _ArrayDisplay($a) Func _Drive_GetHardwareInfos($DriveLetter) Local $a_Info_Drive_Hardware_temp[4], $ret, $tTemp, $ptrTemp $ret = DllCall("kernel32.dll", 'ptr', 'CreateFileW', _ 'wStr', '\\.\' & $DriveLetter & ':', _ 'dword', 0, _ 'dword', 7, _ 'ptr', 0, _ 'dword', 3, _ 'dword', 0, _ 'ptr', 0 _ ) If @error Then Return SetError(1, 0, $a_Info_Drive_Hardware_temp) If $ret[0] = 0xFFFFFFFF Then Return SetError(2, 0, $a_Info_Drive_Hardware_temp) Local $hDevice = $ret[0] Local Const $tagSTORAGE_PROPERTY_QUERY = 'ULONG_PTR PropertyId;ULONG_PTR QueryType;byte AdditionalParameters[4]' Local Const $tagSTORAGE_DESCRIPTOR_HEADER = 'dword Version;dword Size' Local $tSTORAGE_PROPERTY_QUERY = DllStructCreate($tagSTORAGE_PROPERTY_QUERY) DllStructSetData($tSTORAGE_PROPERTY_QUERY, 'PropertyId', 0) DllStructSetData($tSTORAGE_PROPERTY_QUERY, 'QueryType', 0) Local $tSTORAGE_DESCRIPTOR_HEADER = DllStructCreate($tagSTORAGE_DESCRIPTOR_HEADER) $ret = DllCall("kernel32.dll", 'int', 'DeviceIoControl', _ 'handle', $hDevice, _ 'dword', 0x002D1400, _ 'ptr', DllStructGetPtr($tSTORAGE_PROPERTY_QUERY), _ 'dword', DllStructGetSize($tSTORAGE_PROPERTY_QUERY), _ 'PTR', DllStructGetPtr($tSTORAGE_DESCRIPTOR_HEADER), _ 'dword', DllStructGetSize($tSTORAGE_DESCRIPTOR_HEADER), _ 'dword*', 0, _ 'ptr', 0 _ ) If DllStructGetData($tSTORAGE_DESCRIPTOR_HEADER, "Size") Then Local Const $tagSTORAGE_DEVICE_DESCRIPTOR = 'ulong Version;ulong Size;byte DeviceType;byte DeviceTypeModifier;byte RemovableMedia;byte CommandQueueing;ulong VendorIdOffset;ulong ProductIdOffset;ulong ProductRevisionOffset;ulong SerialNumberOffset;ulong BusType;ulong RawPropertiesLength;byte RawDeviceProperties[' & DllStructGetData($tSTORAGE_DESCRIPTOR_HEADER, "Size") & ']' Local $tSTORAGE_DEVICE_DESCRIPTOR = DllStructCreate($tagSTORAGE_DEVICE_DESCRIPTOR) $ret = DllCall("kernel32.dll", 'int', 'DeviceIoControl', _ 'handle', $hDevice, _ 'dword', 0x002D1400, _ 'PTR', DllStructGetPtr($tSTORAGE_PROPERTY_QUERY), _ 'dword', DllStructGetSize($tSTORAGE_PROPERTY_QUERY), _ 'PTR', DllStructGetPtr($tSTORAGE_DEVICE_DESCRIPTOR), _ 'dword', DllStructGetSize($tSTORAGE_DEVICE_DESCRIPTOR), _ 'dword*', 0, _ 'PTR', 0 _ ) If DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "VendorIdOffset") Then $ptrTemp = DllStructGetPtr($tSTORAGE_DEVICE_DESCRIPTOR) + DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "VendorIdOffset") $tTemp = DllStructCreate("char Temp[" & _WinAPI_StringLenA($ptrTemp) & "]", $ptrTemp) $a_Info_Drive_Hardware_temp[0] = DllStructGetData($tTemp, "Temp") EndIf If DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "ProductIdOffset") Then $ptrTemp = DllStructGetPtr($tSTORAGE_DEVICE_DESCRIPTOR) + DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "ProductIdOffset") $tTemp = DllStructCreate("char Temp[" & _WinAPI_StringLenA($ptrTemp) & "]", $ptrTemp) $a_Info_Drive_Hardware_temp[1] = DllStructGetData($tTemp, "Temp") EndIf If DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "ProductRevisionOffset") Then $ptrTemp = DllStructGetPtr($tSTORAGE_DEVICE_DESCRIPTOR) + DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "ProductRevisionOffset") $tTemp = DllStructCreate("char Temp[" & _WinAPI_StringLenA($ptrTemp) & "]", $ptrTemp) $a_Info_Drive_Hardware_temp[2] = DllStructGetData($tTemp, "Temp") EndIf If "0x" & Hex(DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "SerialNumberOffset")) <> "0xFFFFFFFF" Then $ptrTemp = DllStructGetPtr($tSTORAGE_DEVICE_DESCRIPTOR) + DllStructGetData($tSTORAGE_DEVICE_DESCRIPTOR, "SerialNumberOffset") $tTemp = DllStructCreate("char Temp[" & _WinAPI_StringLenA($ptrTemp) & "]", $ptrTemp) $a_Info_Drive_Hardware_temp[3] = DllStructGetData($tTemp, "Temp") EndIf EndIf $a_Info_Drive_Hardware_temp[0] = _StringToReadable($a_Info_Drive_Hardware_temp[0]) $a_Info_Drive_Hardware_temp[1] = _StringToReadable($a_Info_Drive_Hardware_temp[1]) $a_Info_Drive_Hardware_temp[2] = _StringToReadable($a_Info_Drive_Hardware_temp[2]) $a_Info_Drive_Hardware_temp[3] = _SwapStringOrder(_StringToReadable($a_Info_Drive_Hardware_temp[3])) DllCall("kernel32.dll", 'int', 'CloseHandle', 'hwnd', $hDevice) Return $a_Info_Drive_Hardware_temp EndFunc ;==>_Drive_GetHardwareInfos Func _StringToReadable($sString) Local $sString_Return, $iAscCode Local $aString = StringSplit($sString, "") For $i = 1 To $aString[0] $iAscCode = Asc($aString[$i]) Switch $iAscCode ; Case 32 to 126 Case 48 To 57, 65 To 90, 97 To 122 $sString_Return &= $aString[$i] EndSwitch Next Return $sString_Return EndFunc ;==>_StringToReadable Func _SwapStringOrder($sString) Local $sString_Return, $iAscCode ; ConsoleWrite($sString & @TAB & StringLen($sString) & @CRLF) Local $aString = StringSplit($sString, "") For $i = 1 To $aString[0] Step 2 If $i + 1 > $aString[0] Then $sString_Return &= $aString[$i] ExitLoop EndIf $sString_Return &= $aString[$i + 1] & $aString[$i] ; ConsoleWrite($i & @TAB & $aString[0] & @CRLF) Next Return $sString_Return EndFunc ;==>_SwapStringOrder1 point
-
How do I Unicode
JLogan3o13 reacted to jchd for a topic
@MaxPlankpar, Your posts don't make any sense. You throw in undefined terms (e.g. "flat"), you use sentences that make no sense to anyone except you (e.g. " Say I have _wo__A through _wo__Z with language definitions in _cn _en ") and you mix completely distinct things in a row as if they were of the same nature (e.g. AutoIt, Python [languages], DOS, Linux & Androïd [OSes], Stupid-Font-Error [only you can tell what's that]). Finally you say that the "old AutoIt version" does "it" well without telling us which version you're talking about, nor the issue you're hitting with more recent versions. After reading your prose multiple times (yeah, really) in a suicidal attempt to help you, you seem to expect something ("a switch" [???]) that would magically detect the language of words based on the characters they contain. That or append the language to each word known to your dictionary???? What are "de5", "wo3", " _cn__A", " _cn__B", " _fr__A "? Can't you explain yourself clearly? Something along the line (guesswork here): "I have a big dictionary with words from many languages. Given an input string with several words from different languages I need to lookup my dictionary to find them along with the language they belong to and transform the string using a proprietary encoding defined below. < definition of the encoding>. The reason for using such encoding is <sensible rationale>. Using version U.V.W of AutoIt I used to run this code: <running example code snippet> but it doesn't work anymore using version X.Y.Z and all I get is the following error: <error description> Can you help me solve the issue or guide me towards a more efficient way to achieve what I need?"1 point -
waw.. wonderful effect very nice @UEZ! here a similar effect in Javascript: http://fabricjs.com/particles p.s. sorry for the little hijack...1 point
-
Thanks for sharing. I well remember adding a Roman Numeral element to my old Titlecase Function ... was it turned (or a variation of) into a UDF ... not sure? There is a couple of discussions about the place somewhere ... involving @guinness, @tcurran, you and others ... if I remember rightly. If and when I ever get around to updating that function, then hopefully I will remember to incorporate your excellent UDF.1 point
-
Hello! After watching a whole day of "Journey into cryptography" at Khan Academy, I have got to know the secrets behind some sneaky things! . This is one of em', A PRNG (Pseudo Random Number Generator). Its features (atleast what I believe) are: Simple, short and crappy. Great for beginners who are baffled by the mechanics of random number generation in computers! Support for custom seeds! EIGHT DIGITS OF RANDOMNESS!!! Unlike all other PRNGs, This one is predictable 1000 possible PRNs when using @MSEC as the seed. No option for min or max, the min is 10000000 and the max is 99999999. The Unlicensed . #cs LICENSE This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org/> #ce LICENSE ; #FUNCTION# ==================================================================================================================== ; Name ..........: MiddleSquareRandom ; Description ...: Pseudo-random number generator based on the infamous "Middle Sqaure" method. ; Syntax ........: MiddleSquareRandom([$iSeed = @MSEC]) ; Parameters ....: $iSeed - [optional] A seed for generation of the random number. Default is @MSEC. ; Return values .: A pseudorandom 8 digit integer. ; Author ........: John von Neumann ; Modified ......: Damon Harris (TheDcoder) - Conversion into AutoIt and simplification + further crappification. ; Remarks .......: Fun Fact - The output is based on the $iSeed passed, Same $iSeed = Same pseudo-random number. ; Related .......: Random() ; Link ..........: https://en.wikipedia.org/wiki/Middle-square_method ; Example .......: ConsoleWrite(MiddleSquareRandom() & @CRLF) ; =============================================================================================================================== Func MiddleSquareRandom($iSeed = @MSEC) Local Const $TURNS = 8 Local $sRandomNumber, $sSeed For $iTurn = 1 To $TURNS $iSeed = $iSeed * 2 $sSeed = String($iSeed) $sRandomNumber &= StringMid($sSeed, Ceiling(StringLen($iSeed) / 2), 1) Next Return Int($sRandomNumber) EndFunc Enjoy your numbers, TD . P.S NEVER USE THIS FUNCTION IN A REAL WORLD IMPLEMENTATION OF SOMETHING WHICH USES RANDOM NUMBERS!!! THIS ONE IS VERY UNSUITABLE FOR THAT PURPOSE! READ THE POSTS BELOW FOR MORE INFORMATION.1 point
-
SnippetBrowser1.0 w/ Search/FindinFile/Syntax Hiliting...
SorryButImaNewbie reacted to l3ill for a topic
This is a little project I started knowing it was over my head to intentionally raise my own experience bar. Pretty Simple Concept and its finally working like I want it to. The Basic Idea: An exe you copy into your Snippet folder and run from there with a shortcut ( or w/out ). Top Part of GUI Get Files - Creates a ListView of all au3 file in the WorkingDir ~ >_RecFileListToArray Thanks M23 !! Clear - clears last search otherwise new search/GetFiles is appended (gets full quick) File Search - search through the WorkingDir for a Keyword ~ >_FindInFile Thanks guinness !! Far Right is a label with the Path of your Working Directory Bottom Part All of these commands work with The Selected File Path From top part: Text Search - searches though preview window for text like F3 (find next) Thanks M23 !! Open in SciTE - Duh... Preview - Shows Preview of Selected File Path in Bottom window with Syntax Hi Liting ~ >RESH Thanks Beege Throw String - Experimental, Sends Selected Text to last Cursor Position in active tab in SciTE (now works w' multiple lines) Only works with one line... >Thanks Jos, guinness Everything you need to try it is in the zip file. Constructive Critics and Suggestions are welcome ;-) Some Pics: Here you see a search for Text in File "@ScriptDir". All the files that have this in them will be listed Then search through the Preview for each instance of "@ScriptDir" until you find the one you want. SnippetBrowser1.0.zip SnippetBrowser_1.0.1.zip ~ update: 14 Dec 2013 SnippetBrowser_1.0.1.zip ~ update: 18 Dec 2013 SnippetBrowser_1.0.2.zip ~ update: 26 Dec 2013 Bill1 point -
How to set a tab as active?
Netol reacted to AdmiralAlkex for a topic
1. Your current way doesn't even work in theory. GUISwitch() needs a control id, and you give it the index. You should have set the advanced parameter of GUICtrlRead(). See GUISwitch(), GUICtrlCreateTabItem() and GUICtrlRead() in the helpfile. 2. Read the page for GUICtrlCreateTabItem() in the helpfile again. Notice the second remark? So to fix you script, change to: GUICtrlCreateTabItem("") GUICtrlSetState($curtab, $GUI_SHOW) GUISetState(@SW_SHOW) And voila!1 point