Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/27/2017 in all areas

  1. OK, the only way I can - currently - think of is this one #include <GUIConstantsEx.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> OnAutoItExitRegister('OnAutoItExit') ; Create GUI Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 500, 100) Global $input = GUICtrlCreateInput("", 10, 40, 480, 20) $hInput = GuiCtrlGetHandle($input) _WinAPI_DragAcceptFiles($hInput) ; Allow WM_DROPFILES to be received from lower privileged processes (Windows Vista or later) #cs If IsAdmin() Then _WinAPI_ChangeWindowMessageFilterEx($hInput, $WM_COPYGLOBALDATA, $MSGFLT_ALLOW) _WinAPI_ChangeWindowMessageFilterEx($hInput, $WM_DROPFILES, $MSGFLT_ALLOW) EndIf #ce ; Register input window proc Global $g_hDll = DllCallbackRegister('_WinProc', 'ptr', 'hwnd;uint;wparam;lparam') Global $g_pDll = DllCallbackGetPtr($g_hDll) Global $g_hProc = _WinAPI_SetWindowLong($hInput, $GWL_WNDPROC, $g_pDll) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _WinProc($hWnd, $iMsg, $wParam, $lParam) Switch $iMsg Case $WM_DROPFILES Local $aFileList = _WinAPI_DragQueryFileEx($wParam) If not @error Then Local $list For $i = 1 To $aFileList[0] $list &= $aFileList[$i] & ";" Next GuiCtrlSetData($input, StringTrimRight($list, 1)) _WinAPI_DragFinish($wParam) Return 0 EndIf EndSwitch Return _WinAPI_CallWindowProc($g_hProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WinProc Func OnAutoItExit() _WinAPI_SetWindowLong($hInput, $GWL_WNDPROC, $g_hProc) DllCallbackFree($g_hDll) EndFunc ;==>OnAutoItExit
    2 points
  2. Just comment that line out by using the ";" char.
    2 points
  3. WHAT : is .NET Common Language Runtime (CLR) Framework The Common Language Runtime (CLR) is a an Execution Environment . Common Language Runtime (CLR)'s main tasks are to convert the .NET Managed Code to native code, manage running code like a Virtual Machine, and also controls the interaction with the Operating System. As part of Microsoft's .NET Framework, the Common Language Runtime (CLR) is managing the execution of programs written in any of several supported languages. Allowing them to share common object-oriented classes written in any of the languages. HOW : To access the CLR environment you need to create an Appdomain Object - _CLR_GetDefaultDomain() An AppDomain provides an isolated region in which code runs inside of an existing process. Application domains provide an isolation boundary for security, reliability, and versioning, and for unloading assemblies. Application domains are typically created by runtime hosts, which are responsible for bootstrapping the common language runtime before an application is run. WHEN : Would you use CLR Runtime Hosts 1. To access .NET Class Libraries : System System.Collections System.Data System.Drawing System.IO System.Text System.Threading System.Timers System.Web System.Web.Services System.Windows.Forms System.Xml 2. Accessing custom build .Net Assemblies : Some Examples (but there are a ton out there) AutoItX3 - The .NET Assembly for using AutoItX JSonToXML libr. XMLRPC Libr. .NETPDF libr. .NETOCR Libr WInSCP Libr. ... 3. To Compile .Net Code into an Assembly 4. To Run C# or VB.net Code 5. To Mix AU3 and .Net functionality in your Application WHERE : To find documentation about CLR First of all you can find a lot on MSDN and here : Post 4 & Post 6 EXAMPLES : Multiple examples included in Zip !! Example : “System.Text.UTF8Encoding” Example : “System.IO.FileInfo” Example : “System.Windows.Forms” Example : AutoItX3 Custom .NET Assembly AutoItX Example : Compile Code C# and Code VB Example : Compile Code C# at Runtime WHO : Created the CLR.au3 UDF All credits go to : Danyfirex / Larsj / Trancexx / Junkew TO DO : The library is still Work in Process … (Some of the GUI Controls are not yet working as expected...) Anyone is free to participate in contributing to get the bugs resolved and to expand the CLR.au3 functionality ... Enjoy !! DOWNLOADS : (Last updated) - added CLR Constants.au3 - Danyfirex - Global Constants added (Magic numbers) - added .NET CLR CreateObject vs ObjCreate Example.au3 - Junkew • 2 approaches give the same result (only valid for COM Visible Assembly) • Includes a function that shows you which Assembly Classes are COM Visible - added .Net Conventional COM Objects Examples - ptrex - added .NET CLR CreateComInstanceFrom Example - Danyfirex - You can use it for Regfree COM Assembly Access - System.Activator has 4 methods : • CreateComInstanceFrom : Used to create instances of COM objects. • CreateInstanceFrom : Used to create a reference to an object from a particular assembly and type name. • GetObject : Used when marshaling objects. • CreateInstance : Used to create local or remote instances of an object. - added .NET Access SafeArrays Using AccVarsUtilities Example - LarsJ - added SafeArray Utilities functions in Includes - LarsJ - added .NET Access Native MSCorLib Classes - System - ptrex Multiple System Class Examples : • System.Random • System.DateTime • System.Diagnostics.PerformanceCounter • System.IO.FileInfo • System.Int32 • System.Double • System.Speech • System.Web - added Third Party Assembly Access - ptrex • WinSCP : https://winscp.net/eng/download.php • IonicZip : http://dotnetzip.codeplex.com/ - added more Examples using PowerShell GUI Assembly Access - ptrex • GUI Ribbon .NET Assembly using &nbsp;CLR Library • GUI Report Designer .NET Assembly using &nbsp;CLR Library • GUI SSRS Reporting .NET Assembly using &nbsp;CLR Library CLRv3a.zip .NET CLR Framework for AutoIT.pdf
    1 point
  4. Can anyone tell me why this isn't working?.. #include <array.au3> $regexp = StringRegExp("test 'a b c'", "'([^']|'')*'|\S+", 3) _ArrayDisplay($regexp) trying to split this "test 'a b c' 'some other '' test'' ...'" into: 0: test 1: 'a b c' 2: ... but it gives me: 0: test 1: c
    1 point
  5. JLogan3o13

    Issue with variable

    How about providing your whole code, rather than just a couple lines, or at least a reproducer, so we can see (and replicate) what you're doing?
    1 point
  6. Stick to one topic, please. Spamming the site with multiple threads will not get your question answered more quickly; it often has the opposite effect.
    1 point
  7. CarlD

    Roman (Again)

    I recently wrote some quick and dirty decimal-to-Roman, Roman-to-decimal functions, then decided to check this forum and found this thread. For what it's worth, here's my code. It's compact, with minimal checking for bad input. Enjoy. ; ROMANUM.AU3 ; Convert Arabic to Roman, Roman to Arabic numerals ; CLD -- XXVI IULIUS MMXVII If $CmdLine[0] Then $vArg = $CmdLine[1] $sFunc = "Roman" If StringinStr("MDCLXVI", StringLeft($vArg, 1)) Then $sFunc = "Arabic" $vOut = Call($sFunc, $vArg) If Not $vOut Then $vOut = "No output" Exit MsgBox(0, @ScriptName, $vOut) Else Exit MsgBox(64, @ScriptName, "Usage:" & @CRLF & @ScriptName & " decimal|roman_in") EndIf Func Arabic($sRom) ; Roman numerals to Arabic $aNum = StringSplit("CM,CD,XC,XL,IX,IV,M,D,C,L,X,V,I", ",") $aVal = StringSplit("900,400,90,40,9,4,1000,500,100,50,10,5,1", ",") $vOut = 0 For $i = 1 To $aVal[0] If StringInStr($sRom, $aNum[$i]) Then $sRom = StringReplace($sRom, $aNum[$i], "") $vOut += @extended * $aVal[$i] EndIf Next If $sRom Then Return SetError(1, 0, "Bad input") Else Return $vOut EndIf EndFunc ;==>Arabic ;---------- Func Roman($iIn) ; Arabic to Roman numerals $sOut = "" $aNum = StringSplit("M,CM,D,CD,C,XC,L,XL,X,IX,V,IV,I", ",") $aVal = StringSplit("1000,900,500,400,100,90,50,40,10,9,5,4,1", ",") For $i = 1 To $aVal[0] While $iIn >= Int($aVal[$i]) $sOut &= $aNum[$i] $iIn -= $aVal[$i] WEnd Next Return $sOut EndFunc ;==>Roman
    1 point
  8. That part is trivial: Local $aSequence = [0, 32, 15, 19, 4, 21, 2, 25, 17, 34, 6, 27, 13, 36, 11, 30, 8, 23, 10, 5, 24, 16, 33, 1, 20, 14, 31, 9, 22, 18, 29, 7, 28, 12, 35, 3, 26] Local $aSamples = [34, 17, 5, 2, 30, 14, 0, 9] Local $iIndex1, $iIndex2, $iDistance For $i = 0 To (Floor(UBound($aSamples) / 2) * 2) - 1 Step 2 ; deal with odd number of samples $iIndex1 = _ArraySearch($aSequence, $aSamples[$i]) ; find the index of the first number $iIndex2 = _ArraySearch($aSequence, $aSamples[$i + 1]) ; find the index of the second number $iDistance = $iIndex2 - $iIndex1 If $iDistance < 0 Then $iDistance += UBound($aSequence) ConsoleWrite($aSamples[$i + 1] & " is " & $iDistance & " away (clockwise) from " & $aSamples[$i] & @LF) Next
    1 point
  9. padmanabangs, RegExes are too big a subject to cover in a forum thread - they are a whole new language to learn. In this case the pattern decodes as follows: (.+?) - Capture a group containing all characters (there may be none)... \s+ - until we reach one or more spaces (which we ignore)... (.+) - and then capture all the other characters until the end 3 - Return the captured groups as an array I hope that helps. I recommend this site to start learning about RegExes - good luck. M23
    1 point
  10. It seems to me that I used $SS_CENTERIMAGE to get vertical centering on a label control.
    1 point
×
×
  • Create New...