Leaderboard
Popular Content
Showing content with the highest reputation on 12/16/2015 in all areas
-
Introduction JSON (Javascript Object Notation) is a popular data-interchange format and supported by a lot of script languages. On AutoIt, there is already a >JSON UDF written by Gabriel Boehme. It is good but too slow, and not supports unicode and control characters very well. So I write a new one (and of course, fast one as usual). I use a machine code version of JSON parser called "jsmn". jsmn not only supports standard JSON, but also accepts some non-strict JSON string. See below for example. Important Update!! I rename the library from jsmn.au3 to json.au3. All function names are changed, too. Decoding Function Json_Decode($Json) $Json can be a standard or non-standard JSON string. For example, it accepts: { server: example.com port: 80 message: "this looks like a config file" } The most JSON data type will be decoded into corresponding AutoIt variable, including 1D array, string, number, true, false, and null. JSON object will be decoded into "Windows Scripting Dictionary Object" retuned from ObjCreate("Scripting.Dictionary"). AutoIt build-in functions like IsArray, IsBool, etc. can be used to check the returned data type. But for Object and Null, Json_IsObject() and Json_IsNull() should be used. If the input JSON string is invalid, @Error will be set to $JSMN_ERROR_INVAL. And if the input JSON string is not finish (maybe read from stream?), @Error will be set to $JSMN_ERROR_PART. Encoding Function Json_Encode($Data, $Option = 0, $Indent = "\t", $ArraySep = ",\r\n", $ObjectSep = ",\r\n", $ColonSep = ": ") $Data can be a string, number, bool, keyword(default or null), 1D arrry, or "Scripting.Dictionary" COM object. Ptr will be converted to number, Binary will be converted to string in UTF8 encoding. Other unsupported types like 2D array, dllstruct or object will be encoded into null. $Option is bitmask consisting following constant: $JSON_UNESCAPED_ASCII ; Don't escape ascii charcters between chr(1) ~ chr(0x1f) $JSON_UNESCAPED_UNICODE ; Encode multibyte Unicode characters literally $JSON_UNESCAPED_SLASHES ; Don't escape / $JSON_HEX_TAG ; All < and > are converted to \u003C and \u003E $JSON_HEX_AMP ; All &amp;amp;amp;s are converted to \u0026 $JSON_HEX_APOS ; All ' are converted to \u0027 $JSON_HEX_QUOT ; All " are converted to \u0022 $JSON_PRETTY_PRINT ; Use whitespace in returned data to format it $JSON_STRICT_PRINT ; Make sure returned JSON string is RFC4627 compliant $JSON_UNQUOTED_STRING ; Output unquoted string if possible (conflicting with $JSMN_STRICT_PRINT) Most encoding option have the same means like PHP's json_enocde() function. When $JSON_PRETTY_PRINT is set, output format can be change by other 4 parameters ($Indent, $ArraySep, $ObjectSep, and $ColonSep). Because these 4 output format parameters will be checked inside Jsmn_Encode() function, returned string will be always accepted by Jsmn_Decode(). $JSON_UNQUOTED_STRING can be used to output unquoted string that also accetped by Jsmn_Decode(). $JSON_STRICT_PRINT is used to check output format setting and avoid non-standard JSON output. So this option is conflicting with $JSON_UNQUOTED_STRING. Get and Put Functions Json_Put(ByRef $Var, $Notation, $Data, $CheckExists = False) Json_Get(ByRef $Var, $Notation) These functions helps user to access object or array more easily. Both dot notation and square bracket notation can be supported. Json_Put() by default will create non-exists objects and arrays. For example: Local $Obj Json_Put($Obj, ".foo", "foo") Json_Put($Obj, ".bar[0]", "bar") Json_Put($Obj, ".test[1].foo.bar[2].foo.bar", "Test") Local $Test = Json_Get($Obj, '["test"][1]["foo"]["bar"][2]["foo"]["bar"]') ; "Test" Object Help Functions Json_ObjCreate() Json_ObjPut(ByRef $Object, $Key, $Value) Json_ObjGet(ByRef $Object, $Key) Json_ObjDelete(ByRef $Object, $Key) Json_ObjExists(ByRef $Object, $Key) Json_ObjGetCount(ByRef $Object) Json_ObjGetKeys(ByRef $Object) Json_ObjClear(ByRef $Object) These functions are just warps of "Scripting.Dictionary" COM object. You can use these functions if you are not already familiar with it. == Update 2013/05/19 == * Add Jsmn_Encode() option "$JSMN_UNESCAPED_ASCII". Now the default output of Json_Encode() is exactly the same as PHP's json_encode() function (for example, chr(1) will be encoded into u0001). $JSON_UNESCAPED_ASCII ; Don't escape ascii charcters between chr(1) ~ chr(0x1f) == Update 2015/01/08 == * Rename the library from jsmn.au3 to json.au3. All function names are changed, too. * Add Json_Put() and Json_Get() * Add Null support * Using BinaryCall.au3 to loading the machine code. == Update 2018/01/13== (Jos) * Add JsonDump() to list all Json Keys and their values to easily figure out what they are. == Update 2018/10/01== (Jos) * Fixed JsonDump() some fields and values were not showing as discussed here - tnx @TheXman . == Update 2018/10/01b== (Jos) * Added Json_ObjGetItems, Tidied source and fixed au3check warnings - tnx @TheXman . == Update 2018/10/28== (Jos) * Added declaration for $value to avoid au3check warning - tnx @DerPensionist == Update 2018/12/16== (Jos) * Added another declaration for $value to avoid au3check warning and updated the version at the top - tnx @maniootek == Update 2018/12/29== (Jos) * Changed Json_ObjGet() and Json_ObjExists() to allow for multilevel object in string. == Update 2019/01/17== (Jos) * Added support for DOT notation in JSON functions. == Update 2019/07/15== (Jos) * Added support for reading keys with a dot inside when using a dot as separator (updated) == Update 2021/11/18== (TheXman) * Update details in below post: == Update 2021/11/20== (TheXman) * Minor RegEx update, no change to the functionality or result._Json(2021.11.20).zip1 point
-
Multi-line items in custom drawn ListView
pixelsearch reacted to LarsJ for a topic
Items in a standard listview in details/report view (this example deals only with listviews in details/report view) can display a single line of text. There seems not to be any options to change this. There is no word wrap option. If you search the forums, it's possible to find examples of listviews with multiple lines of text in each row. The multi-line items are implemented as owner drawn items through LVS_OWNERDRAWFIXED control style and WM_DRAWITEM messages. A problem with the owner drawn technique is that you are forced to draw everything yourself. Besides item texts and the background behind texts (white for non-selected items, dark blue for selected items with focus, button face for selected items without focus) you also have to draw checkboxes, images, icons and the background behind these elements yourself. Another technique is custom drawn listview items. Custom drawn items are implemented through NM_CUSTOMDRAW notifications included in WM_NOTIFY messages. NM_CUSTOMDRAW notifications are generated automatically by the code in ComCtl32.dll when the listview is updated. Implementing custom drawn items is a matter of responding to these messages or not. The great advantage of custom drawn items is that the drawing process is divided into several stages. For a listview up to six different stages. Some of these stages can be used for default drawing without any additional code at all. Other stages can be used for custom drawing with your own code. Multi-line text items fits perfectly with the custom drawn technique. Item texts and the background is drawn by custom code. Checkboxes, images, icons and the background is drawn by default code. Increase height of listview items The usual way to increase the height of listview items is to respond to WM_MEASUREITEM messages. But this method can only be used for owner drawn listviews. In a custom drawn listview the height can be increased by defining a text font with a suitable height: Func _GUICtrlListView_SetItemHeightByFont( $hListView, $iHeight ) ; Get font of ListView control ; Copied from _GUICtrlGetFont example by KaFu ; See https://www.autoitscript.com/forum/index.php?showtopic=124526 Local $hDC = _WinAPI_GetDC( $hListView ), $hFont = _SendMessage( $hListView, $WM_GETFONT ) Local $hObject = _WinAPI_SelectObject( $hDC, $hFont ), $lvLOGFONT = DllStructCreate( $tagLOGFONT ) _WinAPI_GetObject( $hFont, DllStructGetSize( $lvLOGFONT ), DllStructGetPtr( $lvLOGFONT ) ) Local $hLVfont = _WinAPI_CreateFontIndirect( $lvLOGFONT ) ; Original ListView font _WinAPI_SelectObject( $hDC, $hObject ) _WinAPI_ReleaseDC( $hListView, $hDC ) _WinAPI_DeleteObject( $hFont ) ; Set height of ListView items by applying text font with suitable height $hFont = _WinAPI_CreateFont( $iHeight, 0 ) _WinAPI_SetFont( $hListView, $hFont ) _WinAPI_DeleteObject( $hFont ) ; Restore font of Header control Local $hHeader = _GUICtrlListView_GetHeader( $hListView ) If $hHeader Then _WinAPI_SetFont( $hHeader, $hLVfont ) ; Return original ListView font Return $hLVfont EndFunc Large images will also increase the height of listview items. See example E. Height of listview If the height of the listview does not fit an integer number of rows, you can see empty space below last row in the bottom of the listview. This issue is exacerbated by tall items. The following function is used to calculate the height of the listview to match a given number of rows: Func _GUICtrlListView_GetHeightToFitRows( $hListView, $iRows ) ; Get height of Header control Local $tRect = _WinAPI_GetClientRect( $hListView ) Local $hHeader = _GUICtrlListView_GetHeader( $hListView ) Local $tWindowPos = _GUICtrlHeader_Layout( $hHeader, $tRect ) Local $iHdrHeight = DllStructGetData( $tWindowPos , "CY" ) ; Get height of ListView item 0 (item 0 must exist) Local $aItemRect = _GUICtrlListView_GetItemRect( $hListView, 0, 0 ) ; Return height of ListView to fit $iRows items ; Including Header height and 8 pixels of additional room Return ( $aItemRect[3] - $aItemRect[1] ) * $iRows + $iHdrHeight + 8 EndFunc The calculation includes the height of the header. This means that the function works for a multi-line header with tall items (example A and B). Reference example WM_NOTIFY messages and NM_CUSTOMDRAW notifications are send to the parent of the listview control. The parent is the AutoIt GUI and messages can be handled by a function registered with GUIRegisterMsg. Example 1 is a reference example which shows the different stages of the custom drawing process. None of the stages contains any code except for ConsoleWrite statements. This is code for the reference example: #include <GUIConstants.au3> #include <GuiListView.au3> #include "GuiListViewEx.au3" Opt( "MustDeclareVars", 1 ) Global $hGui, $idListView, $hListView, $fListViewHasFocus = 0, $iItems = 3, $bAutoItMsgLoop = False Example() Func Example() ; Create GUI $hGui = GUICreate( "Custom draw stages", 420, 200 ) ; Create ListView $idListView = GUICtrlCreateListView( "", 10, 10, 400, 180, $GUI_SS_DEFAULT_LISTVIEW-$LVS_SINGLESEL, $WS_EX_CLIENTEDGE+$LVS_EX_FULLROWSELECT+$LVS_EX_GRIDLINES ) $hListView = GUICtrlGetHandle( $idListView ) ; Add columns to ListView _GUICtrlListView_AddColumn( $hListView, "Column 1", 94 ) _GUICtrlListView_AddColumn( $hListView, "Column 2", 94 ) _GUICtrlListView_AddColumn( $hListView, "Column 3", 94 ) _GUICtrlListView_AddColumn( $hListView, "Column 4", 94 ) ; Fill ListView For $i = 0 To $iItems - 1 GUICtrlCreateListViewItem( $i & "/Column 1|" & $i & "/Column 2|" & $i & "/Column 3|" & $i & "/Column 4", $idListView ) Next ; Adjust height of GUI and ListView to fit ten rows Local $iLvHeight = _GUICtrlListView_GetHeightToFitRows( $hListView, 10 ) WinMove( $hGui, "", Default, Default, Default, WinGetPos( $hGui )[3] - WinGetClientSize( $hGui )[1] + $iLvHeight + 20 ) WinMove( $hListView, "", Default, Default, Default, $iLvHeight ) ; Register WM_NOTIFY message handler ; To handle NM_CUSTOMDRAW notifications ; And to check when ListView receives/loses focus GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" ) ; Register WM_ACTIVATE message handler ; If GUI loses focus selected listview items are drawn with a button face background color. ; To check when GUI receives/loses focus ; When GUI receives focus selected items are redrawn with the dark blue background color. GUIRegisterMsg( $WM_ACTIVATE, "WM_ACTIVATE" ) ; Detection of received focus is faster through the WM_ACTIVATE message than directly ; through the listview. This provides a faster and smoother redraw of selected items. ; Show GUI GUISetState( @SW_SHOW ) ; Message loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch If Not $bAutoItMsgLoop Then _ ; We want to see only one message at a time $bAutoItMsgLoop = ( ConsoleWrite( "AutoIt message loop <<<<<<<<<<<<<<<<<<<<<" & @CRLF ) > 0 ) WEnd ; Cleanup GUIDelete() EndFunc ; WM_NOTIFY message handler Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam ) #forceref $hWnd, $iMsg, $wParam Local $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) Local $hWndFrom = HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ) Local $iCode = DllStructGetData( $tNMHDR, "Code" ) Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW $bAutoItMsgLoop = False Local $tNMLVCustomDraw = DllStructCreate( $tagNMLVCUSTOMDRAW, $lParam ) Local $dwDrawStage = DllStructGetData( $tNMLVCustomDraw, "dwDrawStage" ) Switch $dwDrawStage ; Specifies the drawing stage ; Stage 1 Case $CDDS_PREPAINT ; Before the paint cycle begins ConsoleWrite( "Stage 1: CDDS_PREPAINT" & @CRLF ) Return $CDRF_NOTIFYITEMDRAW + _ ; Stage 2 will be carried out $CDRF_NOTIFYPOSTPAINT ; Stage 6 will be carried out Return $CDRF_NOTIFYITEMDRAW ; Notify the parent window before an item is painted Return $CDRF_NOTIFYPOSTPAINT ; Notify the parent window after the paint cycle is complete ; Stage 2 Case $CDDS_ITEMPREPAINT ; Before an item is painted ConsoleWrite( "Stage 2: CDDS_ITEMPREPAINT" & @CRLF ) Return $CDRF_NOTIFYSUBITEMDRAW + _ ; Stage 3 will be carried out $CDRF_NOTIFYPOSTPAINT ; Stage 5 will be carried out Return $CDRF_NOTIFYSUBITEMDRAW ; Notify the parent window before a subitem is painted Return $CDRF_NOTIFYPOSTPAINT ; Notify the parent window after an item is painted ; Stage 3 Case BitOR( $CDDS_ITEMPREPAINT, _ $CDDS_SUBITEM ) ; Before a subitem is painted ConsoleWrite( "Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM" & @CRLF ) Return $CDRF_NOTIFYPOSTPAINT ; Stage 4 will be carried out Return $CDRF_NOTIFYPOSTPAINT ; Notify the parent window after a subitem is painted ; Stage 4 Case BitOR( $CDDS_ITEMPOSTPAINT, _ $CDDS_SUBITEM ) ; After a subitem has been painted ConsoleWrite( "Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM" & @CRLF ) ; Stage 5 Case $CDDS_ITEMPOSTPAINT ; After an item has been painted ConsoleWrite( "Stage 5: CDDS_ITEMPOSTPAINT" & @CRLF ) ; Stage 6 Case $CDDS_POSTPAINT ; After the paint cycle is complete ConsoleWrite( "Stage 6: CDDS_POSTPAINT" & @CRLF ) EndSwitch Case $NM_KILLFOCUS If $fListViewHasFocus Then GUICtrlSendMsg( $idListView, $LVM_REDRAWITEMS, 0, $iItems - 1 ) $fListViewHasFocus = 0 EndIf Case $NM_SETFOCUS If Not $fListViewHasFocus Then _ GUICtrlSendMsg( $idListView, $LVM_REDRAWITEMS, 0, $iItems - 1 ) $fListViewHasFocus = 2 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ; WM_ACTIVATE message handler Func WM_ACTIVATE( $hWnd, $iMsg, $wParam, $lParam ) #forceref $iMsg, $lParam If $hWnd = $hGui Then _ $fListViewHasFocus = BitAND( $wParam, 0xFFFF ) ? 1 : 0 Return $GUI_RUNDEFMSG EndFunc Code is added to check when GUI and listview receives and loses focus. This is important in the other examples. Output in SciTE console immediately after example is opened: Stage 1: CDDS_PREPAINT Stage 2: CDDS_ITEMPREPAINT Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 5: CDDS_ITEMPOSTPAINT Stage 2: CDDS_ITEMPREPAINT Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 5: CDDS_ITEMPOSTPAINT Stage 2: CDDS_ITEMPREPAINT Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 3: CDDS_ITEMPREPAINT, CDDS_SUBITEM Stage 4: CDDS_ITEMPOSTPAINT, CDDS_SUBITEM Stage 5: CDDS_ITEMPOSTPAINT Stage 6: CDDS_POSTPAINT AutoIt message loop <<<<<<<<<<<<<<<<<<<<< Note that the entire custom draw process from stage 1 to 6 is not interrupted by the AutoIt message loop. The other examples are all based on the reference example. Examples This is common to all examples. First line in item texts is stored directly in the listview. Additional lines are stored in a global array named $aLines. Index in the array is item ID as returned by GUICtrlCreateListViewItem and stored in ItemParam internally in listview memory. Item texts and background is drawn with custom code. Other item elements and background is drawn with default code. In all examples LVS_SINGLESEL style is removed to be able to select multiple items. This is a picture of example E: Example 2, 3 and 4 are simple examples. Example 5 and 6 deals with subitem icons and colors. Example 7 about listview notifications shows a way to catch double click and Enter key. A dummy control is used to forward the double click event to AutoIt main message loop to avoid lengthy or blocking code in WM_NOTIFY function. Example 8 and 9 shows how to respond to header notifications and how to rearrange columns by dragging header items with the mouse. In both examples LVS_EX_HEADERDRAGDROP extended style is added to the listview. When columns are rearranged, header item index and listview subitem index is always the same independent of column position, while header item order changes depending on column position. Because the header is a child control of the listview, the listview must be subclassed to catch header notifications. Subclassing is implemented with the four functions SetWindowSubclass, GetWindowSubclass, RemoveWindowSubclass and DefSubclassProc (all implemented in WinAPIShellEx.au3). Since we are subclassing a header control contained in a listview this issue must be taking into account. Note that the subclass callback function is only running while the primary mouse button is pressed on the header. This means no performance impact on the listview eg. when you are dragging the scroll bar. This is important for a custom drawn listview. Quite a lot of extra code is added (most easily seen in example 9) to fix an issue due to column 0 and other columns have different left margins. When first column is moved to another position there is a white gap between columns for selected rows (Windows XP), or the text is painted too close to the left edge of the item (Windows 7). The problem is seen in the picture to the right where the two first columns are swapped: LVS_EX_HEADERDRAGDROP style is only used in example 8 and 9. Usage of a multi-line header is demonstrated in example A and B. See Custom/owner drawn multi-line header in ListView for more information. Example C shows a method to deal with focus issues when more controls (here just a single button) are added to the GUI. When the listview has focus selected items are drawn with the dark blue background color. The problem arises if the listview and GUI loses focus eg. to Calculator. When focus is lost selected items are drawn with the button face background color. If GUI receives focus again by clicking the button (and not the listview), selected items are first very briefly redrawn with the dark blue background color (it seems like a blink) and then with the correct button face background color. To avoid this issue a hidden label control is added to the GUI. Immediately before the GUI loses focus, focus is moved from the listview to the label. In example D items are added with the commands _GUICtrlListView_AddItem and _GUICtrlListView_AddSubItem. In all examples an array is used to store the multi-line item texts. The array contains all lines except the first line which is stored directly in the listview. This example shows how to manually store array row index in ItemParam when items are added with _GUICtrlListView_AddItem and _GUICtrlListView_AddSubItem. Inspiration for example E about large images in first column (see picture above) comes from this thread. In example E the images are used to increase the height of the listview items instead of a text font. Because it's large 128x128 pixel images there is plenty of room in subitems in second and third column. In all examples 15 lines of code is used to repaint the first line item text. The text that was painted by default code in middle of the item is first deleted by filling the item with the background color. Then the text is extracted from the listview and repainted in top of item. This code can be avoided by storing all text lines in the array. This is demonstrated in example F. This makes the custom draw code faster. Performance considerations In a custom drawn (or owner drawn or virtual) listview performance considerations are important because the custom drawing (or owner drawing or data display) is performed by AutoIt code. In a normal listview drawing and data display is performed by compiled C++ code in ComCtl32.dll. Lengthy and slow code in NM_CUSTOMDRAW Case statements (or WM_DRAWITEM functions or LVN_GETDISPINFO Case statements) should be avoided. Perform as many calculations as possible before the repetitive and fast executions of these code blocks. Use static variables to avoid repeating the same calculation again and again. Executing a function directly with DllCall or GUICtrlSendMsg is faster than executing the same function through an implementation in an UDF. Simple GDI functions are faster than more advanced GDI+ functions. Use different drawing stages to optimize custom drawing. The CDDS_PREPAINT stage is only performed once for the entire drawing process. The CDDS_ITEMPREPAINT stage is performed once per item. The stage given by BitOR( CDDS_ITEMPREPAINT, CDDS_SUBITEM ) is performed once per subitem including subitem 0. Default drawing should be used as much as possible, because the code is running in ComCtl32.dll. In a listview the time it takes to update all visible rows is proportional to the number of visible rows. Reducing the height of the list view and thus the number of visible rows improves performance. Especially in a custom drawn (or owner drawn or virtual) listview. ListviewMultilineItems.7z 1) Custom draw stages.au3 2) Two-line listview items.au3 3) Three-line listview items.au3 4) First column checkbox and icon.au3 5) Check boxes and icons.au3 6) Background and text colors.au3 7) ListView notifications.au3 8) Header notifications.au3 9) Rearrange columns.au3 A) Multi-line header 1.au3 A) Multi-line header 2.au3 C) Button control.au3 D) _GUICtrlListView_AddItem.au3 E) Large images in first column.au3 F) Storing all lines in array.au3 GuiHeaderEx.au3 GuiListViewEx.au3 ListViewCustomDraw.au3 Images\ 8 images for example E 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.) ListviewMultilineItems.7z1 point -
I love chiptune music, but BASS only support XM, IT, S3M, MOD, MTM, UMX and MO3 file format for MOD music. 1 | Nintendo NES and SNES Sound File Players May be you already have some files with extension nsf, nsfe, spc or rsn (unzip rsn files for get spc collection files inside) but you can't play them in a AutoIt script ? So I searched around a bit, and found 2 DLL ( nsf_player.dll and spc_player.dll ) for play Nintendo NES and SNES Sound Files. Interest of those DLL is that they can play from file path or binary data, avoiding temp files. Dll and audio files are embedded in scripts for permit you to test them right away. Some info/download links are in front of each script. 2 | ModPlug Player Another dll found : npmod32.dll who support mod, s3m, xm, med, it, s3z, mdz, itz, xmz and wav files. Interest : it can play some rares chiptune formats, you can also pause, set volume and set position. Inconvenient : do not load from binary datas. Dll and audio files are embedded in script and i have added a gui for permit you to try right away ! Warning : Do not work on Win8. 3 | ZXTune Player 2 (basszxtune.dll v2.4.5) UPDATE of 23 DEC 2016 Using BASSZXTUNE chiptune support for BASS ( Support as0, asc, ay, ftc, gtr, psc, psg, psm, pt1, pt2, pt3, sqt, st1, s, st3, stc, stp, ts, txt, vtx, ym, chi, dmm, dst, m, sqd, str, sid, cop, tf0, tfc, tfd, tfe, $b, $m, ahx, ayc, bin, cc3, d, dsq, esv, fdi, gam, gamplus, gbs, gym, hes, hrm, hrp, lzs, msp, mtc, nsf, nsfe, p, pcd, sap, scl, spc, szx, td0, tlz, tlzp, trd, trs, vgm ) Interest : it can play lot of rares chiptune formats, while benefiting from all bass functions. Inconvenient : dll size.(5860ko) Dll and audio files are embedded in script. 4 | TitchySID Player Files and dll are loaded in memory. Interest : dll size (8ko), you can Play/Stop/Pause/Resume and choose which subsong to play. Inconvenient : only SID audio files supported ( PSID & RSID) Dll and audio files are embedded in script. Tested under Win7 and Win8. Edit : added a Sid header viewer : SidHeaderViewer.au3 5 | MiniFmod Player Interest : dll size (20ko) Inconvenient : only xm audio files supported. 6 | Npnez Player Using npnez.dll (88ko) for play Gameboy Sound System audio files and some others ( kss, hes, nsf, ay, gbr, gbs, gb, nsd, sgc ) Interest : Can be loaded in memory, subsong can be set and volume can be adjusted ( perfect for create a fade when exiting ) Inconvenient : for an unknow reason, only 20% of my hes collection is playable... 7 | µFMOD Player Interest : dll size (10ko), can be loaded in memory, support Play/Stop/Pause/Resume actions and volume can be adjusted ( perfect for create a fade when exiting ) Inconvenient : only xm audio files supported. 8 | MagicV2m Player Interest : dll size (20ko), Play/Stop/IsPlay/SetAutoRepeat/Progress Inconvenient : only v2m audio files supported, V2mPlayStream is not reliable, so prefer V2mPlayFile instead. 9 | OSMEngine Player OSMEngine.dll (80 ko)(Oldskool Musics Engine) permit to play snd, sndh, fc, fc4, fc14 and some rare jam audio files from Amiga/Atari ST(E) Interest : audio can be loaded in memory, and Pause/Resume/SetVolume/GetInfos are available Inconvenient : none at the moment. 10 | Ayfly Player Ayfly.dll (268 ko) is a AY-891x emulator and player who support the following tracker formats : aqt, asc, ay, fxm, gtr, psc, psg, pt1, pt2, pt3, sqt, stc, stp, vtx, ym and zxs (ZX Spectrum Emulator Snapshot) files. Interest : SetVolume/GetInfos are available Inconvenient : a function named "ay_initsongindirect" for load module in memory exists, but due to the poor documentation provided i do not succeed to get it to work... 11 | GMGME Player GMGME.dll is a emulated music DLL that allows you to play ay, gbs, gym, hes, kss, nsf/nsfe, sap, spc and vgm files. Interest : Can play ATARI SAP files (only type B and C) , Set Volume and Set Tempo are available Inconvenient : Dll Size (and his imports) , and audio files can not be loaded in memory. 12 | SC68 Player sc68replay.dll (166 ko) is a Freebasic DLL compiled from "sc68replay" src that allows you to play SC68 (Atari ST and Amiga audio formats) files. Interest : Can play from file and memory Inconvenient : Unfortunatelly for an unknown reason not all sc68 files are supported. 13 | Extended Module Player LibXmp.dll (272 ko) can "read" xm, mod, it, s3m, med, 669 but also some rares formats abk, amd, amf, dbm, digi, dtm, emod, far, flx, fnk, gdm, hsc, imf, j2b, liq, m15, mdl, mfp, mgt, mtm, mtn, okt, psm, ptm, rad, rtm, sfx, smp, stim, stm, stx, ult, umx, wow, ym3812 Despite its name, it's not a "player" but a library that renders module files to RAW PCM data. So the interest in this script was to find a way to convert those raw datas into a "playable" sound. With Waveform Audio Interface i create a pseudo Wav header who permit to play datas as a Wav file. Interest : Can play from file and memory Inconvenient : Time to render datas (depends of file size) 14 | LibModPlug Player LibModPlug.dll (102 ko) can "read" xm, it, mod, s3m, med, 669 and also amf, ams, dbm, dmf, dsm, far, j2b, mdl, mt2, mtm, okt, psm, ptm, stm, ult, umx. As LibXmp.dll, it's a library that renders module files to RAW PCM data. For this one, i create a real binary wave header for be able to play it easily from memory with winmm.dll PlaySoundW function. Interests : Can play from file and memory, and have some nice sound effects : Surround, MegaBass and Reverb (used in script example) It can also replace modplug player(2) for Win 8+ users Inconvenient : Time to render datas (depends of file size) 15 | AdPlug Player AdPlug.dll ( 69ko ) is an AdLib sound player library who is able to play the following files type : A2M, ADL, AMD, BAM, CFF, CMF, D00, DFM, DMO, DRO, DTM, HSC, HSP, IMF, KSM, LAA, LDS, M, MAD, MID, MKJ, MSC, MTK, RAD, RAW, RIX, ROL, S3M, SA2, SAT, SCI, SNG, XAD, XMS, XSM For this one, time to render datas is to long, so i needed to find an other way for play modules. Using Bass.dll and particulary the "BASS_StreamPutData" function i succeeded to play module in loop while rendering it. Both DLL are loaded in memory, and 16 different module types are available in the script. No includes/files needed. Just run it. Warning : for a unique file extension (example .sng), it's sometimes possible to have several filetypes from different trackers ! AdPlug.dll Imports : msvcp71.dll, msvcr71.dll in C:\Windows\SysWOW64 ( VC Redist Installer ) Interests : Can read some obscure rare formats. Inconvenient : Can not read from memory 16 | LibMikmod Player LibMikmod.dll (85ko) will currently play the following common and not so common formats : 669, AMF, DSM, FAR, GDM, IMF, IT, MED, MOD, MTM, S3M, STM, STX, ULT, UNI, XM Interests : Can load from memory Inconvenient : only for full-screen applications, because if the application has not the focus sound is muted Downloads are available in the download section Dedicated to chiptune Lovers ! Music Links : asma.atari.org woolyss.com chipmusic.org demozoo.org modarchive.org modules.pl keygenmusic.net zxtunes.com mazemod.org amigaremix.com pouet.net plopbox.eu Modland1 point
-
resize controls bar
argumentum reacted to LarsJ for a topic
Mr. argumentum, I've added code to handle maximize, minimize and restore: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Opt( "MustDeclareVars", 1 ) Global Const $iTitlebarHeight = _WinAPI_GetSystemMetrics( 31 ) ; 31 = $SM_CYSIZE Global Const $iBorderHeight = _WinAPI_GetSystemMetrics( 33 ) ; 33 = $SM_CYSIZEFRAME Global $hForm1, $idEdit1, $idEdit2, $hGuiAsDivider, $iMinHeight = 0 Example() Func Example() ; Reduce flicker $hForm1 = GUICreate( "Form1", 470, 490, -1, -1, BitOR( $GUI_SS_DEFAULT_GUI, $WS_OVERLAPPEDWINDOW, $WS_TABSTOP, $WS_CLIPCHILDREN ) ) $idEdit1 = GUICtrlCreateEdit( "Edit1", 10, 10, 450, 200 ) $idEdit2 = GUICtrlCreateEdit( "Edit2", 10, 240, 450, 240 ) GUICtrlSetResizing($idEdit1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) GUICtrlSetResizing($idEdit2, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT) ; Use a child window to reduce flicker $hGuiAsDivider = GUICreate( "", 452, 10, 4, 214, $WS_POPUP, $WS_EX_MDICHILD, $hForm1 ) Local $idLabelAsDivider = GUICtrlCreateLabel("", 0, 0, 452, 10, $SS_ETCHEDFRAME) GUICtrlSetCursor( $idLabelAsDivider, 11 ) GUISetState( @SW_SHOWNOACTIVATE, $hGuiAsDivider ) GUISwitch( $hForm1 ) GUIRegisterMsg( $WM_SIZE, "WM_SIZE" ) GUIRegisterMsg( $WM_GETMINMAXINFO, "WM_GETMINMAXINFO" ) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $idLabelAsDivider ResizeEditCtrls() Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESIZED Local $aPos1 = ControlGetPos( $hForm1, "", $idEdit1 ) WinMove( $hGuiAsDivider, "", Default, WinGetPos( $hForm1 )[1] + $iTitlebarHeight + $iBorderHeight + $aPos1[3] + 20 + 2, $aPos1[2] ) ControlMove( $hForm1, "", $idEdit2, default, $aPos1[3] + 40 ) Case $GUI_EVENT_RESTORE Local $aPos1 = ControlGetPos( $hForm1, "", $idEdit1 ) If $aPos1[3] < 100 Then GUICtrlSetResizing($idEdit1, $GUI_DOCKALL ) GUICtrlSetResizing($idEdit2, $GUI_DOCKALL ) ControlMove( $hForm1, "", $idEdit1, Default, Default, $aPos1[2], 100 ) ControlMove( $hForm1, "", $idEdit2, Default, 100 + 40, $aPos1[2], WinGetClientSize( $hForm1 )[1] - 100 - 40 - 10 ) GUICtrlSetResizing($idEdit1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) GUICtrlSetResizing($idEdit2, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT) EndIf WinMove( $hGuiAsDivider, "", Default, WinGetPos( $hForm1 )[1] + $iTitlebarHeight + $iBorderHeight + $aPos1[3] + 20 + 2, $aPos1[2] ) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Cleanup GUIDelete($hForm1) Exit EndFunc Func ResizeEditCtrls() Local $aInfo = GUIGetCursorInfo( $hForm1 ), $y0 = $aInfo[1], $yPrev = $aInfo[1], $dy Local $aPos = WinGetPos( $hGuiAsDivider ), $aPos1 = ControlGetPos( $hForm1, "", $idEdit1 ), $aPos2 = ControlGetPos( $hForm1, "", $idEdit2 ) GUICtrlSetResizing($idEdit1, $GUI_DOCKALL ) GUICtrlSetResizing($idEdit2, $GUI_DOCKALL ) Do If $aInfo[1] <> $yPrev Then $dy = $aInfo[1] - $y0 If $aPos1[3] + $dy > 100 And $aPos2[3] - $dy > 100 Then WinMove( $hGuiAsDivider, "", Default, $aPos[1] + $dy ) ControlMove( $hForm1, "", $idEdit1, Default, Default, $aPos1[2], $aPos1[3] + $dy ) ControlMove( $hForm1, "", $idEdit2, Default, $aPos2[1] + $dy, $aPos2[2], $aPos2[3] - $dy ) EndIf $yPrev = $aInfo[1] EndIf $aInfo = GUIGetCursorInfo( $hForm1 ) Until $aInfo[2] = 0 GUICtrlSetResizing($idEdit1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) GUICtrlSetResizing($idEdit2, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT) $iMinHeight = 0 EndFunc ; Resize the status bar when GUI size changes Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $aPos = ControlGetPos( $hForm1, "", $idEdit1 ) If $aPos[3] <= 100 Then $iMinHeight = WinGetPos( $hForm1 )[3] WinMove( $hGuiAsDivider, "", Default, WinGetPos( $hForm1 )[1] + $iTitlebarHeight + $iBorderHeight + $aPos[3] + 20, $aPos[2] ) Return $GUI_RUNDEFMSG EndFunc Func WM_GETMINMAXINFO( $hWnd, $iMsg, $wParam, $lParam ) Local $tMINMAXINFO = DllStructCreate( "int;int;int;int;int;int;int;int;int;int", $lParam ) DllStructSetData( $tMINMAXINFO, 8, $iMinHeight ) ; Min GUI height EndFunc1 point -
Timppa, Really? Here is a simple version for the case you describe, although it can be expanded to as many combos as you wish: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <GuiComboBox.au3> ; Array to hold combo ControlIDs Global $aCombo[4] = [3] ; Array to hold combo data - only full list set for first combo, note leading | Global $aData[4] = [3, "|Bob|Jane|Fred"] $hGUI = GUICreate("Test", 500, 500) ; Create combos - set as read-only For $i = 1 To $aCombo[0] $aCombo[$i] = GUICtrlCreateCombo("", (150 * $i) - 140, 10, 100, 20, $CBS_DROPDOWNLIST) ; Set a cuebanner to display if no selection made _GUICtrlComboBox_SetCueBanner($aCombo[$i], "Not set") Next ; Load first combo with all data GUICtrlSetData($aCombo[1], $aData[1]) ; Create button to check if all combos set $cCheck = GUICtrlCreateButton("Check", 10, 100, 80, 30) GUICtrlSetState($cCheck, $GUI_FOCUS) GUISetState() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $cCheck ; Set check flag $bCheck = True ; Loop through combos For $i = 1 To $aCombo[0] ; Get selection - if CueBanner displayed then no selection returned If GUICtrlRead($aCombo[$i]) = "" Then ; Clear flag $bCheck = False ; No point in checking further ExitLoop EndIf Next If $bCheck Then ; No empty combos MsgBox($MB_SYSTEMMODAL, "Correct", "All priorities set") Else ; At least one enpty combo MsgBox($MB_SYSTEMMODAL, "Error", "Please set all priorities") EndIf Case Else ; Must be a combo For $i = 1 To $aCombo[0] - 1 ; No need to do anything when final combo actioned If $iMsg = $aCombo[$i] Then ; Read combo selection $sSel = GUICtrlRead($aCombo[$i]) ; Take current combo selection with trailing "|", remove the selected item and then remove the trailing "|" ; This is required in case one element is a subset of another $aData[$i + 1] = StringTrimRight(StringReplace($aData[$i] & "|", "|" & $sSel & "|", "|"), 1) ; Set the shortened data in the next combo GUICtrlSetData($aCombo[$i + 1], $aData[$i + 1]) ; Empty all remaining combos For $j = $i + 2 To $aCombo[0] - 1 GUICtrlSetData($aCombo[$j], "") Next ; No point in looping further ExitLoop EndIf Next EndSwitch WEndIs that clearer? M231 point
-
You are disposing the old graphic handle which causes the crash! Try this: #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <file.au3> #include <array.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include<ComboConstants.au3> #include <GUIComboBox.au3> $Form1 = GUICreate("Form1", 300, 200, -1, -1) $iPic = GUICtrlCreatePic("", 0, 0, 300, 60) $hPic = GUICtrlGetHandle($iPic) $Combo1 = GUICtrlCreateCombo("Select Font", 25, 64, 250, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_DROPDOWNLIST)) $s_FontList = _FileListToArray(@WindowsDir & "\Fonts\","*.ttf") $NFontList = UBound($s_FontList)-1 For $ff = 1 to $NFontList GUICtrlSetData($Combo1, StringTrimRight($s_FontList[$ff],4)) Next Global $hGraphic GUISetState(@SW_SHOW) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hPic) _GDIPlus_GraphicsClear($hGraphic, 0xFFF0F0F0) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Exit Case $Combo1 EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo If Not IsHWnd($combo1) Then $hWndCombo = GUICtrlGetHandle($Combo1) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $combo1, $hWndCombo Switch $iCode ; no return value Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box _DebugPrint("$CBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) $sFont = GUICtrlRead($Combo1) $sFontname = _WinAPI_GetFontResourceInfo(@WindowsDir & "\Fonts\" & $sFont & ".ttf") _GDIPlus_GraphicsClear($hGraphic, 0xFFF0F0F0) _GDIPlus_GraphicsDrawString($hGraphic, $sFontname, 10, 10, $sFontname, 24) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND functia de autocomplete la combo Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint1 point
-
Click witout name or id?
elmoi0010 reacted to alexandruc for a topic
Hi, is the following working? $oTDs = _IETagnameGetCollection($oIE, "input") For $input in $oTDs If String($input.value) = "Login" Then _IEAction($input, "click") ExitLoop EndIf Next1 point -
GUICtrlRead returns a number from a listview instead of the text
PetterBomban reacted to BrewManNH for a topic
I wouldn't use a For In loop with the array returned by the first function, the first element of the array is going to be the count of selected items in the listview. This is going to give you wrong results. You should use a regular For/Next loop instead and start the loop at 1 instead of zero.1 point -
_IEFormElementSetValue ($CIDNsearch, ClipGet())1 point
-
Help me with pattern in StringRegExp
123disconnect reacted to mikell for a topic
Matter of perspective1 point -
Help me with pattern in StringRegExp
123disconnect reacted to jguinch for a topic
Yes, but more complex...1 point -
Help me with pattern in StringRegExp
123disconnect reacted to mikell for a topic
Haha yes the 'force reset' thing does the trick The lookaround is not bad either1 point -
Help me with pattern in StringRegExp
123disconnect reacted to jguinch for a topic
Xenobiologist's regex works, but must be enclosed in a duplicate subpattern group : #include <array.au3> $pattern = '(?|%(\w+)%|,\s*(\w+))' $str = "%abcd% = Section, hardwareID_1, hardwareID_2, ..... ,HardwareID_n" $array = StringRegExp($str, $pattern, 3) _ArrayDisplay($array)1 point -
Help me with pattern in StringRegExp
123disconnect reacted to ViciousXUSMC for a topic
mikell always got the regex I figured a non capture group of some sort would be the fix, mind explaining how come your regex does not produce the same blank elements as Xeno's is it the lookbehind?1 point -
Help me with pattern in StringRegExp
123disconnect reacted to Xenobiologist for a topic
Sorry, I just did a quick answer. I did oversee the ||. So, mikells solution is more correct.1 point -
Or do it the right way and declare both variables, and then set the values to them inside the switch statement. Func _DoStuff($iParm) Local $sVar1, $sVar2 Switch $iParm Case 1 $sVar1 = "w" $sVar2 = "x" ; do stuff Return Case 2 $sVar1 = "y" $sVar2 = "z" ; do stuff Return EndSwitch EndFuncConditionally declaring variables is a bad idea.1 point
-
Declaring local variables in condition
Radiance reacted to JLogan3o13 for a topic
@Radiance, do you need all four variables? In my mind, you're saying "If condition One exists, declare "w" and "x", but if condition Two exists, declare "y" and "z". Why can't you do that with just two vars? If condition Two is true, you're not going to use "w" and "x" right? Func _DoStuff($iParm) Switch $iParm Case 1 Local $sVar1 = "w", $sVar2 = "x" ; do stuff Return Case 2 Local $sVar1 = "y", $sVar2 = "z" ; do stuff Return EndSwitch EndFunc1 point -
Help me with pattern in StringRegExp
123disconnect reacted to mikell for a topic
Please manage the character set [\w.#] depending on the syntax of the elements to get #include<array.au3> $pattern = '(?<=%|,)\s*([\w.#]+)' $str = "%abcd% = Section, hardwareID_#1, hardwareID_2, ..... ,HardwareID_n" $array = StringRegExp($str, $pattern, 3) _ArrayDisplay($array)1 point -
Help me with pattern in StringRegExp
123disconnect reacted to ViciousXUSMC for a topic
Works good Xeno except seems to to produce line extra array elements between the results. Probably can be fixed in the regex, but I would probably just strip it like this: #Include <Array.au3> #Include <StringConstants.au3> $sPattern = '%(\w+)%|,\s*(\w+)' $sString = "%abcd% = Section, hardwareID_1, hardwareID_2, ..... ,HardwareID_n" $aArray = StringRegExp($sString, $sPattern, $STR_REGEXPARRAYGLOBALMATCH) $sString2 = _ArrayToString($aArray, "|") $sString2 = StringReplace($sString2, "||", "|") $aArray2 = StringSplit($sString2, "|", $STR_NOCOUNT) _ArrayDisplay($aArray2)1 point -
Help me with pattern in StringRegExp
123disconnect reacted to Xenobiologist for a topic
Maybe this way #include<array.au3> $pattern = '%(\w+)%|,\s*(\w+)' $str = "%abcd% = Section, hardwareID_1, hardwareID_2, ..... ,HardwareID_n" $array = StringRegExp($str, $pattern, 3) ConsoleWrite(_ArrayToString($array) & @CRLF)1 point -
Please check service code windows
khidotdn reacted to JLogan3o13 for a topic
@khidotdn, welcome to the forum. As water mentions, we try to adhere to the "teach a man to fish" motto. I do have the following snippet I use, however, that at least gets you started. You can change the $sService variable to the name of the service you're looking for. $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $sService = "Application Identity" $oWMI = ObjGet("winmgmts:\\.\root\cimv2") $oItems = $oWMI.ExecQuery("SELECT * FROM Win32_Service", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($oItems) Then For $oService In $oItems If $oService.DisplayName = $sService Then ConsoleWrite($oService.DisplayName & " | " & $oService.StartMode & @CRLF) EndIf Next EndIfFrom here, I would suggest you take some time to read through the help file to create your GUI. Below is a simple framework that will get you started. I'll leave it to you to learn how to add your own button (look at GUICtrlCreateButton in the help file) and put the code together: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 300, 300) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndOnce you have done some reading, and tried some things out on your own, feel free to post your code here if you run into issues. We will do our best to assist.1 point -
Welcome to AutoIt and the forum! Can you please show us what you have tried so far?1 point
-
Total privacy
AdmiralAlkex reacted to TouchOdeath for a topic
LOL! Your right, science itself is fine, but its mans application of it thats not always good.1 point -
GUICtrlRead returns a number from a listview instead of the text
PetterBomban reacted to BrewManNH for a topic
Use _GUICtrlListView_GetSelectedIndices and loop through the array to find out what the text/information is from those selected indices.1 point -
PostStampBuilder
coffeeturtle reacted to wakillon for a topic
Create Postage Stamp from any images. Transparency is preserved around serrated edges for permit to paste stamp. Downloads are available in the download section Hope you like it ! Edit : The glue is not supplied with the stamp!1 point