Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/17/2017 in all areas

  1. I don't think there's anything like $ESNUMBER For this, you could use a regexp to figure out if the input matches what you want then set the input to the correct format #include <GUIConstants.au3> #include <WinApi.au3> #include <Array.au3> Global $hMain = GUICreate("Example", 200, 40) Global $inpInput = GUICtrlCreateInput("", 10, 10, 180, 20) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUISetState(@SW_SHOW, $hMain) While (True) Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE Exit 0 EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $aRegExp Switch (_WinAPI_HiWord($wParam)) Case $EN_CHANGE Switch (_WinAPI_LoWord($wParam)) Case $inpInput $aRegExp = StringRegExp(GUICtrlRead($inpInput), "([a-zA-Z]{5})([0-9]{4})([a-zA-Z]{1})", 3) If (Not @error) Then GUICtrlSetData($inpInput, _ArrayToString($aRegExp, "-")) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND
    1 point
  2. pete_wilde, That is an old script - the $ghGDIPDll DLL name was renamed a long time ago to $__g_hGDIPDll. Change that and the error is no more. M23 P.S. When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags.
    1 point
  3. See comment "Only process the statusbar" #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #include <WinAPI.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) GUICtrlSetDefColor(0x000000) GUICtrlSetDefBkColor(0xFF0000) $hStatus = _GUICtrlStatusBar_Create($Form1) GUIRegisterMsg($WM_DRAWITEM, "_WM_DRAWITEM") _GUICtrlStatusBar_SetText($hStatus, "test", 0, $SBT_OWNERDRAW) Global $global_StatusBar_Text = "Part 1" $Button1 = GUICtrlCreateButton("Button1", 176, 136, 75, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ; $d = _FileListToArrayRec(@ScriptDir & "\ico", "*.ico", 0, 1, 0, 1) For $x = 1 To 100 ; ConsoleWrite($d[$x] & @CRLF) Sleep(20) $global_StatusBar_Text = $x _WinAPI_RedrawWindow($hStatus) ; _GUICtrlStatusBar_SetText($hStatus, $x & " " & $x, 0, $SBT_OWNERDRAW) Next EndSwitch WEnd 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) If DllStructGetData($tDRAWITEMSTRUCT, "hwndItem") <> $hStatus Then Return $GUI_RUNDEFMSG ; Only process the statusbar 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(0x0000FF) ; Backgound Color _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrush) _WinAPI_SetTextColor($hDC, 0x00FF00) ; Font Color _WinAPI_SetBkMode($hDC, $TRANSPARENT) DllStructSetData($tRect, "top", $iTop + 1) DllStructSetData($tRect, "left", $iLeft + 1) _WinAPI_DrawText($hDC, $global_StatusBar_Text, $tRect, $DT_LEFT) _WinAPI_DeleteObject($hBrush) EndSwitch $tDRAWITEMSTRUCT = 0 Return $GUI_RUNDEFMSG EndFunc ;==>_WM_DRAWITEM
    1 point
  4. JohnOne

    ipify

    It's basically another site for retrieving your public IP address. Why is any different than the standard UDF? You can get you IP in plain or json string, there is no limit to how often you can call it, and the provider assures the service is free, will not expire, and (this is the bit I like) "regardless of whether the server running the API dies, or if there's an enormous tornado which destroys half of the east coast, ipify will still be running" I named the function with the real provider of the service in mind, which is where the only credit belongs. https://www.ipify.org/ MsgBox(0, "IP String", _Ipify()) MsgBox(0, "IP JSON String", _Ipify(1)) Func _Ipify($JSON = 0) Local $sURI = "https://api.ipify.org" if $JSON Then $sURI &= "?format=json" Return BinaryToString(InetRead($sURI, 1)) EndFunc
    1 point
  5. guinness

    Detecting RDP Session

    Func IsRDP() ; Returns True or False Return Not (EnvGet('SESSIONNAME') == '') EndFunc Here is a snippet for you.
    1 point
  6. Mat

    Disable ComboBox editing

    Yes!! The editing is the default style, so to change it just set the style to: $CBS_DROPDOWNLIST (requires #include<ComboConstants.au3>), or 0x0003. #include<ComboConstants.au3> $hGUI = GUICreate ("Testing combo box") GUICtrlCreateCombo ("", 2, 2, 100, 20, $CBS_DROPDOWNLIST) GUICtrlSetData (-1, "Item 1|Item 2|Item 3", "Item 1") GUISetState () While GUIGetMsg () <> -3 WEnd Mat
    1 point
  7. sheeva

    Image Resize, How?

    Hi, I have see this code in different post but when i try it he make more a Crop than a resize. I explain, the Vertical and Horizontal new size are correct (300x400) but about 15% (maybe 20%) of original image is stripped out on bottom of newly genrerated pictures. no very difficult to verify on you example (bliss.jpg). So something is wrong i think because i suppose tha the main aim of your code is to conserve all pictures (even at a different size). I you have any solution for that it will be great. Sorry for my poor english
    1 point
×
×
  • Create New...