Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/21/2013 in all areas

  1. Shanheavel Assign(StringToBinary("VAL"),-45.961) Assign(StringToBinary("val"), 34) Assign(StringToBinary("VaL"),1) $sStr = "VAL: " & Eval(StringToBinary("VAL")) & @CRLF $sStr &= "val: " & Eval(StringToBinary("val")) & @CRLF $sStr &= "VaL: " & Eval(StringToBinary("VaL")) MsgBox(32,"Variable",$sStr)
    1 point
  2. Glad to be of help. And very glad I didn't have to work out how to reproduce the buggy behavior! Updated exe downloaded.
    1 point
  3. When I attempted to delete individual duplicate files, SMF deleted my entire Pictures folder. Luckily, it was simply moved to the Recycling folder, so I was able to restore it. But needless to say, I'm going to stop using SMF until you figure out what's wrong.
    1 point
  4. guinness

    check array dimension

    Oli4, Did you check my update? All you have to do is what water suggested and update the code I've just updated for you.
    1 point
  5. oli4

    check array dimension

    Ty !! This is really helpfull. this fixed my problem : if (UBound($aAr[autoit][/autoit]ray,1) > 1) Then GUICtrlSetData ($lIP,$aArray[1][1])
    1 point
  6. czardas

    check array dimension

    Use the advanced parameter of Ubound to get the other dimensions. Local $aTest[2][3] MsgBox(0, "Second Dimension Contains", UBound($aTest, 2) & " rows")
    1 point
  7. DiscGolferPro, Just for completeness here is the modified function I used: Func _CreateBorderLabel($sText, $iX, $iY, $iW, $iH, $iColor, $iPenSize = 1, $iStyle = -1, $iStyleEx = 0, $iType = 0) Switch $iType Case 0 $internalLabelID1 = GUICtrlCreateLabel("", $iX - $iPenSize, $iY - $iPenSize, $iW + 2 * $iPenSize, $iH + 2 * $iPenSize, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, $iColor) $internalLabelID2 = GUICtrlCreateLabel($sText, $iX, $iY, $iW, $iH, BitOR($SS_CENTER, $SS_CENTERIMAGE), $iStyleEx) GUICtrlSetBkColor(-1, $COLOR_WHITE) Case 1 $internalLabelID2 = GUICtrlCreateLabel($sText, $iX, $iY, $iW, $iH, BitOR($SS_CENTER, $SS_CENTERIMAGE), $iStyleEx) GUICtrlSetBkColor(-1, $iColor) EndSwitch Return $internalLabelID2 EndFunc ;==>_CreateBorderLabelAnd I amended the calls in _InitializeIntervalGrid as follows: _CreateBorderLabel($gridCellsContent[$r - 1][$c - 1], _ (($c - 1) * ($cellWidth + $cellLeftOffset)) + $cellLeftOffset - 2, _ (($r - 1) * ($cellHeight + $cellTopOffset)) + $cellTopOffset - 2, _ $cellWidth + 4, $cellHeight + 4, $COLOR_MEDGRAY, 1, BitOR($SS_CENTER, $SS_CENTERIMAGE), 0, 1) ; <<<<<<< $countGridLabels += 2 _CreateBorderLabel($gridCellsContent[$r - 1][$c - 1], _ (($c - 1) * ($cellWidth + $cellLeftOffset)) + $cellLeftOffset, _ (($r - 1) * ($cellHeight + $cellTopOffset)) + $cellTopOffset, _ $cellWidth, $cellHeight, $penColor, $penWeight, BitOR($SS_CENTER, $SS_CENTERIMAGE), 0, 1) ; <<<<<<< $countGridLabels += 2This way I only create 5223 controls and the whole grid appears. M23
    1 point
  8. @DiscGolferPro Since you're not listening for an event with the labels (as I've seen in your snippet), I suggest you to draw them with the GDI+ library. It should be faster and take less CPU. Br, FireFox.
    1 point
  9. DiscGolferPro, I agree with your diagniosis - the maximum number of controls I can create is 9999. This means you can have 49 columns (9827 ControlIDs) but not 50 (10023 required and only 9999 created). I must say I have never seen a script with so many controls - you may well be the first ever to bump into this apparently undocumented limit! As there seems no short-term fix to AutoIt itself that will solve your problem, it looks as if reducing the number of controls is your only recourse. You add 2400 labels to the total by creating 2 labels for each datapoint - for the "border" and the "data". Playing with your _CreateBorderLabel function to set the "data" label background colour to the "border" colour and not creating an additional "border" label allows the script to run with 50 columns - although it does mess up some of the other labels. I will keep playing with the script during the day as time allows to see if I can come up with any other solutions. M23
    1 point
  10. These kind of functions were added to AutoIt while I was developer (and more). The concept is there and implementation only needs few tweaks. They are beautiful features that you probably wouldn't ever see as part of AutoIt because that's what happens when language developer doesn't use the language he's developing.
    1 point
  11. Pass as a parameter a handle to the parent window GUICreate($LngAbout, 220, 330, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU, $WS_POPUP), -1, $hGui) http://pastebin.com/fWcPjjfP
    1 point
  12. _MouseTrap() But I don't think this is the right way!
    1 point
  13. Use WinSetState("WindowTitleHere", "", @SW_DISABLE), then the GUI is disabled and even if they do click on it, it won't do anything. Or you could just use GUISetState(@SW_HIDE, $GUIHandle) to hide the window until you're done with the options window.
    1 point
  14. Thank goodness for SciTE Jump recognising regions.
    1 point
  15. I made a quick example #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $hGUI, $hStatus Global $aParts[3] = [75, 150, -1] $hGUI = GUICreate("StatusBar Set BkColor", 400, 300) GUIRegisterMsg($WM_DRAWITEM, "_WM_DRAWITEM") $hStatus = _GUICtrlStatusBar_Create($hGUI) GUISetState() ;~ _GUICtrlStatusBar_SetBkColor($hStatus, 0x5555DD) _GUICtrlStatusBar_SetParts($hStatus, $aParts) _GUICtrlStatusBar_SetText($hStatus, "Part 1", 0, $SBT_OWNERDRAW) _GUICtrlStatusBar_SetText($hStatus, "Part 2", 1, $SBT_OWNERDRAW) _GUICtrlStatusBar_SetText($hStatus, "Part 3", 2, $SBT_OWNERDRAW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Func _WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam) #forceref $Msg, $wParam, $lParam Local $tDRAWITEMSTRUCT = DllStructCreate("uint CtlType;uint CtlID;uint itemID;uint itemAction;uint itemState;HWND hwndItem;HANDLE hDC;long rcItem[4];ULONG_PTR itemData", $lParam) Local $itemID = DllStructGetData($tDRAWITEMSTRUCT, "itemID") ;part number Local $hDC = DllStructGetData($tDRAWITEMSTRUCT, "hDC") Local $tRect = DllStructCreate("long left;long top;long right; long bottom", DllStructGetPtr($tDRAWITEMSTRUCT, "rcItem")) Local $iTop = DllStructGetData($tRect, "top") Local $iLeft = DllStructGetData($tRect, "left") Local $hBrush Switch $itemID Case 0 $hBrush = _WinAPI_CreateSolidBrush(0xFFFF00) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrush) _WinAPI_SetBkMode($hDC, $TRANSPARENT) DllStructSetData($tRect, "top", $iTop + 1) DllStructSetData($tRect, "left", $iLeft + 1) _WinAPI_DrawText($hDC, "Part 1", $tRect, $DT_LEFT) _WinAPI_DeleteObject($hBrush) Case 1 $hBrush = _WinAPI_CreateSolidBrush(0x00FF00) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrush) _WinAPI_SetBkMode($hDC, $TRANSPARENT) DllStructSetData($tRect, "top", $iTop + 1) DllStructSetData($tRect, "left", $iLeft + 1) _WinAPI_DrawText($hDC, "Part 2", $tRect, $DT_LEFT) _WinAPI_DeleteObject($hBrush) Case 2 $hBrush = _WinAPI_CreateSolidBrush(0xABCDEF) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrush) _WinAPI_SetBkMode($hDC, $TRANSPARENT) DllStructSetData($tRect, "top", $iTop + 1) DllStructSetData($tRect, "left", $iLeft + 1) _WinAPI_DrawText($hDC, "Part 3", $tRect, $DT_LEFT) _WinAPI_DeleteObject($hBrush) EndSwitch $tDRAWITEMSTRUCT = 0 Return $GUI_RUNDEFMSG EndFunc ;==>_WM_DRAWITEM
    1 point
  16. czardas

    Snippet Dump

    Loch Ness Monster Case and Camel Case Some sightings of Loch Ness Monster Case have been reported in the wild, although none have been substantiated. Also note that Camel Case isn't normally found outside its native enviroment. ^^ #include-once #include <Array.au3> MsgBox(0, LochNessMonsterCase("message from nessie"), LochNessMonsterCase("hello from the loch ness monster!")) Func LochNessMonsterCase($sText) If StringRegExp($sText, "(?i)[[:alpha:]]") = 0 Then Return SetError(1, 0, $sText) ; Contains no alpha characters. Local $aWords = StringRegExp($sText, "(?i)[[:alpha:]']+", 3) $aWords = _ArrayUnique($aWords) _ArraySortByLen($aWords, 0, 1) Local $iLen, $iMidPoint, $sCurrChar, $sTempStr, $iApostrophe For $i = 1 To $aWords[0] $iApostrophe = StringInStr($aWords[$i], "'") If $iApostrophe Then $aWords[$i] = StringReplace($aWords[$i], "'", "", 1) $iLen = StringLen($aWords[$i]) $iMidPoint = Ceiling($iLen/2) If Mod($iLen , 2) = 0 Then $iMidPoint += 1 $sTempStr = "" For $j = 1 To $iLen $sCurrChar = StringMid($aWords[$i], $j, 1) If $j = $iMidPoint Or $j = $iMidPoint -1 Then $sCurrChar = StringUpper($sCurrChar) Else $sCurrChar = StringLower($sCurrChar) EndIf $sTempStr &= $sCurrChar Next If $iApostrophe Then $sTempStr = StringLeft($sTempStr, $iApostrophe -1) & "'" & StringRight($sTempStr, $iLen -$iApostrophe +1) $sText = StringReplace($sText, $sTempStr, $sTempStr) Next Return $sText EndFunc ;==> LochNessMonsterCase Func _ArraySortByLen(ByRef $aArray, $iDescending =0, $iStart =0, $iEnd =0) If Not IsArray($aArray) Or UBound($aArray, 0) > 1 Then Return SetError(1, 0, 0) ; Not a 1D array If Not IsInt($iStart) Or Not IsInt($iEnd) Then Return SetError(5, 0, 0) ; Parameters need to be integers. Local $iBound = UBound($aArray) Local $aElementLen[$iBound][2] $iBound -=1 For $i = 0 To $iBound $aElementLen[$i][0] = StringLen($aArray[$i]) ; Get the length of the element $aElementLen[$i][1] = $aArray[$i] ; The element to sort Next _ArraySort($aElementLen, $iDescending, $iStart, $iEnd) If @error Then Return SetError(@error, 0, 0) ; See _ArraySort() for error codes 2 to 4. For $i = 0 To $iBound $aArray[$i] = $aElementLen[$i][1] Next Return 1 EndFunc ;==> _ArraySortByLen MsgBox(0, "Camel Case", CamelCase(" _ testing _ camel _ case" & @TAB & " ThIs caMeL hAs 3 hUMPS ")) Func CamelCase($sText, $CapsNext = 1, $bRecursion = False) If StringLen($sText) = 0 Then Return SetError(1) If Not $bRecursion Then $sText = StringLower($sText) Local $sNewStr = "", $sCurrChar For $i = 1 To StringLen($sText) $sCurrChar = StringMid($sText, $i, 1) If StringRegExp($sCurrChar, "\w") Then If Not $bRecursion Then If StringIsAlpha($sCurrChar) Then If $CapsNext Then $sCurrChar = StringUpper($sCurrChar) $CapsNext = 0 EndIf Else $CapsNext = 1 EndIf Else If StringIsAlpha($sCurrChar) And Not $CapsNext Then $sCurrChar = StringLower($sCurrChar) $CapsNext = 1 EndIf EndIf ElseIf $bRecursion Then $CapsNext = 0 Else $CapsNext = 1 EndIf $sNewStr &= $sCurrChar Next If Not $bRecursion Then While StringRegExp($sNewStr, "(\w)( +)(\w)") $sNewStr = StringRegExpReplace($sNewStr, "(\w)( +)(\w)", "\1\3") WEnd $sNewStr = CamelCase($sNewStr, 0, True) EndIf Return $sNewStr EndFunc ;==> CamelCase
    1 point
  17. All problems solved now?
    1 point
×
×
  • Create New...