Leaderboard
Popular Content
Showing content with the highest reputation on 09/19/2014 in all areas
-
_AlwaysRun() - Monitor a program and restart if it closed.
TouchOdeath reacted to guinness for a topic
The following function will start a batch file to monitor when a program closes and restart if necessary. If you need more explanation than that, then this function isn't for you. Note: You can close the batch file using either the PID returned by _AlwaysRun() (which you'll have to store somewhere e.g. INI file) OR using the Task Manager to manually close the process. Function: Using a Batch file. Save as _AlwaysRun.au3 #include-once #include <Constants.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _AlwaysRun ; Description ...: Monitor when a program closes and then restart it. ; Syntax ........: _AlwaysRun($sFilePath[, $sCommandline = '']) ; Parameters ....: $sFilePath - FilePath of the program to monitor and restart. ; $sCommandline - [optional] A commandline string to pass to the program on restart. Default is ''. ; Return values .: Success - Returns the PID of the batch file. ; Failure - Returns 0 & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _AlwaysRun($sFilePath, $sCommandline = '') If $sFilePath = @ScriptFullPath And @Compiled = 0 Then Return SetError(1, 0, 0) EndIf Local Const $STR_NOCASESENSEBASIC = 2 Local Const $sAppName = StringTrimLeft($sFilePath, StringInStr($sFilePath, '\', $STR_NOCASESENSEBASIC, -1)) Local $sFileName = StringReplace(@ScriptName, StringTrimLeft(@ScriptName, StringInStr(@ScriptName, '.', $STR_NOCASESENSEBASIC, -1) - 1), '') While FileExists(@TempDir & '\' & $sFileName & '.bat') $sFileName &= Chr(Random(65, 122, 1)) WEnd If $sCommandline Then $sCommandline = ' ' & $sCommandline EndIf Local Const $sData = ':START' & @CRLF _ & 'PING -n 2 127.0.0.1 > nul' & @CRLF _ & @CRLF _ & 'TASKLIST /NH /FI "IMAGENAME EQ ' & $sAppName & '" | FIND /I "' & $sAppName & '" >nul && GOTO START' & @CRLF _ & 'GOTO END' & @CRLF _ & ':END' & @CRLF _ & 'START "_AlwaysRun" "' & $sFilePath & '"' & $sCommandline & @CRLF _ & 'GOTO START' & @CRLF Local Const $hFileOpen = FileOpen(@TempDir & '\' & $sFileName & '.bat', $FO_OVERWRITE) If $hFileOpen = -1 Then Return SetError(2, 0, 0) EndIf FileWrite($hFileOpen, $sData) FileClose($hFileOpen) Return Run(@TempDir & '\' & $sFileName & '.bat', @TempDir, @SW_HIDE) EndFunc ;==>_AlwaysRun Function: Using a VBScript file. Save as _AlwaysRun.au3 ; Discontinued for now. Example_1: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #include <Constants.au3> #include '_AlwaysRun.au3' ; Compile the following script before running. If @Compiled Then Example() EndIf Func Example() Local $iPID = IniRead(@ScriptDir & '\_AlwaysRunPID.ini', 'Monitor', 'PID', 0) ; Check if the monitoring process is running. If not then call the function _AlwaysRun. (This is the reason why the PID was saved to an INI file.) If ProcessExists($iPID) = 0 Then ; Start monitoring the current script path for when it closes and restart if necessary. No commandline parameters are passed. $iPID = _AlwaysRun(@ScriptFullPath, '') If @error Then Exit MsgBox($MB_SYSTEMMODAL, '_AlwaysRun()', 'The running script must be a compiled exe to work correctly.') EndIf ; Save the PID returned by _AlwaysRun to an INI file in case we need to close the monitoring process in the future. IniWrite(@ScriptDir & '\_AlwaysRunPID.ini', 'Monitor', 'PID', $iPID) Else Local Const $aArray[2] = ['No', 'Yes'] If MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL), '_AlwaysRun Running: ' & $aArray[Number(ProcessExists($iPID) > 0)], 'Would you like to continue running the _AlwaysRun Example?') = 7 Then FileDelete(@ScriptDir & '\_AlwaysRunPID.ini') Exit ProcessClose($iPID) EndIf EndIf Exit 0 EndFunc ;==>Example1 point -
Autosaver
coffeeturtle reacted to RongYao for a topic
Hello guys hehe, I wanted to upload a script i've edited. Thought, it is the photoshop autosaver, just managed to change it to suit any program and to have custom amount of time which you can choose. Forked from Photoshop autosaver Original: '?do=embed' frameborder='0' data-embedContent>> Credits goes to: stoyan for the awesome idea and the script Input box used from UpDown Controls Original: Credits goes to: GaryFrost for the awesome inputbox GUI rocker button Original: Credits goes to: abberration for the awesome button example. Autosaves only when a Photoshop window or Photoshop undocked document is active Autosaves any program's document which window or class is predefined in Autosave.txt Autosaves only the active document Fixed autosave interval (10 minutes) Custom autosave interval (from 1 to 1440 minutes / 1 day) Doesn't keep backups The tray tooltip shows the remaining time in seconds You can dynamically insert or remove programs from the list without stopping the script. You can have tooltip or traytip notifications. The script depends on the file Autosave.txt which should be in the same directory as the script or the executable to work. There you should put the titles and classes. Autosave.txt - EXAMPLE [Title:CLIP STUDIO PAINT] [Class:742DEA58-ED6B-4402-BC11-20DFC6D08040] [Class:Photoshop] [Class:OWL.DocumentWindow] You can use AutoIt Window Info to get those or if someone wants to improve it to add get window title or class from pid there. ;D Which will be usefull too, also custom hotkey will be usefull still I don't know how to achieve that now. Heres the script. #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <File.au3> Opt('TrayMenuMode', 1) Global $Exit = TrayCreateItem('Exit') Global $start = 0 Global $title = GUICreate("Time to autosave?",320,170,-1,-1) Global $text = GUICtrlCreateLabel("Enter time in minutes to run autosave!" & @LF & "From 1 minute to 1440 minutes (1 day)!" & @LF & "Enter a time and press (X) to close the window." & @LF & "You may quit with clicking Exit from the quicktray.","", -1, -1) Global $inputbox = GUICtrlCreateInput("10",10,10, 50, 20, $ES_NUMBER) Global $updown = GUICtrlCreateUpdown($inputbox) GUICtrlSetLimit($updown,1440,0) Global $old = 10 ; Attempt to resize input control GUICtrlSetPos($inputbox, 10,10, 300, 50 ) GUICtrlSetPos($text, 10,70, 300, 70 ) GUISetState(@SW_SHOW) ; Run the GUI until the dialog is closed While 1 $input = GUICtrlRead($inputbox) $msg = GUIGetMsg() If $old <> Int(GUICtrlRead($inputbox)) Then If $old < Int(GUICtrlRead($inputbox)) Then; up $old = ((Int(GUICtrlRead($inputbox)) - $old) * 1) + $old If $old > 1440 Then $old = 0 GUICtrlSetData($inputbox,$old) Else $old = (($old - Int(GUICtrlRead($inputbox))) * -1) + $old If $old < 0 Then $old = 0 GUICtrlSetData($inputbox,$old) EndIf EndIf If $msg = $GUI_EVENT_CLOSE Then GUIDelete($title) If $msg = $GUI_EVENT_CLOSE Then Exitloop WEnd If $input = 0 Then $input = 10 Global $interval = (1000 * ($input * 60)) While True Global $Msg = TrayGetMsg() Switch $Msg Case $Exit ExitLoop EndSwitch Global $delta = TimerDiff($start) Global $remaining = Round(($interval - $delta) / 1000) TraySetToolTip('Next autosave in ' & $remaining & ' seconds') If ($delta > $interval) Then Autosave() $start = TimerInit() EndIf WEnd Func Autosave() $titlefile = "autosave.txt" FileOpen($titlefile, 0) For $i = 1 to _FileCountLines($titlefile) If WinActive(FileReadLine($titlefile, $i)) Then Send('^s') endif Next FileClose($titlefile) EndFunc How to use: run it, type the desired number from 1 to 1440 which indicates minutes, then press X on the window, program will minimize and start counting down, you can click on the tray icon right click and Exit to exit the script. The default value is 10 minutes. Also if you enter 0 minutes it will fallback to 10 minutes to prevent loop of autosaving which is a bad thing to happen. You cannot enter letters and numbers above 1440, thanks to the awesome input box which i finally figured how it works in autoit, also you have up and down controls. - Rong UPDATE: 19 September 2014 It checks if the file exist and if it doesn't shows red coloured text below the usual text. (i did that purely for example purposes, the program does not write into the file so you can create it manually in the folder anyway.) It binds esc for exit and enter to run. Removed minimize because it glitches up. Binding arrow keys to raise or lower the values with keyboard arrows. #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <ColorConstants.au3> ; It is needed for the warning colour #include <Misc.au3> Opt('TrayMenuMode', 1) Global $Exit = TrayCreateItem('Exit') Global $start = 0 Global $title = GUICreate("Time to autosave?",330,195,-1,-1, $WS_CAPTION + $WS_SYSMENU) Global $text = GUICtrlCreateLabel("Enter time in minutes from 1 minute to 1440 (1 day) and press [ X ] or ENTER to run autosave or press ESC to exit! While running click with right mouse button on the tray icon and Exit to quit.","", -1, -1) Global $inputbox = GUICtrlCreateInput("10",10,10, 50, 25, $ES_NUMBER) Global $updown = GUICtrlCreateUpdown($inputbox, $UDS_WRAP + $UDS_ARROWKEYS + $UDS_ALIGNRIGHT) GUICtrlSetLimit($updown,1440,0) Global $old = 10 ; Attempt to resize input control GUICtrlSetPos($inputbox, 10,10, 310, 30 ) GUICtrlSetPos($text, 10,50, 310, 70 ) Filecheck() Func Filecheck() Global Const $titlefile = @ScriptDir & "\autosave.txt" If not FileExists($titlefile) Then Global $note = 'File ' & $titlefile & @LF & 'was not found!' ; Warning message options here Global $warning = GUICtrlCreateLabel($note,"", -1, -1) ; Warning message GUICtrlSetColor($warning, $COLOR_RED) ; Warning colour GUICtrlSetPos($warning, 10,130, 315, 190) ; Warning position Else Global $note = '' Global $warning = '' EndIf EndFunc GUISetState(@SW_SHOW) ; Run the GUI until the dialog is closed While 1 $input = GUICtrlRead($inputbox) $msg = GUIGetMsg() If $old <> Int(GUICtrlRead($inputbox)) Then If $old < Int(GUICtrlRead($inputbox)) Then; up $old = ((Int(GUICtrlRead($inputbox)) - $old) * 1) + $old If $old > 1440 Then $old = 0 GUICtrlSetData($inputbox,$old) Else $old = (($old - Int(GUICtrlRead($inputbox))) * -1) + $old If $old < 0 Then $old = 0 GUICtrlSetData($inputbox,$old) EndIf EndIf If $msg = $GUI_EVENT_CLOSE or _IsPressed("0D") Then GUIDelete($title) If $msg = $GUI_EVENT_CLOSE or _IsPressed("0D") Then Exitloop If _IsPressed("1B") Then Exit WEnd If $input = 0 Then $input = 10 Global $interval = (1000 * ($input * 60)) While True Global $Msg = TrayGetMsg() Switch $Msg Case $Exit ExitLoop EndSwitch Global $delta = TimerDiff($start) Global $remaining = Round(($interval - $delta) / 1000) TraySetToolTip('Next autosave in ' & $remaining & ' seconds') If ($delta > $interval) Then Autosave() $start = TimerInit() EndIf WEnd Func Autosave() FileOpen($titlefile, 0) For $i = 1 to _FileCountLines($titlefile) If WinActive(FileReadLine($titlefile, $i)) Then Send('^s') endif Next FileClose($titlefile) EndFunc UPDATE: 23 September 2014 It has notifications via tooltip or tray tip, by default those are off, those notify you 3 seconds before save process start so to be aware of it while drawing or whatever you do there. #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <ColorConstants.au3> ; It is needed for the warning colour #include <Misc.au3> #include <GuiButton.au3> Opt('TrayMenuMode', 1) Global $Exit = TrayCreateItem('Exit') Global $start = 0 Global $title = GUICreate("Time to autosave?",330,195,-1,-1, $WS_CAPTION + $WS_SYSMENU) Global $text = GUICtrlCreateLabel("Enter time in minutes from 1 minute to 1440 (1 day) and press [ X ] or ENTER to run autosave or press ESC to exit! While running click with right mouse button on the tray icon and Exit to quit.","", -1, -1) Global $inputbox = GUICtrlCreateInput("10",10,10, 50, 25, $ES_NUMBER) Global $updown = GUICtrlCreateUpdown($inputbox, $UDS_WRAP + $UDS_ARROWKEYS + $UDS_ALIGNRIGHT) GUICtrlSetLimit($updown,1440,0) Global $old = 10 ; Attempt to resize input control GUICtrlSetPos($inputbox, 130,10, 190, 30 ) GUICtrlSetPos($text, 10,50, 310, 70 ) Global $readButton = "Notifications Off" Global $Button1 = GUICtrlCreateButton("Notifications Off", 10, 10, 115, 30, 0) ; GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetBkColor ($Button1, 0xFF0000) Filecheck() Func Filecheck() Global Const $titlefile = @ScriptDir & "\autosave.txt" If not FileExists($titlefile) Then Global $note = 'File ' & $titlefile & @LF & 'was not found!' ; Warning message options here Global $warning = GUICtrlCreateLabel($note,"", -1, -1) ; Warning message GUICtrlSetColor($warning, $COLOR_RED) ; Warning colour GUICtrlSetPos($warning, 10,130, 315, 190) ; Warning position Else Global $note = '' Global $warning = '' EndIf EndFunc Func _ToggleButton() Global $readButton = _GUICtrlButton_GetText($Button1) If $readButton = "Notifications Off" Then Global $readButton = "Notifications On" _GUICtrlButton_SetText($Button1, "Notifications On") GUICtrlSetBkColor ($Button1, 0x87f717) ElseIf $readButton = "Notifications On" Then Global $readButton = "Notify Via Tray" _GUICtrlButton_SetText($Button1, "Notify Via Tray") GUICtrlSetBkColor ($Button1, 0x75abf6) Else Global $readButton = "Notifications Off" _GUICtrlButton_SetText($Button1, "Notifications Off") GUICtrlSetBkColor ($Button1, 0xFF0000) EndIf EndFunc GUISetState(@SW_SHOW) ; Run the GUI until the dialog is closed While 1 $input = GUICtrlRead($inputbox) $msg = GUIGetMsg() If $old <> Int(GUICtrlRead($inputbox)) Then If $old < Int(GUICtrlRead($inputbox)) Then; up $old = ((Int(GUICtrlRead($inputbox)) - $old) * 1) + $old If $old > 1440 Then $old = 0 GUICtrlSetData($inputbox,$old) Else $old = (($old - Int(GUICtrlRead($inputbox))) * -1) + $old If $old < 0 Then $old = 0 GUICtrlSetData($inputbox,$old) EndIf EndIf If $msg = $GUI_EVENT_CLOSE or _IsPressed("0D") Then GUIDelete($title) If $msg = $GUI_EVENT_CLOSE or _IsPressed("0D") Then Exitloop If _IsPressed("1B") Then Exit Switch $Msg Case $Button1 _ToggleButton() EndSwitch WEnd If $input = 0 Then $input = 10 Global $interval = (1000 * ($input * 60)) While True Global $Msg = TrayGetMsg() Switch $Msg Case $Exit ExitLoop EndSwitch Global $delta = TimerDiff($start) Global $remaining = Round(($interval - $delta) / 1000) TraySetToolTip('Next autosave in ' & $remaining & ' seconds') If ($delta > $interval) Then Autosave() $start = TimerInit() EndIf WEnd Func Autosave() FileOpen($titlefile, 0) For $i = 1 to _FileCountLines($titlefile) If WinActive(FileReadLine($titlefile, $i)) Then ; Notify before save start here If $readButton = "Notifications On" Then Global $taskbar = WinGetPos("","Notification Area"); Taskbar x,y,width,height Global $x = @DesktopWidth - 170 Global $y = @DesktopHeight - 48 - $taskbar[3] ToolTip("Saving in 3 seconds..." & @CR & @CR & @CR, $x, $y) Sleep(3000) ; Wait 3 seconds to show the ToolTip right ToolTip ("") ; Removing ToolTip in case it got stuck EndIf If $readButton = "Notifications Off" Then ToolTip ("") EndIf If $readButton = "Notify Via Tray" Then TrayTip("Saving...", "in 3 seconds", 0) Sleep(3000) EndIF ; Notify before save ends here Send('^s') endif Next FileClose($titlefile) EndFunc1 point -
hi here are two little functions I made to encode and decode web URL strings, any chars that are not valid are converted to hexadecimal and vice versa, Well I wrapped it up with a little GUI for you to test hope it maybe useful. #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Local Const $AppTitle = "URL Tools" Func DecodeUrl($src) Local $i Local $ch Local $buff ;Init Counter $i = 1 While ($i <= StringLen($src)) $ch = StringMid($src, $i, 1) ;Correct spaces If ($ch = "+") Then $ch = " " EndIf ;Decode any hex values If ($ch = "%") Then $ch = Chr(Dec(StringMid($src, $i + 1, 2))) $i += 2 EndIf ;Build buffer $buff &= $ch ;Inc Counter $i += 1 WEnd Return $buff EndFunc ;==>DecodeUrl Func EncodeUrl($src) Local $i Local $ch Local $NewChr Local $buff ;Init Counter $i = 1 While ($i <= StringLen($src)) ;Get byte code from string $ch = Asc(StringMid($src, $i, 1)) ;Look for what bytes we have Switch $ch ;Looks ok here Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $buff &= Chr($ch) ;Space found Case 32 $buff &= "+" Case Else ;Convert $ch to hexidecimal $buff &= "%" & Hex($ch, 2) EndSwitch ;INC Counter $i += 1 WEnd Return $buff EndFunc ;==>EncodeUrl Func ShowForm() Local $Data ;Create form controls $frmmain = GUICreate($AppTitle, 509, 265, 314, 360) $lblTitle1 = GUICtrlCreateLabel("URL Decoder/Encoder", 8, 7, 115, 17) $cmdEncode = GUICtrlCreateButton("&Encode", 423, 26, 75, 25) $cmdExit = GUICtrlCreateButton("E&xit", 423, 132, 75, 25) $txtData = GUICtrlCreateEdit("Testing + 12 http://www.google.com", 8, 26, 409, 193) $cmdDecode = GUICtrlCreateButton("&Decode", 423, 57, 75, 25) $cmdAbout = GUICtrlCreateButton("&About", 423, 100, 75, 25) $lblDesc = GUICtrlCreateLabel("Ben's URL Encoder/Decoder v1.0", 90, 228, 243, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) ;Show form GUISetState(@SW_SHOW) ;Form Messages loop While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $cmdExit Exit Case $cmdEncode ;Get text data $Data = _GUICtrlEdit_GetText($txtData) ;Check length If StringLen($Data) > 0 Then ;Place text into decoded text box. _GUICtrlEdit_SetText($txtData, EncodeUrl($Data)) EndIf Case $cmdDecode ;Get text data $Data = _GUICtrlEdit_GetText($txtData) ;Check length If StringLen($Data) > 0 Then ;Place text into decoded text box. _GUICtrlEdit_SetText($txtData, DecodeUrl($Data)) EndIf Case $cmdAbout MsgBox(64, "About", $AppTitle & " v1.0" & @CRLF & @TAB & "By Ben Jones") EndSwitch WEnd EndFunc ;==>ShowForm ;Load main form ShowForm()1 point
-
http://blogs.windows.com/buildingapps/2014/09/18/microsoft-ocr-library-for-windows-runtime/1 point
-
If Danyfirex has solved your problem, It's customary to like his post and mark the question as answered.1 point
-
maybe this: Local $tMODULEINFO=DllStructCreate("DWORD dwFlags;ptr szAbout;ptr szHashType;DWORD dwReserved[13]") Local $aResult = DllCall("yourdll.dll", "none:cdecl", "GetInfo", "ptr", DllStructGetPtr($tMODULEINFO)) Saludos1 point
-
Image Search
MikahS reacted to Blue_Drache for a topic
And this is different to your game botting question, how?1 point -
>also this link might interest you1 point
-
Mouseclicks and send will not work in a background session and you will have to use controlxxx functions. Jos1 point
-
Autoit Scheduler alternatives
Jewtus reacted to JLogan3o13 for a topic
How about explaining more about what you're trying to do (what page are you opening, what controls are you clicking on, etc.) and why you feel mouseclicks and sends are the only way to go?1 point -
EKY32, Rather than inserting a full hyperlink into the ListView, why not just detect a doubleclick on the relevant cell and then run the link programatically? Much easier to manage. M231 point
-
You can compile it as a CUI program instead of GUI, and then still use ConsoleWrites to keep track of the script. It's much better than clicking the OK button 10,000 times because it's in a loop. Add this line before compiling it. #AutoIt3Wrapper_Change2CUI=y1 point
-
Thank you: Mikkelin, MikahS, Detefon, Zedna, binhnx, and jchd, for your inputs!1 point
-
Thank you for sharing this with me, I will say very nice AZJIO! I think the only thing that you haven't done was the word wrap, which you can easily take from mine. EDIT: And the printing support1 point
-
Anyone found abusing the website is subject to harsh punishment without warning. A non-exhaustive list of potential abuses include: Automated forum registration or login.Automated posting or sending messages on the forum.Automated manipulation of polls, user reputation or other forum features.Automated creation or comments on issue tracker tickets.Automated creation or editing of wiki pages.Excessive downloading of pages or files.Excessive frequency when downloading RSS feeds.Other abuses which are either examples of excessive bandwidth usage or automation of the site.Use common sense. If you do not have common sense, don't do anything. Do not automate the forum, wiki or issue tracker in any way at all. Scripts which automatically update AutoIt such as AutoUpdateIt are acceptable as long as they are not abused and do not generate excessive bandwidth usage.1 point
-
Forum http://www.autoitscript.com/forum You are already reading it Wiki http://www.autoitscript.com/wiki Community based content about AutoIt. Currently open for editing by anyone in the forum "Active Members" group. Trac http://www.autoitscript.com/trac/autoit The bug and feature request system. Post bugs and new feature requests here.1 point
-
This seems to be a recurring topic of interest, so I thought I'd share this COM object I wrote in VB .Net, called "ImgTool". It has functions that capture all or part of the screen directly to a variety of image file formats. (Yes, I know there are easier ways to do that - at least to bitmap - but I just wanted to give a non-trivial example.) To compile the attached source, you will need the .NET Framework 2.0 SDK or Visual Studio 2005. To run the following code, you just need the attached DLL file, which source is in the Zip. You'll notice that this only uses properties and methods; COM events (like for ObjEvent()) seem to take a little something extra I'm still working on, and at any rate were not needed for this sample. My main point in posting this was to show which attributes to use and how to register .Net types for COM interop. The .snk file in the source is needed to generate the type library, and is obtained using sn.exe. If $CmdLine[0]=0 Then Local $path=FileOpenDialog("Select a .NET assembly to register",@ScriptDir,"DLL files (*.dll)",1) If @error=1 Then Exit ;MsgBox(0, "Net DLL Registration", RegisterDotNetComponent($path) ;) Else RegisterDotNetComponent($CmdLine[1]) EndIf Dim $com = ObjCreate("ImgTool.ImgConverter") $com.Test() $com.ScreenShot("screen","c:\screen.jpg") ; Regexp: (?<mode>LT(?<m>RB|WH))\((?<L>\d+),(?<T>\d+),(?<W>\d+),(?<H>\d+)\) $com.ScreenShot("LTWH(50,50,100,200)","c:\ltwh.jpg") ; ArgumentException - check the RegEx MsgBox(0,1,$com.GetLastError()) $com=0 Func RegisterDotNetComponent($path) Local $text Local $regasm = "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe" Local $regasmparams = ' "' & $path & '" /tlb' Local $gacutil= "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" Local $gacutilparams = ' -i "' & $path & '"' $text = GetOutput("RegAsm", $regasm, $regasmparams) ;~ regasm "$path" /tlb $text &= @CRLF & @CRLF $text &= GetOutput("GACUtil", $gacutil, $gacutilparams) ;~ gacutil -i "$path" ConsoleWrite($text) Return $text EndFunc Func GetOutput($name, $path, $params) If StringLeft($params,1) <> " " Then $params = " " & $params Local $pid = Run($path & $params, "", @SW_HIDE, 7) ;~ regasm "$path" /tlb Local $out = StdoutRead($pid) Local $strout = $name & ":" & @CRLF & $out While $out $out = StdoutRead($pid) $strout = $strout & @CRLF & $out WEnd Return $strout EndFunc Edit: uploaded second zip file with the dll and tlb files ImgConv.zip ImgTool_dll.zip1 point