Laddy Posted November 16, 2010 Share Posted November 16, 2010 (edited) Hello I am a beginner and I do not understand why I have a square and the information not coming out correctly Sorry for my english, i speak a little bit. expandcollapse popup#include <GUIConstantsEx.au3> ; pour la gui #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> Opt("GUIDataSeparatorChar",@CRLF) $Gui = GUICreate(" Un clic", 700, 360) ;h360 w326 $BouttonLister = GUICtrlCreateButton("Lister", 6, 145, 100, 25) $ListePoint = GUICtrlCreateList("", 6, 190, 660, 160) ;310 GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling GUISetState(@SW_SHOW) Global $RPList ; On définie une variable vide Func WMIDateStringToDate($dtmInstallDate) Return (StringMid($dtmInstallDate, 5, 2) & "/" & _ StringMid($dtmInstallDate, 7, 2) & "/" & StringLeft($dtmInstallDate, 4) _ & " " & StringMid ($dtmInstallDate, 9, 2) & ":" & _ StringMid($dtmInstallDate, 11, 2) & ":" & StringMid($dtmInstallDate, _ 13, 2)) EndFunc Do GUISetState() $Msg = GUIGetMsg() Switch $Msg Case $BouttonLister GUICtrlSetData($ListePoint, "Wait, please...") $i = 0 $dtmConvertedDate = ObjCreate("WbemScripting.SWbemDateTime") $objWMI = ObjGet("winmgmts:\\localhost\root\default") $colItems = $objWMI.ExecQuery("SELECT * FROM SystemRestore") If $colItems.Count = 0 Then MsgBox(0, "No Point", "No restore point in system.") Else $i = $colItems.Count ;For Each $objItem In $colItems If IsObj($colItems) Then For $objItem In $colItems If $i < 6 Then $dtmConvertedDate.Value = $objItem.CreationTime $dtmCreationTime = $dtmConvertedDate.GetVarDate ;$RPList &= "[" & WMIDateStringToDate($objItem.CreationTime) & "] " & "RP" & $objItem.SequenceNumber & " - " & $objItem.Description & " " & @CRLF $RPList &= "[" & WMIDateStringToDate($dtmCreationTime) & "] " & "RP" & $objItem.SequenceNumber & " - " & $objItem.Description & " " & @CRLF EndIf $i = $i - 1 Next EndIf EndIf GUICtrlSetData($ListePoint, $RPList) $RPLIST = "" ; vide la variable EndSwitch Until $Msg = $GUI_EVENT_CLOSE With GuiCtrlCreateEdit i have no problem but with GuiCtrlCreateList i had problem. Why ? [11/15/2010 16:18:38] RP368 - toto [11/15/2010 17:27:55] RP369 - Revo Uninstaller's restore point - Google Chrome [11/15/2010 17:43:59] RP370 - Installed Opera 10.63. [11/16/2010 11:58:37] RP371 - Installed VirtualDrive [11/16/2010 12:15:44] RP372 - Removed VirtualDrive Edited November 17, 2010 by Laddy Link to comment Share on other sites More sharing options...
MrMitchell Posted November 16, 2010 Share Posted November 16, 2010 @CRLF = @CR & @LF Can you use either @CR or @LF instead? Link to comment Share on other sites More sharing options...
Laddy Posted November 16, 2010 Author Share Posted November 16, 2010 (edited) Oh great, thanks you very much. It's perfect now I have only used @LF Can you tell me if you can right click the mouse on a line with a menu to make an action? Edited November 16, 2010 by Laddy Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 16, 2010 Share Posted November 16, 2010 (edited) You can't use two characters (@CRLF) as a delimiter. Use just @CR or @LF, or even better just stick with the default pipe symbol (|). Another option is to just set the data for each item as you create it (don't have to create the big string first): #include <GUIConstantsEx.au3> ; pour la gui $Gui = GUICreate(" Un clic", 700, 360) ;h360 w326 $BouttonLister = GUICtrlCreateButton("Lister", 6, 145, 100, 25) $ListePoint = GUICtrlCreateList("", 6, 190, 660, 160) ;310 GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling GUISetState(@SW_SHOW) Global $RPList ; On définie une variable vide Do GUISetState() $Msg = GUIGetMsg() Switch $Msg Case $BouttonLister For $i = 1 To 6 GUICtrlSetData($ListePoint, "[" & _RandomDate() & "] " & "RP" & StringFormat("%04d", $i) & " - Some description for " & $i) Sleep(1000) Next EndSwitch Until $Msg = $GUI_EVENT_CLOSE Func _RandomDate() Return StringFormat("%02d/%02d/%04d %02d:%02d", Random(1, 12, 1), Random(1, 31, 1), Random(2009, 2011, 1), Random(0, 23, 1), Random(0, 59, 1)) EndFunc ;==>WMIDateStringToDate Edited November 16, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
MrMitchell Posted November 16, 2010 Share Posted November 16, 2010 (edited) Can you tell me if you can right click the mouse on a line with a menu to make an action?See post for an example of that...By the way, "Context menu" is what it's referred to...in case you need to search further on the subject. Edited November 16, 2010 by MrMitchell Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 16, 2010 Share Posted November 16, 2010 If that's not what you were looking for, you might consider changing your control from a List (which is a "ListBox" in MS-speak) to a ListView. The reason is that the standard API does not have a notification for right click on a ListBox, but there is one for a ListView (WM_NOTIFY = NM_RCLICK).There are many examples posted on how to register WM_NOTIFY messages and detect the NM_RCLICK notification with a ListView control. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now