Leaderboard
Popular Content
Showing content with the highest reputation on 09/25/2013 in all areas
-
May be some of you know the shareware VectorMagic who permit to easily convert bitmap Images to clean Vector Art ! Pic2Vector 1.0.1.4 is free, and can give similar effects ! I was interested by some effects added to a photo. I'm not using gdi for the vectorization, but 2 command line tools : Autotrace 0.27 with ILDA file support for converting bitmap to vector graphics Custom Version at : http://www.raycomposer.de/en/ressources/autotrace/ More general infos : http://autotrace.sourceforge.net/ GPL Ghostscript 9.07 use here for converting vector graphics to Jpeg. More infos : http://www.ghostscript.com/doc/9.07/Use.htm# example 1 example 2 example 3 example 4 example 5 example 6 example 7 example 8 Free to you to play with settings for see changes.(Infos with tooltip added to each type of setting) If UAC Enable, use right click, execute as Admin. Click on vectorized Pic for display it in fullscreen with Windows picture Viewer. You can save result to jpg, png, bmp or gif format. Changes Version 1.0.1.4 Settings can be saved by creating a profil. No more appcrash window for autotrace.exe. New buttons for display compatibility with xp. Externals files are embedded, no more downloads needed. Some minor improvements. Added new examples to topic. Tested with WinXp, Win7 and Win 8.1. previous downloads : 666 source and executable are available in the Download Section Hope you like it !4 points
-
Another _ScreenCapture_Capture Dir problem ...
Alexxander and one other reacted to FireFox for a topic
AFAIK, brain cells are not available on ebay. Unfortunately.2 points -
Based on the Outlook UDF written by wooltown, we (wooltown and I) decided to extend the functionality of the Outlook UDF. As the OutlookEX UDF ("EX" like "extended") has a completely different approach compared to the Outlook UDF it's a complete rewrite. We would like to discuss the design of the UDF with the community. Every feedback, function request etc. is highly welcome. As soon as the discussion shows that we are on the right track we would like to release an alpha version for everyone to test. So please don't be shy and post what you think of this UDF or what functions you need! Every item in Outlook is uniquely identified by EntryID and StoreID. The default StoreID is your inbox Every item has properties to describe the item (subject, startdate ..) and methods to act upon the item (move, delete …) The search and action functions are now separated. As an example the user first searches for the items to be deleted and then calls the delete function If a method can be used for more than one item type (e.g. mail, calendar and notes) the function is called _OL_ItemXXX else the function is called _OL_CalendarXXX The number of properties you can get or pass to most functions is not limited by the number of parameters defined for the function. Properties can be passed as parameters (up to 10) or in an unlimited array as parameter 1 The UDF allows to access all kind of folders (see the following listing). Folders can be passed by name or as an object to a function A lot of testing is still needed as we have written and tested the functions using Outlook 2002 SP3 and Outlook 2010 "wrapper" or "shortcut" functions will be available to let you do all tasks in one go e.g. _OL_Wrapper_SendMail for all functions above. Documentation: The documentation for this UDF (aside from the docu in the UDF itself) will be placed in the AutoIt Wiki. So we can easily modify the docu without releasing a new version each time. There will be pages describing the UDF in general and pages for individual item types (like mail) with detailed information and a lot of tips & tricks. Tested with Outlook 2003 and 2010. Some users reported that it works with Outlook 2013 as well. Starting point: http://www.autoitscript.com/wiki/OutlookEX_UDF_-_General Download1 point
-
I've had this one rolling around my brain for a while now. And while I can't take credit for much of anything at this point since it's just implementation, here's a framework for Time-based One-Time Password authentication, ie Google Authenticator. I've added links in all the places where I've harvested code. I'm planning on building this into an actual authenticator app, so this is just step one. As always, thanks to everyone whose code contributed. _GAuth.au3 #include-once #include <_HMAC.au3> #include <Date.au3> ;; http://tools.ietf.org/html/rfc6238 Func _GenerateTOTP($key, $keyIsBase32 = True, $time = Default, $period = 30, $digits = 6) Local $DIGITS_POWER[9] = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000] ; time is some number of seconds If $time = Default Then $time = _GetUnixTimeUTC() $time = StringFormat("%016X", Floor($time / $period)) If $keyIsBase32 Then $key = _Base32ToHex($key, True) ; return binary Else $key = StringToBinary($key) EndIf ; HMAC function expects binary arguments Local $hash = _HMAC_SHA1($key, Binary("0x" & $time)) Local $offset = BitAND(BinaryMid($hash, BinaryLen($hash), 1), 0xf) Local $otp = BitOR(BitShift(BitAND(BinaryMid($hash, $offset + 1, 1), 0x7f), -24), _ BitShift(BitAND(BinaryMid($hash, $offset + 2, 1), 0xff), -16), _ BitShift(BitAND(BinaryMid($hash, $offset + 3, 1), 0xff), -8), _ BitAND(BinaryMid($hash, $offset + 4, 1), 0xff) _ ) $otp = Mod($otp, $DIGITS_POWER[$digits]) Return StringFormat("%0" & $digits & "i", $otp) EndFunc ;; http://www.autoitscript.com/forum/topic/153617-seconds-since-epoch-aka-unix-timestamp/ Func _GetUnixTimeUTC() ; returns number of seconds since EPOCH in UTC Local $aSysTimeInfo = _Date_Time_GetTimeZoneInformation() Local $utcTime = "" Local $sDate = _NowCalc() If $aSysTimeInfo[0] = 2 Then $utcTime = _DateAdd('n', $aSysTimeInfo[1] + $aSysTimeInfo[7], $sDate) Else $utcTime = _DateAdd('n', $aSysTimeInfo[1], $sDate) EndIf Return _DateDiff('s', "1970/01/01 00:00:00", $utcTime) EndFunc ;; http://tomeko.net/online_tools/base32.php?lang=en Func _Base32ToHex($sInput, $returnBinary = False) $sInput = StringRegExpReplace(StringUpper($sInput), "[^A-Z2-7]", "") Local $key = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" Local $buffer = 0, $bitsLeft = 0, $i = 0, $count = 0, $output = "", $val While $i < StringLen($sInput) $val = StringInStr($key, StringMid($sInput, $i + 1, 1)) - 1 ; StringInStr returns 1 as 1st position If $val >=0 And $val < 32 Then $buffer = BitOR(BitShift($buffer, -5), $val) $bitsLeft += 5 If $bitsLeft >= 8 Then $output &= Chr(BitAND(BitShift($buffer, $bitsLeft - 8), 0xFF)) $bitsLeft -= 8 EndIf EndIf $i += 1 WEnd If $bitsLeft > 0 Then $buffer = BitShift($buffer, -5) $output &= Chr(BitAND(BitShift($buffer, $bitsLeft - 3), 0xFF)) EndIf If $returnBinary Then Return StringToBinary($output) Else Return $output EndIf EndFunc #cs Alternate base32 to hex functions Func _b32toh($input) $input = StringRegExpReplace(StringUpper($input), "[^A-Z2-7]", "") Local $ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" Local $bits = "", $hex = "", $val, $i For $i = 0 To StringLen($input) - 1 $val = StringInStr($ch, StringMid($input, $i + 1, 1)) - 1 $bits &= StringFormat("%05s", _itob($val)) Next $i = 0 Local $chunk While ($i + 4) <= StringLen($bits) $chunk = StringMid($bits, $i + 1, 4) $hex &= StringFormat("%X", _btoi($chunk)) $i += 4 WEnd Return $hex EndFunc ; int to binary (0's and 1's) string Func _itob($int) Local $o = "" While $int $o = BitAND($int, 1) & $o $int = BitShift($int, 1) WEnd Return $o EndFunc ; binary (0's and 1's) string to int Func _btoi($b) Local $p = 0, $o = 0 For $i = StringLen($b) To 1 Step -1 $o += (2 ^ $p) * Number(StringMid($b, $i, 1)) $p += 1 Next Return $o EndFunc #ce Func _TOTPTestVectors() #cs Test vectors operate in HOTP mode. The test token shared secret uses the ASCII string value "12345678901234567890". With Time Step X = 30, and the Unix epoch as the initial value to count time steps, where T0 = 0, the TOTP algorithm will display the following values for specified modes and timestamps. +-------------+--------------+------------------+----------+--------+ | Time (sec) | UTC Time | Value of T (hex) | TOTP | Mode | +-------------+--------------+------------------+----------+--------+ | 59 | 1970-01-01 | 0000000000000001 | 94287082 | SHA1 | | | 00:00:59 | | | | | 1111111109 | 2005-03-18 | 00000000023523EC | 07081804 | SHA1 | | | 01:58:29 | | | | | 1111111111 | 2005-03-18 | 00000000023523ED | 14050471 | SHA1 | | | 01:58:31 | | | | | 1234567890 | 2009-02-13 | 000000000273EF07 | 89005924 | SHA1 | | | 23:31:30 | | | | | 2000000000 | 2033-05-18 | 0000000003F940AA | 69279037 | SHA1 | | | 03:33:20 | | | | | 20000000000 | 2603-10-11 | 0000000027BC86AA | 65353130 | SHA1 | | | 11:33:20 | | | | +-------------+--------------+------------------+----------+--------+ #ce Local $times[6] = [59, 1111111109, 1111111111, 1234567890, 2000000000, 20000000000] For $i = 0 To 5 ConsoleWrite(StringFormat("%016X", Floor($times[$i] / 30)) & " : " & _ _GenerateTOTP("12345678901234567890", False, $times[$i], 30, 8) & @CRLF) Next EndFunc _HMAC.au3 #include-once #include <Crypt.au3> ;; http://www.autoitscript.com/forum/topic/145556-solved-hmac-sha1/?p=1028830 Func _HMAC_SHA1($key, $message) If Not IsBinary($key) Then $key = Binary($key) If Not IsBinary($message) Then $message = Binary($message) Local $blocksize = 64 Local $a_opad[$blocksize], $a_ipad[$blocksize] Local Const $oconst = 0x5C, $iconst = 0x36 Local $opad = Binary(''), $ipad = Binary('') If BinaryLen($key) > $blocksize Then $key = _Crypt_HashData($key, $CALG_SHA1) For $i = 1 To BinaryLen($key) $a_ipad[$i-1] = Number(BinaryMid($key, $i, 1)) $a_opad[$i-1] = Number(BinaryMid($key, $i, 1)) Next For $i = 0 To $blocksize - 1 $a_opad[$i] = BitXOR($a_opad[$i], $oconst) $a_ipad[$i] = BitXOR($a_ipad[$i], $iconst) Next For $i = 0 To $blocksize - 1 $ipad &= Binary('0x' & Hex($a_ipad[$i], 2)) $opad &= Binary('0x' & Hex($a_opad[$i], 2)) Next Return _Crypt_HashData($opad & _Crypt_HashData($ipad & $message, $CALG_SHA1), $CALG_SHA1) EndFunc Func _HMAC_MD5($key, $message) If Not IsBinary($key) Then $key = Binary($key) If Not IsBinary($message) Then $message = Binary($message) Local $blocksize = 64 Local $a_opad[$blocksize], $a_ipad[$blocksize] Local Const $oconst = 0x5C, $iconst = 0x36 Local $opad = Binary(''), $ipad = Binary('') If BinaryLen($key) > $blocksize Then $key = _Crypt_HashData($key, $CALG_MD5) For $i = 1 To BinaryLen($key) $a_ipad[$i-1] = Number(BinaryMid($key, $i, 1)) $a_opad[$i-1] = Number(BinaryMid($key, $i, 1)) Next For $i = 0 To $blocksize - 1 $a_opad[$i] = BitXOR($a_opad[$i], $oconst) $a_ipad[$i] = BitXOR($a_ipad[$i], $iconst) Next For $i = 0 To $blocksize - 1 $ipad &= Binary('0x' & Hex($a_ipad[$i], 2)) $opad &= Binary('0x' & Hex($a_opad[$i], 2)) Next Return _Crypt_HashData($opad & _Crypt_HashData($ipad & $message, $CALG_MD5), $CALG_MD5) EndFunc Example: Use the test vectors function to test HOTP mode, or visit http://gauth.apps.gbraad.nl/ for a live test site. The default account uses "JBSWY3DPEHPK3PXP" as the key ( https://code.google.com/p/google-authenticator/wiki/KeyUriFormat ). ConsoleWrite(_GenerateTOTP("JBSWY3DPEHPK3PXP") & @CRLF)1 point
-
ExcelChart UDF
argumentum reacted to water for a topic
GreenCan and I are proud to present our Excel Chart UDF. The UDF is written for and tested with Microsoft Excel 2007 and Excel 2010. The example scripts won't run with older versions whereas the functions don't check the Excel version - you use them at your own risk. The UDF consists of one function to create a simple chart (you just have to specify the data area, the type of graph to draw, title, position of the chart etc.) and a lot of functions to create/modify all aspects of the chart. _XLChart_3D_Position........Set the 3D position of the chart (rotation, elevation, perspective) _XLChart_AreaGroupSet.......Set properties of an area chart group _XLChart_AxisSet............Set the properties of the selected axis (minimum, maximum value ...) _XLChart_BarGroupSet........Set properties of a bar chart group _XLChart_BubbleGroupSet.....Set properties of a bubble chart group _XLChart_ChartCreate........Create a chart in Excel on the specified worksheet or on a separate chart sheet _XLChart_ChartDataSet.......Sets all data related properties of an existing chart or chartsheet _XLChart_ChartDelete........Deletes a chart or chart sheet _XLChart_ChartExport........Exports the chart in a graphic format (GIF, JPG, PNG ...) or as PDF/XPS _XLChart_ChartPositionSet...Resize and reposition a chart object _XLChart_ChartPrint.........Print a chart or a chart sheet _XLChart_ChartSet...........Set properties for a chart _XLChart_ChartsGet..........Enumerate charts and chart sheets in a workbook _XLChart_ColumnGroupSet.....Set properties of a column chart group _XLChart_DatalabelSet.......Set properties for the data labels of a data series _XLChart_DoughnutGroupSet...Set properties of a doughnut chart group _XLChart_ErrorBarSet........Add or set properties of error bars for a data series _XLChart_FillSet............Set fill properties for the specified object (color, gradient, transparency ...) _XLChart_FontSet............Set font properties for the specified object (font name, size, bold, italic ...) _XLChart_GridSet............Set gridlines of a chart _XLChart_LayoutSet..........Set layout, style or template for a chart _XLChart_LegendSet..........Set properties of the legend (position, frame, shadow ...) _XLChart_LineGet............Returns properties of a line (axis line, grid line, data line ...) _XLChart_LineGroupSet.......Set properties of a line chart group _XLChart_LineSet............Set properties of a line (axis line, grid line, data line ...) like weight, color, style ... _XLChart_MarkerSet..........Set properties for the marker objects of line, scatter or radar charts _XLChart_ObjectDelete.......Delete an object from a chart _XLChart_ObjectPositionSet..Resize and reposition an object (plot area, legend ...) on a chart _XLChart_OfPieGroupSet......Set properties of a pie of pie or bar of pie chart group _XLChart_PageSet............Set the page setup attributes (paper size, orientation, margins etc.) for a chart or chart sheet _XLChart_PieGroupSet........Set properties of a pie or 3D-pie chart group _XLChart_ScreenUpdateSet....Turning screen updating on/off to improve performance _XLChart_SeriesAdd..........Add a data series to a chart _XLChart_SeriesSet..........Set properties of a data series _XLChart_ShadowSet..........Set properties of a shadow _XLChart_TicksSet...........Set tick marks and tick labels of a chart _XLChart_TitleGet...........Return information about a title. This can be the chart or any axis title _XLChart_TitleSet...........Set properties of a title. This can be the chart or any axis title _XLChart_TrendlineSet.......Add a new trendline or set properties of an existing trendline of a data series _XLChart_VersionInfo........Returns an array of information about the ExcelChart UDF For every function there is an example script available that shows what can be done with the respective function. There is a function cross reference available that documents which object (axis, dataline, legend ...) you can pass to which function. Play with the UDF and tell us what you like, what you would like to see improved or what is missing. Have fun! Download:1 point -
I have converted and extended the adfunctions.au3 written by Jonathan Clelland to a full AutoIt UDF including help file, examples, ScITE integration etc. The example scripts should run fine without changes. 2016-08-18: Version: 1.4.6.0 As always: Please test before using in production! KNOWN BUGS: (Last changed: ) None AD 1.4.6.0.zip For AutoIt >= 3.3.12.0 AD 1.4.0.0.zip other versions of AutoIt1 point
-
Update the Excel UDF that comes with AutoIt
232showtime reacted to water for a topic
This UDF is now part of AutoIt since 3.3.12.0. New versions of Microsoft Office have been released since the last changes were made to the Excel UDF. The new extensions (e.g. xlsx) are not (fully) supported, new functions are missing etc. The rewrite of the Excel UDF delivers changes in the following areas: Works with as many instances of Excel as you like - not just one Works with any Workbook - not just the active one Works with any Worksheet - not just the active one Only does what you tell it to do - no implicit "actions" Only one function to read from a cell or a range Only one function to write a string, an 1D or 2D array to a cell or a range Support for every file format Excel supports Speed enhancements when transferring data from/to an Excel sheet (20 - 100 times faster) 2014-03-22 - Beta 5 Known bugs None The example scripts have been tested with Excel 2010 and AutoIt 3.3.10.2 on Windows 7. You need to run the scripts with the latest AutoIt production version (3.3.10.x)! Please test with Excel 2003 and Excel 2007 and post changes you need/want to see in the next beta version! Excel Rewrite Beta 5.zip has been removed as it is now part of AutoIt since 3.3.12.0. (627 downloads) History.txt1 point -
Alexxander, Watch the attitude - it is not those offering you help who are retarded. M231 point
-
Autoit and High CPU usage
BrewManNH reacted to JLogan3o13 for a topic
And a sleep(10) will reduce it the same. I don't know how lousy a CPU you have, but it took 29% on mine without the sleep. Adding the sleep took it down to 3%. @mlipok - just because by some chance GUIGetMsg works in this case doesn't mean using a GUI function in a non-GUI script is good coding practice. If you're going to "help" forum users, you should be suggesting the right tool for the job. Why complicate matters when a simple sleep will work?1 point -
if you do not using: #AutoIt3Wrapper_Change2CUI=y then AutoIt always create GUI see in AutoItWinSetTitle Beta HelpFile #include <GUIConstantsEx.au3> Example() Func Example() ; Set the title of of the AutoIt Hidden Window. AutoItWinSetTitle("My AutoIt Window") ; Display AutoIt's Hidden Window. AutoItWinShow() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>Example ; Display AutoIt"s Hidden Window. Returns the handle of the window. Func AutoItWinShow() Local $hWnd = WinGetHandle(AutoItWinGetTitle()) ; Get the handle of the AutoIt Hidden Window by finding out the title of the AutoIt Hidden Window. WinMove($hWnd, "", (@DesktopWidth / 2) - 250, (@DesktopHeight / 2) - 250, 500, 500) ; Move the AutoIt Hidden Window and re-size for a better view. WinSetState($hWnd, "", @SW_SHOW) ; Show the AutoIt Hidden Window, normally this is hidden, but in the interest of this example I"m displaying it. Return $hWnd EndFunc ;==>AutoItWinShow So there is a GUI, but mostly about him does not remember. At least, I think that about this. If anyone has other thoughts, then I be happy to take them.1 point
-
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, untested1 point
-
Hide Process Name?
Alexxander reacted to Uten for a topic
Yes, virus writers does it all the time. What is your excuse?1 point