Leaderboard
Popular Content
Showing content with the highest reputation on 09/23/2014 in all areas
-
KEHT, I would do it like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> ; Flag to show if combo has dropped Global $bSelected = False $hGUI = GUICreate("Test", 500, 500) $cCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($cCombo, "1|2|3|4|5|6|7|8|9") $cList = GUICtrlCreateList("", 10, 100, 200, 200, BitOR($WS_BORDER, $WS_VSCROLL)) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cCombo ; If combo has dropped If $bSelected Then ; Clear flag $bSelected = False ; Add data GUICtrlSetData($cList, GUICtrlRead($cCombo)) EndIf EndSwitch ; look for combo dropping If _GUICtrlComboBox_GetDroppedState($cCombo) Then ; Set flag $bSelected = True EndIf WEnd You could probably look for a message that the combo has been dropped rather then polling in the loop - but I leave that to you to code. Please ask if anything is unclear. M23 Edit: Actually the message code is really easy, so here it is: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> ; Flag to show if combo has dropped Global $bSelected = False $hGUI = GUICreate("Test", 500, 500) $cCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($cCombo, "1|2|3|4|5|6|7|8|9") $cList = GUICtrlCreateList("", 10, 100, 200, 200, BitOR($WS_BORDER, $WS_VSCROLL)) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cCombo ; If combo has dropped If $bSelected Then ; Clear flag $bSelected = False ; Add data GUICtrlSetData($cList, GUICtrlRead($cCombo)) EndIf EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) If _WinAPI_HiWord($wParam) = $CBN_DROPDOWN Then ; Set flag $bSelected = True EndIf EndFunc1 point
-
PDFs without additional software?
Jewtus reacted to JLogan3o13 for a topic
With Word (from the help file) just use _Word_DocSaveAs and change the file type parameter: #include <Word.au3> $sPath = @DesktopDir & "\My.doc" $oWord = _Word_Create() $oDoc = _Word_DocOpen($oWord, $sPath) Sleep(2000) _Word_DocSaveAs($oDoc, @DesktopDir & "\My.pdf", $WdFormatPDF) Sleep(2000) _Word_Quit($oWord)1 point -
Massi, I have just checked the _GUIListView libraries in 3.3.8.1 and 3.3.12.0 and I have found the reason you see this change in behaviour. The _GUICtrlListView_DeleteAllItems in v3.3.8.1 did not actually work, so I rewrote it. If the ListView is created by the native GUICtrlCreateListView function deleting all the items takes some time, so I added an internal version of the Begin/EndUpdate function. Thus in your script, calling that function means that the ListView is updated as it exits and so you need to reset the StartUpdate state before you start refilling. I will add a remark to the _GUICtrlListView_DeleteAllItems page in the Help file explaining this - thanks for noticing it! M23 Edit: Remark added.1 point
-
Jewtus, Post runnable code - no-one is going to copy it from an image. M231 point
-
UEZ, May be you can use something like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> $hGUI = GUICreate("ListView Test", 400, 550) $iLV = GUICtrlCreateListView("", 0, 10, 400, 480, $LVS_SHOWSELALWAYS, BitOR($LVS_EX_FLATSB, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER)) _GUICtrlListView_AddColumn($iLV, "Date", 100, 1) _GUICtrlListView_AddColumn($iLV, "Size (bytes)", 100, 1) _GUICtrlListView_AddColumn($iLV, "File Name", 100, 1) For $i = 0 to 150 _GUICtrlListView_AddItem($iLV, "Row " & $i) _GUICtrlListView_AddSubItem($iLV, $i, $i * 2, 1) _GUICtrlListView_AddSubItem($iLV, $i, $i * 4, 2) Next _GUICtrlListView_SetItemChecked($iLV, 0) _GUICtrlListView_SetItemParam($iLV, 0, True) _GUICtrlListView_SetItemChecked($iLV, 1) _GUICtrlListView_SetItemParam($iLV, 1, True) _GUICtrlListView_SetItemChecked($iLV, 2) _GUICtrlListView_SetItemParam($iLV, 2, True) ControlFocus($hGUI, "", $iLV) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $tNMHDR, $iCode $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) $iCode = $tNMHDR.Code Switch $iCode Case $LVN_ITEMCHANGED Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) If BitAND($tInfo.Changed, $LVIF_STATE) = $LVIF_STATE Then Switch $tInfo.NewState Case 8192 ;item checked _GUICtrlListView_SetItemParam($iLV, $tInfo.Item, True) Case 4096 ;item unchecked _GUICtrlListView_SetItemParam($iLV, $tInfo.Item, False) EndSwitch EndIf Case $NM_CLICK Local $aInfo = GUIGetCursorInfo() Local $aTest = _GUICtrlListView_SubItemHitTest( $iLV, $aInfo[0], $aInfo[1] ) If Not ( Not $aTest[4] And $aTest[6] ) Then $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) Local $fChecked = Not _GUICtrlListView_GetItemParam($iLV, $tInfo.Index) _GUICtrlListView_SetItemParam($iLV, $tInfo.Index, $fChecked) _GUICtrlListView_SetItemChecked($iLV, $tInfo.Index, $fChecked) EndIf Case $NM_CUSTOMDRAW Local $tNMLVCUSTOMDRAW = DllStructCreate( $tagNMLVCUSTOMDRAW, $lParam ) Local $dwDrawStage = DllStructGetData( $tNMLVCUSTOMDRAW, "dwDrawStage" ) Switch $dwDrawStage ; Holds a value that specifies the drawing stage Case $CDDS_PREPAINT ; Before the paint cycle begins Return $CDRF_NOTIFYITEMDRAW ; Notify the parent window of any ITEM-related drawing operations Case $CDDS_ITEMPREPAINT ; Before painting an item Return $CDRF_NOTIFYSUBITEMDRAW ; Notify the parent window of any SUBITEM-related drawing operations Case BitOR( $CDDS_ITEMPREPAINT, $CDDS_SUBITEM ) ; Before painting a subitem Local $lItemlParam = $tNMLVCUSTOMDRAW.lItemlParam ; Item param Local $iSubItem = $tNMLVCUSTOMDRAW.iSubItem ; Subitem index Local $uItemState = $tNMLVCUSTOMDRAW.uItemState ; Item state If $lItemlParam Then ; Checked rows If Not BitAnd( $uItemState, $CDIS_FOCUS ) Then DllStructSetData( $tNMLVCUSTOMDRAW, "ClrText", 0xFFFFFF ) ; Forecolor white DllStructSetData( $tNMLVCUSTOMDRAW, "clrTextBk", 0xCC6600 ) ; Backcolor dark blue, BGR EndIf Else ; Other rows If Not BitAnd( $uItemState, $CDIS_FOCUS ) Then DllStructSetData( $tNMLVCUSTOMDRAW, "ClrText", 0x000000 ) DllStructSetData( $tNMLVCUSTOMDRAW, "ClrTextBk", 0xFFFFFF ) EndIf EndIf Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Checked state (and selection) in ItemParam.1 point
-
parsing VERY long csv file
JustSomeone reacted to mikell for a topic
Generic try ? #Include <Array.au3> $file = FileRead("1.csv") $res = StringRegExp($file, '.*?,"?([^",\r\n]*).*\R', 3) _ArrayDisplay($res)1 point -
parsing VERY long csv file
JustSomeone reacted to jchd for a topic
Does that fit your needs? #include <Array.au3> ; sample inline data. Local $sTest = _ '"Automated Reminder:blabla","SomeName <Some@email.com>","to@email.com",Date,*,' & @CRLF & _ '"Automated Reminder:blablabis","SomeOtherName <Somebody@gmail.com>","to@email.com",Date,*,' & @CRLF & _ '"Automated Reminder:blablater","<SomeoneElse@email.com>","to@email.com",Date,*,' & @CRLF ; use this for real runs ;~ Local $sTest = FileRead("yourCSVfile.csv") Local $aRes = StringRegExp($sTest, '(?m)^"[^"]*","([^"]*)"', 3) _ArrayDisplay($aRes)1 point -
1 point
-
Thanks for the cool update I really like this editor and I started to use it instead of Notepad Keep up the good work. Also seems everyone else has give you ideas If you do not mind I like to also add some. 1. Auto Indent text 2. Inset file this be cool in the edit menu 3. You got word count how about Line Count. 4. Goto options. 5. Options in edit menu to uppercase lowercase, invert case. 6. How about a tools menu, that can use something like INI files to be able to allow uses to add compilers to compile there code. Here an example of the INI say for a plug in like C# anyway I hope I give you some ideas.1 point
-
_Excel_RangeRead already returns @error = 5 and _Excel_RangeWrite returns @error = 4 when Excel sets an error raised by the Transpose method.1 point
-
; Cookies _FFCmd("Components.classes['@mozilla.org/cookiemanager;1'].getService(Components.interfaces.nsICookieManager).removeAll();") ; History _FFCmd("Components.classes['@mozilla.org/browser/nav-history-service;1'].getService(Components.interfaces.nsIBrowserHistory).removeAllPages();") ; Cache _FFCmd("Ci=Components.interfaces;Components.classes['@mozilla.org/network/cache-service;1'].getService(Ci.nsICacheService).evictEntries(Ci.nsICache.STORE_ANYWHERE);") Look also at: https://developer.mozilla.org/en/nsICookieManager https://developer.mozilla.org/en/nsIBrowserHistory https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsICacheService1 point