Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/23/2013 in all areas

  1. WinHttp.au3: #include-once Global Const $HTTP_STATUS_OK = 200 Func HttpPost($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("POST", $sURL, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send($sData) If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc Func HttpGet($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("GET", $sURL & "?" & $sData, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.Send() If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc Example 1: #include "WinHttp.au3" Global $MD5 = HttpPost("http://www.afk-manager.ir/test/post.php", "password=WeWantThisAsMd5") MsgBox(64, "MD5", $MD5) Example 2: #include "WinHttp.au3" Global $sGet = HttpGet("http://www.google.com/") FileWrite("Google.txt", $sGet) Speed compare: [WinHttp.WinHttpRequest.5.1 GET] 1 = 422.961162765649 2 = 455.738280639636 3 = 441.821516504421 4 = 390.538648365335 Total = 1711.059608275041 Average = 427.7649020687603 [WinHttp.WinHttpRequest.5.1 POST] 1 = 826.436200956633 2 = 872.366642546045 3 = 871.266802895081 4 = 875.792832686324 Total = 3445.862479084083 Average = 861.4656197710208 [HTTP UDF GET] 1 = 984.282912132673 2 = 813.896511915435 3 = 781.158836566862 4 = 791.901235916364 Total = 3371.239496531334 Average = 842.8098741328335 [HTTP UDF POST] 1 = 788.734835486743 2 = 975.688234142967 3 = 785.810779035388 4 = 847.537193542955 Total = 3397.771042208053 Average = 849.4427605520133 [InetRead GET] 1 = 672.120733570292 2 = 595.221462195098 3 = 561.122261209642 4 = 738.180516302658 Total = 2566.64497327769 Average = 641.6612433194225 Tests result: Server 2003 32bit OK Server 2003 64bit Not Tested Server 2008 32bit Not Tested Server 2008 64bit OK XP 32bit OK XP 64bit Not Tested Vista 32bit Not Tested Vista 64bit Not Tested 7 32bit OK 7 64bit OK 8 32bit OK 8 64bit OK Are you interested? Check this out: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384106(v=vs.85).aspx
    1 point
  2. mesale0077 asked me whether I could code some CSS loading animations from different web sites. These are the results using GDI+ (AutoIt v3.3.12.0+ required!): _GDIPlus_MonochromaticBlinker.au3 / _GDIPlus_RotatingBokeh.au3 _GDIPlus_SpinningCandy.au3 / _GDIPlus_SteamPunkLoading.au3 _GDIPlus_IncreasingBalls.au3 / _GDIPlus_PacmanProgressbar.au3 _GDIPlus_StripProgressbar.au3 / _GDIPlus_RingProgressbar.au3 _GDIPlus_LineProgressbar.au3 / _GDIPlus_SimpleLoadingAnim.au3 _GDIPlus_TextFillingWithWater.au3 / _GDIPlus_MultiColorLoader.au3 _GDIPlus_LoadingSpinner.au3 / _GDIPlus_SpinningAndPulsing.au3 _GDIPlus_TogglingSphere.au3 / _GDIPlus_CloudySpiral.au3 _GDIPlus_GlowingText.au3 (thanks to Eukalyptus) / _GDIPlus_HypnoticLoader.au3 _GDIPlus_RotatingRectangles.au3 / _GDIPlus_TRONSpinner.au3 _GDIPlus_RotatingBars.au3 / _GDIPlus_AnotherText.au3 (thanks to Eukalyptus) _GDIPlus_CogWheels.au3 (thanks to Eukalyptus) / _GDIPlus_DrawingText.au3 (thanks to Eukalyptus) _GDIPlus_GearsAnim.au3 / _GDIPlus_LEDAnim.au3 _GDIPlus_LoadingTextAnim.au3 / _GDIPlus_MovingRectangles.au3 _GDIPlus_SpinningAndGlowing.au3 (thanks to Eukalyptus) / _GDIPlus_YetAnotherLoadingAnim.au3 _GDIPlus_AnimatedTypeLoader.au3 / _GDIPlus_Carousel.au3 Each animation function has a built-in example how it can be used. AiO download: GDI+ Animated Wait Loading Screens.7z (previous downloads: 1757) Big thanks to Eukalyptus for providing several examples. Maybe useful for some of you Br, UEZ PS: I don't understand CSS - everything is made out of my mind, so it might be different from original CSS examples
    1 point
  3. Hi! Today I want to show you my current AutoIt project: The ISN AutoIt Studio. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system, trophies and a lot more features!! Here are some screenshots: Here some higlights: -> easy to create/manage/public your AutoIt-projects! ->integrated GUI-Editor (ISN Form Studio 2) ->integrated - file & projectmanager ->auto backupfunction for your Projects ->extendable with plugins! ->available in several languages ->trophies ->Syntax highlighting /Autocomplete / Intelisense ->Dynamic Script ->detailed overview of the project (total working hours, total size...) And much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: http://autoit.de/index.php?page=Thread&threadID=29742&pageNo=1 For more information visit my Homepage: https://www.isnetwork.at So….have fun with ISN AutoIt Studio! PS: Sorry for my bad English! ^^
    1 point
  4. Since IE9, Microsoft use new JScript engine which powering HTML5 content - JScript9 aka Chakra that is ECMA-262 5th edition compliant and also JIT-ed! Alas, they decide that the powerfull engine to be unreachable through ScriptControl. Though some hacks can re-enable this engine, there's more elegant way - The amazing AutoItObject to the rescue! #include "AutoItObject.au3" _AutoItObject_Startup() $sCLSID_ScriptEngine = "{16D51579-A30B-4C8B-A276-0FF4DC41E755}" ; JScript9 'Chakra' CLSID ; $sCLSID_ScriptEngine = "{F414C260-6AC0-11CF-B6D1-00AA00BBBB58}" ; Old JScript CLSID Global $engine_path ; ; You may specify the DLL path to make it run in portable way! $engine_path = @ScriptDir & "\JScript9.DLL" ; $engine_path = @ScriptDir & "\JScript.DLL" ; Old JScript ; Initialization Script, for other script engine like VBScript or LuaScript the init script would be different. $sInitScript = "AutoIt.SetRootObject(this);function Hello(){AutoIt.MsgBox(0, 'Script Says:', 'Hello World!'); return 'You are running ' + ScriptEngine() + ' ' + [ScriptEngineMajorVersion(), ScriptEngineMinorVersion(), ScriptEngineBuildVersion()].join('.')}" Func GoNuts ( ) ; Execute script's function and fetch return value MsgBox(0, "Script Return Value:", $_Script.Hello()) ; Add new function $_Script.eval("function add(x, y){return x+y}") MsgBox(0, "Script function call", "Awesome," & @CRLF & @CRLF & "1 + 2 = " & $_Script.add(1, 2) & " !") ; etc ... Have Fun! EndFunc #Region >>> ActiveScript Constants Global Const _ ; IActiveScript $sIID_IActiveScript = "{BB1A2AE1-A4F9-11CF-8F20-00805F2CD064}", _ $tagIActiveScript = "QueryInterface hresult(ptr;ptr*);" & _ "AddRef ulong();" & _ "Release ulong();" & _ "SetScriptSite hresult(ptr);" & _ "GetScriptSite hresult(ptr;ptr*);" & _ "SetScriptState hresult(dword);" & _ "GetScriptState hresult(dword*);" & _ "Close hresult();" & _ "AddNamedItem hresult(wstr;dword);" & _ "AddTypeLib hresult(ptr;dword;dword;dword);" & _ "GetScriptDispatch hresult(wstr;ptr);" & _ "GetCurrentScriptThreadID hresult(dword*);" & _ "GetScriptThreadID hresult(dword;dword*);" & _ "GetScriptThreadState hresult(dword;dword*);" & _ "InterruptScriptThread hresult(dword;ptr;dword);" & _ "Clone hresult(int);" ; Credits to trancexx If @AutoItX64 Then ; IActiveScriptParse Global Const $sIID_IActiveScriptParse = "{C7EF7658-E1EE-480E-97EA-D52CB4D76D17}" Else ; 32 bit Global Const $sIID_IActiveScriptParse = "{BB1A2AE2-A4F9-11CF-8F20-00805F2CD064}" EndIf Global Const _ $tIID_IActiveScriptParse = _AutoItObject_CLSIDFromString($sIID_IActiveScriptParse), _ $tagActiveScriptParse = "QueryInterface hresult(ptr;ptr*);" & _ "AddRef ulong();" & _ "Release ulong();" & _ "InitNew long();" & _ "AddScriptlet long(wstr;wstr;wstr;wstr;wstr;wstr;dword*;ulong;dword;ptr;ptr);" & _ "ParseScriptText long(wstr;ptr;ptr;ptr;dword*;ulong;dword;ptr;ptr);" ; NOTE: ; The ptr in ParseScriptText (pstrItemName, pstrDelimiter) is used ; instead of wstr because there's no other way to pass NULL parameter. ; Change it back to wstr if you ever need to pass string. Global Const _ ; IActiveScriptSite $sIID_IActiveScriptSite = "{DB01A1E3-A42B-11CF-8F20-00805F2CD064}", _ $tagActiveScriptSite = "QueryInterface hresult(ptr;ptr*);" & _ "AddRef ulong();" & _ "Release ulong();" & _ "GetLCID hresult(dword*);" & _ "GetItemInfo hresult(wstr;dword;ptr;ptr);" & _ "GetDocVersionString hresult(ptr);" & _ "OnScriptTerminate hresult(ptr;ptr);" & _ "OnStateChange hresult(uint);" & _ "OnScriptError hresult(ptr);" & _ "OnEnterScript hresult();" & _ "OnLeaveScript hresult();" Global Const _ ; IActiveScriptError $sIID_IActiveScriptError = "{EAE1BA61-A4ED-11CF-8F20-00805F2CD064}", _ $tagActiveScriptError = "QueryInterface hresult(ptr;ptr*);" & _ "AddRef ulong();" & _ "Release ulong();" & _ "GetExceptionInfo hresult(ptr);" & _ "GetSourcePosition hresult(ptr;ptr;ptr);" & _ "GetSourceLineText hresult(ptr);", _ $tagEXCEPINFO = "word wCode;" & _ "word wReserved;" & _ "ptr bstrSource;" & _ "ptr bstrDescription;" & _ "ptr bstrHelpFile;" & _ "dword dwHelpContext;" & _ "ptr pvReserved;" & _ "ptr pfnDeferredFillIn;" & _ "long scode;" Enum _ ; SCRIPTSTATE $SCRIPTSTATE_UNINITIALIZED, _ $SCRIPTSTATE_STARTED, _ $SCRIPTSTATE_CONNECTED, _ $SCRIPTSTATE_DISCONNECTED, _ $SCRIPTSTATE_CLOSED, _ $SCRIPTSTATE_INITIALIZED Global Const _ ; SCRIPTITEM $SCRIPTITEM_ISVISIBLE = 0x00000002, _ $SCRIPTITEM_ISSOURCE = 0x00000004, _ $SCRIPTITEM_GLOBALMEMBERS = 0x00000008, _ $SCRIPTITEM_ISPERSISTENT = 0x00000040, _ $SCRIPTITEM_CODEONLY = 0x00000200, _ $SCRIPTITEM_NOCODE = 0x00000400, _ $SCRIPTITEM_ALL = BitOR( $SCRIPTITEM_ISSOURCE, $SCRIPTITEM_ISVISIBLE, $SCRIPTITEM_ISPERSISTENT, $SCRIPTITEM_GLOBALMEMBERS, $SCRIPTITEM_NOCODE, $SCRIPTITEM_CODEONLY ) #EndRegion <<< ActiveScript Constants #Region >>> Scriptable Object Global $_AutoIt = _AutoItObject_Create() Global $pAutoIt = _AutoItObject_IDispatchToPtr($_AutoIt) ; see GetItemInfo handler Global $_Script ; will hold ScriptEngine's root object, where we can access script's global function _AutoItObject_AddMethod($_AutoIt, "SetRootObject", "_AutoIt_SetRootObject") _AutoItObject_AddMethod($_AutoIt, "MsgBox", "_AutoIt_MsgBox") Func _AutoIt_SetRootObject ( $_Self, $_Root ) Dim $_Script = $_Root ; the legit way is through IDispatchEx, but oh well EndFunc ;==> _AutoIt_SetRootObject Func _AutoIt_MsgBox ( $_Self, $iFlags, $sTitle, $sMessage ) Return MsgBox($iFlags, $sTitle, $sMessage) EndFunc ;==> _AutoIt_MsgBox #EndRegion <<< Scriptable Object ; Look in registry if file not found If NOT FileExists($engine_path) Then $engine_path = RegRead("HKCR\CLSID\" & $sCLSID_ScriptEngine & "\InprocServer32", "") If NOT FileExists($engine_path) Then Exit 1 ; Engine's DLL not found EndIf ; Boilerplate Global $_ActiveScript = _AutoItObject_ObjCreateEx($engine_path, $sCLSID_ScriptEngine, $sIID_IActiveScript, $tagIActiveScript, False) If NOT IsObj($_ActiveScript) Then Exit 2 ; Could not instantiate engine, wrong CLSID ? _AutoItObject_IUnknownAddRef($_ActiveScript) $aCall = $_ActiveScript.QueryInterface(DllStructGetPtr($tIID_IActiveScriptParse), 0) Global $_ActiveScriptParse = _AutoItObject_WrapperCreate($aCall[2], $tagActiveScriptParse) If NOT IsObj($_ActiveScriptParse) Then Exit 3 ; Could not acquire ActiveScriptParse, check for 32/64 IID Global $_ActiveScriptSite = _AutoItObject_ObjectFromDtag("_ASS_", $tagActiveScriptSite) If @error Then Exit 4 ; Failed implementing ActiveScriptSite $_ActiveScript.SetScriptSite(Number($_ActiveScriptSite.__ptr__)) $_ActiveScript.AddNamedItem("AutoIt", BitOR($SCRIPTITEM_ISVISIBLE, $SCRIPTITEM_NOCODE)) Global $fScriptInitialized = 0 $_ActiveScriptParse.InitNew() $tActiveScriptParseError = DllStructCreate ($tagEXCEPINFO) $_ActiveScriptParse.ParseScriptText($sInitScript, 0, 0, 0, 0, 0, 0, 0, DllStructGetPtr($tActiveScriptParseError)) $_ActiveScript.SetScriptState($SCRIPTSTATE_CONNECTED) OnAutoItExitRegister("Cleanup") If NOT IsObj($_Script) Then Exit 5 ; Initialization script error GoNuts() Func Cleanup ( ) $_Script = 0 $_ActiveScript.Close() _AutoItObject_IUnknownRelease($_ActiveScript) $_ActiveScriptParse = 0 $_ActiveScript = 0 $_ActiveScriptSite = 0 EndFunc ;==> Cleanup #Region >>> ActiveScriptSite Implementation Func _ASS_QueryInterface ( $_Self, $pRIID, $pObj ) #forceref $_Self, $pRIID, $pObj _Trace("_ASS_QueryInterface") Return 0x80004002 ; E_NOINTERFACE EndFunc ;==> _ASS_QueryInterface Func _ASS_AddRef ( $_Self ) #forceref $_Self Return 1 EndFunc ;==> _ASS_AddRef Func _ASS_Release ( $_Self ) #forceref $_Self Return 1 EndFunc ;==> _ASS_Release Func _ASS_GetLCID ( $_Self, $iLCID ) #forceref $_Self $iLCID = 0x0400 ; LOCALE_USER_DEFAULT _Trace(StringFormat( '_ASS_GetLCID: 0x%X', $iLCID )) Return 0 ; S_OK EndFunc ;==> _ASS_GetLCID Func _ASS_GetItemInfo ( $_Self, $sName, $iMask, $pObj, $pTypeInfo ) #forceref $_Self, $pObj, $pTypeInfo Static Local _ $SCRIPTINFO_IUNKNOWN = 1, _ $SCRIPTINFO_ITYPEINFO = 2 _Trace(StringFormat( '_ASS_GetItemInfo: %s', $sName )) If $sName = "AutoIt" AND BitAND($iMask, $SCRIPTINFO_IUNKNOWN) Then _AutoItObject_IUnknownAddRef($pAutoIt) DllStructSetData(DllStructCreate("ptr", $pObj), 1, $pAutoIt) Return 0 ; S_OK EndIf If BitAND($iMask, $SCRIPTINFO_IUNKNOWN) Then DllStructSetData(DllStructCreate("ptr", $pObj), 1, 0) If BitAND($iMask, $SCRIPTINFO_ITYPEINFO) Then DllStructSetData(DllStructCreate("ptr", $pTypeInfo), 1, 0) Return 0x80004005 ; E_FAIL EndFunc ;==> _ASS_GetItemInfo Func _ASS_GetDocVersionString ( $_Self, $pbstrVersionString ) #forceref $_Self, $pbstrVersionString DllStructSetData(DllStructCreate("byte", $pbstrVersionString), 1, 0) _Trace(StringFormat( '_ASS_GetDocVersionString: %s', "OK" )) Return 0 ; S_OK EndFunc ;==> _ASS_GetDocVersionString Func _ASS_OnScriptTerminate ( $_Self, $pResult, $pExceptionInfo ) #forceref $_Self, $pResult, $pExceptionInfo _Trace(StringFormat( '_ASS_OnScriptTerminate: %s', "OK" )) Return 0 ; S_OK EndFunc ;==> _ASS_OnScriptTerminate Func _ASS_OnStateChange ( $_Self, $iState ) #forceref $_Self _Trace(StringFormat( '_ASS_OnStateChange: State = %d', $iState )) Return 0 ; S_OK EndFunc ;==> _ASS_OnStateChange Func _ASS_OnScriptError ( $_Self, $pActiveScriptError ) #forceref $_Self, $pActiveScriptError Static Local _ $tEXCEPINFO = DllStructCreate ($tagEXCEPINFO), _ $pEXCEPINFO = DllStructGetPtr($tEXCEPINFO) Local $_Error = _AutoItObject_WrapperCreate($pActiveScriptError, $tagActiveScriptError) _AutoItObject_IUnknownAddRef($pActiveScriptError) $aCall = $_Error.GetExceptionInfo($pEXCEPINFO) If NOT $aCall[0] Then MsgBox(16, __Au3Obj_SysReadString(DllStructGetData($tEXCEPINFO, "bstrSource")), StringFormat ( _ "Error 0x%X\r\n\r\n%s", _ DllStructGetData($tEXCEPINFO, "scode"), _ __Au3Obj_SysReadString(DllStructGetData($tEXCEPINFO, "bstrDescription")) _ )) $_Error = 0 Return 0 ; S_OK EndFunc ;==> _ASS_OnScriptError Func _ASS_OnEnterScript ( $_Self ) #forceref $_Self _Trace(StringFormat( '_ASS_OnEnterScript: %s', "OK" )) Return 0 ; S_OK EndFunc ;==> _ASS_OnEnterScript Func _ASS_OnLeaveScript ( $_Self ) #forceref $_Self _Trace(StringFormat( '_ASS_OnLeaveScript: %s', "OK" )) Return 0 ; S_OK EndFunc ;==> _ASS_OnLeaveScript #EndRegion <<< ActiveScriptSite Implementation Func _Trace ( $msg, $ln = @ScriptLineNumber ) ConsoleWrite( @ScriptName & "(" & $ln & "): " & $msg & @CRLF) EndFunc ;==> _Trace Minimum Requirements (JScript9): IE9 (for the JScript9.dll only, can be portable) Win7 (works in WinPE too), x64 still untested NOTE: Through IActiveScriptSite we can host not only JScript engine, but any other ActiveScripting engine like VBScript, LuaScript(JIT), ActivePerl etc. NOTE: If you don't know the DLL path ( Specifiying dll path is now optional ) Please uncomment the first method of specifiying the dll path, ; ; Either get DLL path from registry $engine_path = RegRead("HKCR\CLSID\" & $sCLSID_ScriptEngine & "\InprocServer32", "") ; ObjCreateInterface like ; ; Or bring along the DLL in portable way! ; $engine_path = @ScriptDir & "\JScript9.DLL" ; $engine_path = @ScriptDir & "\JScript.DLL" ; Old JScript Thanks to trancexx for mentioning this Update 23/09/13 Fixed ParseScriptText parameter, credits to trancexx Added x64 support, untested
    1 point
  5. Put the time into a variable and use that instead of trying to match times on both. Something like this. #include <ScreenCapture.au3> $sTime = @MDAY & "-" & @MON & "-" & @YEAR & " " & @HOUR & "." & @MIN & "," & @SEC _ScreenCapture_Capture( $sTime & ".jpg") FileWrite("new.html", '<br><img src="' & $sTime & '.jpg" width="304" height="228">')
    1 point
  6. Alexxander, The "/" and ":" characters are not permitted in filenames (neither are " * ? " < > |") - so choose some other delimiters. M23
    1 point
  7. 1 point
  8. Valuater

    if not - then

    here is the online reference to GUICtrlRead() http://www.autoitscript.com/autoit3/docs/functions/GUICtrlRead.htm Your code should be more like... if not GUICtrlRead($label1) = "FHF4H-HJJGM-MFPB4-XDXH2-4JFDY" Then 8)
    1 point
  9. Scripter1986, Not necessarily. You cannot ask the question in your second thread because we know exactly why you want to do it and the rules prohibit that specific requirement from being discussed here. Your asking it after having had the first thread locked is also a blatant infraction of the Forum rules. So you are 2 strikes down instantly. But the same question asked by someone else in the future would be perfectly legitimate. M23
    1 point
  10. MaGRauN, A RegEx will extract that easily: #include <Constants.au3> ; Get the line from the file $sLine = '![LOG[Client GUID = GUID:5B526601-B897-4A58-B27B-6509B7270417, Netbios name = HOSTAMEX, State = Known]LOG]!><time="11:08:05.679+180" date="09-18-2013" component="TSMBootstrap" context="" type="0" thread="1392" file="tspolicy.cpp:608">' ; And then extract the bit you want $aRet = StringRegExp($sLine, "(?i)Netbios name\s=\s(.*),", 3) ; And display it MsgBox($MB_SYSTEMMODAL, "Extracted Data", $aRet[0]) SRE decode: (?i} - Case insensitive Netbios name\s=\s - Look for this text (\s = space) (.*) - Capture everything until... , - ...the next comma 3 - This flag gives you an a array of all matches = even thought there should only be the one All clear? M23
    1 point
  11. Don't want to use Bitmaps, the only option left is Owner Drawn ListView then, I simplified it by using Webdings(font containing many symbols), you can do it with GDI+ even. I have even changed the color of the selection. Modify as you need Here is the example #include <WindowsConstants.au3> #include <GUIListView.au3> #include <GUIConstants.au3> #include <Misc.au3> Global Const $ODT_LISTVIEW = 102 Global Const $ODA_DRAWENTIRE = 0x1 Global Const $ODS_SELECTED = 0x0001 Global $GUI_main = GUICreate("Phoenix XL | 09.23.2013", 300, 300) Global $hGUI_tab_listview[2][10] Global $hNewFont = -1 GUIRegisterMsg($WM_MEASUREITEM, "WM_MEASUREITEM") ;place before listview creation - message sent once for each ownerdrawn control created GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") Global $iCheckboxItem = 1 ;first subitem is the checkitem Global $aCheckBoxStates[11] $hGUI_tab_listview[0][0] = GUICtrlCreateListView("", 15, 20, 250, 260, _ BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_OWNERDRAWFIXED)) ; + $LVS_EX_CHECKBOXES + $LVS_SINGLESEL Global $hListView = GUICtrlGetHandle(-1) _GUICtrlListView_AddColumn(-1, "Name") _GUICtrlListView_SetColumnWidth(-1, 0, 155) _GUICtrlListView_AddColumn(-1, "Count") _GUICtrlListView_SetColumnWidth(-1, 1, 72) For $i = 0 To 10 ; populate the listview for testing purposes _GUICtrlListView_AddItem(-1, "test " & $i) _GUICtrlListView_AddSubItem(-1, $i, $i, 1) Next GUISetState(@SW_SHOW) Do Sleep(10) Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hNewFont) For $i = 0 To 10 ConsoleWrite("Item: " & $i & @TAB & "CheckBox Toggled? " & _Iif($aCheckBoxStates[$i], "True", "False") & @CRLF) Next Func WM_MEASUREITEM($hWnd, $Msg, $wParam, $lParam) Local $tMEASUREITEMS = DllStructCreate("uint cType;uint cID;uint itmID;uint itmW;uint itmH;ulong_ptr itmData", $lParam) If DllStructGetData($tMEASUREITEMS, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG GUIRegisterMsg($WM_MEASUREITEM, "") ;call this after last ownerdrawn listview created Return 1 EndFunc ;==>WM_MEASUREITEM Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam) Local $tagDRAWITEMSTRUCT, $iBrushColor, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC, $bSelected $tagDRAWITEMSTRUCT = DllStructCreate( _ "uint cType;" & _ "uint cID;" & _ "uint itmID;" & _ "uint itmAction;" & _ "uint itmState;" & _ "hwnd hItm;" & _ "handle hDC;" & _ "long itmRect[4];" & _ "ulong_ptr itmData" _ , $lParam) If DllStructGetData($tagDRAWITEMSTRUCT, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG $cID = DllStructGetData($tagDRAWITEMSTRUCT, "cID") $itmID = DllStructGetData($tagDRAWITEMSTRUCT, "itmID") $itmAction = DllStructGetData($tagDRAWITEMSTRUCT, "itmAction") $itmState = DllStructGetData($tagDRAWITEMSTRUCT, "itmState") $hItm = DllStructGetData($tagDRAWITEMSTRUCT, "hItm") $hDC = DllStructGetData($tagDRAWITEMSTRUCT, "hDC") $bSelected = BitAND($itmState, $ODS_SELECTED) Switch $cID ; will look for ControlID, not window handle. Case $hGUI_tab_listview[0][0] Switch $itmAction Case $ODA_DRAWENTIRE ; don't forget, this is BGR, not RGB If $itmState = $bSelected Then ; item is not selected $iBrushColor = 0xFFFFFF Else ; item is selected $iBrushColor = 0xC0CDEF EndIf Local $aBrush = DllCall("gdi32.dll", "hwnd", "CreateSolidBrush", "int", $iBrushColor) Local $aBrushOld = _WinAPI_SelectObject($hDC, $aBrush[0]) Local $iLeft = DllStructGetData($tagDRAWITEMSTRUCT, "itmRect", 1) DllStructSetData($tagDRAWITEMSTRUCT, "itmRect", $iLeft + 1, 1) ; rectangle coordinates for coloring ; +1 is the left margin _WinAPI_FillRect($hDC, DllStructGetPtr($tagDRAWITEMSTRUCT, "itmRect"), $aBrush[0]) _WinAPI_SelectObject($hDC, $aBrushOld) _WinAPI_DeleteObject($aBrush[0]) ; for all columns of the row: Local $iIndent_Checkbox = 18, $iSubItmText, $aSubItmRect, $iSubItmRect, $hOldFont $local_alignment = $DT_LEFT For $i = 0 To _GUICtrlListView_GetColumnCount($hGUI_tab_listview[0][0]) - 1 ; 1. get subitem text: $iSubItmText = _GUICtrlListView_GetItemText($hGUI_tab_listview[0][0], $itmID, $i) ; 2. get subitem coordinates for drawing its respective text $aSubItmRect = _GUICtrlListView_GetSubItemRect($hGUI_tab_listview[0][0], $itmID, $i) ; the function above accepts not only subitems (one-based index), but also main item (index=0) ; 3. pass the coordinates to a DLL struct $iSubItmRect = DllStructCreate("long[4]") DllStructSetData($iSubItmRect, 1, $aSubItmRect[0] + 2, 1) ; +2 is left margin (X) If $i = $iCheckboxItem Then DllStructSetData($iSubItmRect, 1, $aSubItmRect[0] + 2 + $iIndent_Checkbox, 1) ;indentation for the checkbox DllStructSetData($iSubItmRect, 1, $aSubItmRect[1], 2) ; DllStructSetData($iSubItmRect, 1, $aSubItmRect[2], 3) DllStructSetData($iSubItmRect, 1, $aSubItmRect[3], 4) _WinAPI_DrawText($hDC, $iSubItmText, $iSubItmRect, $local_alignment) If $i = $iCheckboxItem Then ;subitem If $hNewFont = -1 Then Local $LOGFONT, $tFont, $pFont $hNewFont = _WinAPI_CreateFont(10, 10) ;create a temp font $hOldFont = _WinAPI_SelectObject($hDC, $hNewFont) ;get the current selected font $LOGFONT = _ 'LONG lfHeight;' & _ 'LONG lfWidth;' & _ 'LONG lfEscapement;' & _ 'LONG lfOrientation;' & _ 'LONG lfWeight;' & _ 'BYTE lfItalic;' & _ 'BYTE lfUnderline;' & _ 'BYTE lfStrikeOut;' & _ 'BYTE lfCharSet;' & _ 'BYTE lfOutPrecision;' & _ 'BYTE lfClipPrecision;' & _ 'BYTE lfQuality;' & _ 'BYTE lfPitchAndFamily;' & _ 'WCHAR lfFaceName [32];' $tFont = DllStructCreate($LOGFONT) $pFont = DllStructGetPtr($tFont) _WinAPI_GetObject($hOldFont, DllStructGetSize($tFont), $pFont) ;get the logfont of the selected font _WinAPI_DeleteObject($hNewFont) ;delete the temporary font DllStructSetData($tFont, "lfFaceName", "Wingdings") DllStructSetData($tFont, "lfHeight", DllStructGetData($tFont, "lfHeight") - 3) $hNewFont = _WinAPI_CreateFontIndirect($tFont) ;create the new font having the same properties as the old font had EndIf _WinAPI_SelectObject($hDC, $hNewFont) ;select the new font DllStructSetData($iSubItmRect, 1, $aSubItmRect[0] + 2, 1) ; +2 is left margin (X) DllStructSetData($iSubItmRect, 1, $aSubItmRect[1], 2) ; DllStructSetData($iSubItmRect, 1, $aSubItmRect[0] + 2 + $iIndent_Checkbox, 3) DllStructSetData($iSubItmRect, 1, $aSubItmRect[3], 4) ;check = 254, blank = 168 _WinAPI_DrawText($hDC, ChrW(_Iif($aCheckBoxStates[$itmID], 254, 168)), $iSubItmRect, $local_alignment) ;wingdings 168 character is an empty box _WinAPI_SelectObject($hDC, $hOldFont) EndIf Next EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_DRAWITEM Func WM_DESTROY($hWnd, $iMsg, $iwParam, $ilParam) ;for releasing the static objects from the memory. _SendMessage($hWnd, $WM_DRAWITEM, -1, -1) Return $GUI_RUNDEFMSG EndFunc ;==>WM_DESTROY Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $tNMHDR, $hWndFrom, $iCode, $aHitTest, $item $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CLICK $aHitTest = _GUICtrlListView_SubItemHitTest($hListView) If $aHitTest[0] >= 0 And $aHitTest[1] = $iCheckboxItem Then ; if checkbox item is clicked $aCheckBoxStates[$aHitTest[0]] = Not $aCheckBoxStates[$aHitTest[0]] _GUICtrlListView_RedrawItems($hListView, $aHitTest[0], $aHitTest[0]) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Keypoints of Basic Framework WM_DRAWITEM and WM_MEASUREITEM are used for custom drawing The Text is drawn with the default font. The Font is changed to Webdings and the respective symbol resembling a check box is drawn. WM_NOTIFY is used to detect user clicks on the items for toggling the states of the checkboxes. Let me know what you think about it Thumbs up if it helped Regards
    1 point
  12. As I said before - the worst kind of coder is the lazy one who refuses to show any effort. I'm out.
    1 point
  13. water

    Auto SSH and run command?

    If you search the forum for PuTTY or Plink (a command-line interface to the PuTTY back ends) you will find a lot of threads. I'm sure one of them has the solution for your problem
    1 point
  14. Hi, Welcome to the autoit forum Just a thought: Run putty (with the right opt_flags parameters) and send your commands using the StdinWrite function. Br, FireFox.
    1 point
  15. Doesn't matter if he/she knew it or not, that's the answer. Were you honestly expecting anyone to say anything else? Sorry to disappoint you. I would have loved to say "Jon is saving it for a kickass Christmas special AutoIt release, AutoIt version v3.3.13.37 which will also include varargs, closures, multi-line execute, runtime including, multithreading, and new linux and mac versions".
    1 point
  16. Update 3-17-2010 Here the latest of my FTP Explorer. Its probably going to be a while before I post anything else for this project. Even though this project has come a long way from when I started it, I don't like the direction its heading. I'm really starting to see what Valiks always taking about with global variables being bad and creating interfaces that handle different sections of the programs. Right now I have so many global vars, and anytime I want to change something it takes ten times more time updating the rest of the script then it did to write the actual change. Anyway, I got to do something because its becoming not fun anymore. And who wants to have a hobby thats not fun? Btw this is written to work with v3.3.6.0. Changes: - Added Up/Down Icons for queue list. (Thanks for idea Zedna) - Made Changes to Richedit Functions. Now more colorful. - Each listview and richedit are automatically given focus when mouse hovers them.(going to make it optional in future) - Created a main icon for script and back buttons. - Rewrote main FTPNavigation fuction. Major performance increase. - Added function that sets back button tooltip to the directory it will navigate to. FTP Explorer 3-17-10.zip Update 1-27-2010 Alright so here is the latest update for my FTP Explorer. If you would like to compile it use the scripts in the compile folder I made. Those scripts have been Obfuscated to remove a lot of unused functions. Makes a huge difference in file size. As always, please let me know if you have any kind of problems. Written to work with v3.3.4.0. Some of the new additions that I have been working on are: - ability to abort transfers - ability to maximize - New right-click menu for selecting columns views (Size, Modification Date, Creation Date..) - automatic Queue List restore. (also restores your navigation history) - estimated finish time for file transfers FTP Explorer 1-27-2010.zip Update 1-10-2010 Well I have done a lot of work to this since the last one. One of the biggest features is that it now uses a second process to handle the uploading and downloading (Thanks Yashied). The second process creates its own connection which allows you to continue navigating while you have tranfers going on. Some of the other things that I have been working on for it include right-click menus, RichEdit status box, status bar, history ini to keep track of previous connections and info, history combo boxes that you can type directory's in and navigate stright to. I Still have a some more ideas to implement but thought I would post what I got to see if I could get some feedback. Any opinions, ideas or problems, please don't be shy to drop me a line This is written to work with v3.3.2.0. FTP Explorer 1-10-10.zip Initial Release Here is another FTP Explorer program I have been working on. Its not quite finished but close. I still have a couple things to do but wanted to show. The new beta is needed to run this. Special thanks go to Prog@ndy for his Icon functions and _FTPEx udf. Please let me know about problems you experience, or recommendations. Thanks For Looking!! FTP_Explorer.au3
    1 point
×
×
  • Create New...