Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/01/2015 in all areas

  1. You should read and download Navigating in an image before you read and download this example. The first example shows how to navigate in an image, and the zipfile contains the test images. The first example contains an illustration of the GUI. The example The picture to the left shows a triangular selection. It's shown with a zoom factor of 24. Each 24x24 square equals a single pixel in the source image. The oblique lines in the triangle cut across the 24x24 squares. But a selection in the source image can only include entire pixels. The horizontal/vertical polygon in the middle picture contains pixels that are completely inside the triangle. Pixels at borders are not included. The horz/vert polygon on the right is just outside the triangle, and contains pixels at the borders. In this example you can draw a closed polygon with the mouse. The horz/vert polygon that follows the pixel edges along the oblique polygon lines are calculated, and pixels are selected. The horz/vert polygon can be calculated inside or outside the oblique polygon. The example is not limited to triangles. You can create a selection like this with 15 line segments: Program modes In Navigating in an image there is only one mode: View mode. To create a non-rectangular selection you have to switch to Polygon selection mode. Click button 3 below to switch mode. This will add a new Polygon selection toolbar. Click button 3 again to leave Polygon selection mode. A click in the title bar, the menu bar, a tab item, buttons in toolbar not related to Polygon selection, the free area of the toolbar or the status bar will also leave Polygon selection mode. Toolbar buttons The left group is the Copy/paste toolbar. A click on a button in Polygon selection mode will switch to View mode. 1) Copy selected pixels2) Paste as new imageThe middle group is the Select toolbar. The buttons are available both in View mode and in Polygon selection mode.3) Polygon selection4) Center selection5) Remove selection6) Selection colorsThe last group is the Polygon selection toolbar. This toolbar is only visible when button 3 is pressed.7) New polygon8) Recent polygons9) Polygons on opposite side of support lines10) Redraw polygons (after error or debug)11) Undo last support polygon action12) Redo last support polygon actionYou can right (secondary) click button 1, 6 and 8. Note that all toolbar buttons are provided with tooltips. In addition to colors that can be set with button 6, you can set colors for frame and grid. Right click the tab item to set all colors at once, that best fits bright and dark images. By default colors are set to fit a bright image. More details Draw a polygon To create a non-rectangular selection you just have to draw a non-rectangular polygon with the mouse. Nomenclature: The oblique polygon you draw with the mouse is called the support polygon. The polygons which follows the pixel edges along each oblique support line are called horizontal/vertical or horz/vert polygons. In the first illustration above you see a support polygon in the left picture, and a support polygon plus three horz/vert polygons in the two other pictures. A support polygon is drawn as a sequence of line segments. End point of previous line must be start point of next line. The polygon is finished, when end point of last line is equal to start point of first line. 1) First line segmentClick a start point with primary mouse button, drag line to an end point, release mouse button. 2) Next line segmentClick end point of previous line, drag line with mouse to end point of next line. Repeat this step as many times as needed. 3) Last line segmentClick end point of previous line, drag line with mouse to start point of first line. This illustration shows how to create a triangular selection. First line segment Zoom in to a sufficiently high level with the mouse wheelClick Polygon selection button to switch to Polygon selection modeClick New polygon button to create a new polygonCreate the first oblique support line with the mouseClick possibly "Polygons on opposite side of support lines" button to calculate and draw the horz/vert polygon on opposite side of the support lineThe default action when you drag with the mouse is to move the image. A click at the New polygon button disables the default action for the next drag operation, and you can create the first line segment. For the following line segments you have to start the dragging at an end line marker. Dragging outside an end line marker will move the image. Next line segment Move the mouse pointer over the marker at the end of the first line segmentThe pointer will change to a cross cursorCreate the next oblique support lineLast line segmentMove the pointer over one of the markers at the end of the two line segmentsThe pointer will change to a cross cursorCreate the last oblique support lineForce empty line after listMouse actions In Polygon selection mode you can still zoom in/out with the mouse wheel, drag/move the image, and click a point to zoom around this point. This is described in Navigating in an image. You can create a support polygon as explained above. In addition to these actions you can adjust line end points and corner points, move the entire support polygon, and delete a support line. To see which actions you can do, just hover the mouse pointer over a line marker, and you'll get information in a tooltip. Over a line marker the pointer will change to a cross cursor. When you click Polygon selection button, tooltips will be shown for the first few support lines. To adjust an end point of a support line or a corner point between two support lines press the Shift button, move the mouse pointer over the marker, click and drag the point. To move the entire polygon position the mouse pointer over a middle marker, click and drag the polygon. Note that this will move the polygon relative to the source image. If you have zoomed in to a factor 24 as in the image above, the polygon will be moved in steps af 24 pixels in the picture control. To delete a support line position the mouse pointer over a middle marker, right (secondary) click and click "Delete line segment" in the context menu. Only end lines can be deleted. For a finished polygon any line can be deleted, but as soon as one line is deleted, only end lines can be deleted. Keyboard actions You can use Page Up/Page Down to zoom in/out, arrow keys to move the image a pixel at a time, and Shift plus arrow keys to move the image a page at a time. Line validations If you are creating a selection as shown to the left, and have added line 0, 1 and 2 and are going to add line 3, it can happen that line 3 gets too close to line 0. This is an error, and you'll get a visual feedback as shown to the right. The end point of the line must not be inside the red region, and the line must not cross the red region. To get rid of the red lines/circles just recreate line 3 and make it a little shorter, or click Redraw polygons button. Several validations are performed on line segments in this order: 1) Line segments must not be too short2) Line segments must not be horizontal or vertical3) Angles between neighbor lines must not be too small or too large4) Start or end point of a new line must not be too close to neigbor segments5) Start and end point of a line must not be too close to other segments (the illustration above)To create selections with horizontal/vertical lines that doesn't violate point 2, you can do something like this: Array limits Array limits are not validated in this version. The limits are: Line segments in a support polygon: 25Points in a horizontal/vertical polygon along a support line: 2000Points in the final polygon (drawn with _GDIPlus_GraphicsDrawPolygon): 10000Force empty line after listDebug menu Right (secondary) click a middle marker to access the Debug menu. The illustration shows some of the features of the Debug menu. Picture 1 is a simple quadrilateral (polygon with four sides) with four horz/vert polygons inside the support polygon. Right (secondary) click the middle marker below the number and select Debug polygons | Draw this/next polygon | Entire polygons. The result is shown in picture 2. The horz/vert polygon for the current support line is blue, and the horz/vert polygon for the next support line is red. The picture shows the intersection point between the horz/vert polygons. In picture 3 (Debug polygons | Draw this/next polygon | Adjusted polygons) the part of the horz/vert polygons on the wrong side of the intersection point is cut off, and the adjusted polygons are shown. Picture 4 (Debug polygons | Show selected pixels) shows the selected pixels with a horizontal black line. View mode When you switch to View mode (click Polygon selection button or View mode button (arrow icon)), the separate horz/vert polygons along each of the oblique support lines are put together into one big closed polygon (which can be drawn with _GDIPlus_GraphicsDrawPolygon). The selected pixels are calculated from this final polygon, when you click the Copy button. Note that the middle markers are still visible, and you can drag/move the polygon around in the image. In this way you can copy/paste several different regions with the same polygon. Copy/paste Click Copy button to create a copy of the selected pixels on a white background. In the context menu for the Copy button, you can choose a red, green or blue background color. Click Paste button to paste selected pixels as a new image. The new image appears in a new tab item. In this version you can only paste the selected pixels as a new image. More details If you are interested, you can find more information about calculations and code for the following topics in posts below (I'll add the information in the course of a week, when I get my notes organized a little better.): Overview of the program progress in a flow chartHorizontal/vertical polygons along support linesCalculations related to zoom in/out issuesFinal polygon and selected pixelsForce empty line after listThis version This version is a test version to find out whether it's possible to carry out non-rectangular selections. Only functionality required for the test is coded. If you run the example in Scite, you can see a few warnings and error messages in the console. The code is not cleaned up according to double defined local variables or unused parameters in function calls (primary functions to handle windows messages). This means a lot of warnings if you run Au3Check. Zipfile The top level is the folder "Image Editor". It contains one subfolder: "2) Non-rectangular selections". The subfolder contains source and resource files. Most important source files are: Selections.au3 - run this scriptincludestoolsSelectPolygon.au3 - executes the message loop which runs when the program is in Polygon selection mode. The message loop handles drawing of the oblique support lines and responds to button clicks. In bottom of the file you find the function to draw the final polygon in View mode.includestoolsSelectPolygonFunctions1.au3 - utility functions. Functions to zoom in/out, to create the final polygon, and to extract the selected pixels.includestoolsSelectPolygonFunctions2.au3 - all functions to calculate, adjust and draw the horizontal/vertical polygons along the oblique support lines.includestoolsSelectPolygonValidations.au3 - functions to validate the oblique support lines.includestoolsSelectPolygonDebug.au3 - functions for the Debug menu.Tested with AutoIt 3.3.10 on Windows 7 32/64 bit and Windows XP 32 bit. Selections.7z This update fixes an issue. More information here. Selections2.7z
    2 points
  2. trancexx

    Ribbon

    Few years ago Microsoft introduced new UI feature that they named Ribbon. With the release of Windows 7 they added it as standard system feature. Windows Ribbon framework. You could say it's a new technology waiting to be fully embraced. Considering AutoIt is currently in some shitty stage Ribbons are not expected to be supported natively. Which is actually good thing because otherwise some developer could have GUICtrlCreateRibbon idiotic idea. Ribbons are beautiful things. In order to work with them you have to master objects. It's COM based technology. Some people will stop reading now, but really their shame. Anyway, this example is based on work by Mr. Michael Chourdakis. Guy really took deeper dive to ribbon thematic and made few very interesting articles. All is available on internet naturally, just google Michael Chourdakis Ribbon or something like that. So, the main thing to do is create so called Ribbon Framework Object. After that you have to initialize event handlers (two callback objects made with ObjectFromTag function) and load your Ribbon. Ribbon is loaded from resource, either one of your app or some other. I have compiled resource dll for this example so that scripts could be run non-compiled and still use ribbon command bar. Example shown here is not completely dummy, it uses all of the ribbon controls. Only it doesn't do anything smart besides that. ZIP: Ribbon.zip Inside the zip there is folder called Ribbon with two files RibbonExample_NEW.au3 and RibRes.dll. Extract that folder somewhere, run RibbonExample_NEW.au3 and enjoy the Ribbon beauty. There are few comments inline for easier comprehension of the overall script code. Thanks Andreik for asking for more.
    1 point
  3. I have already published a lot of AutoIt UDF about algorithm, but all of them only support 32 bits or so called X86 system. Recently I got a computer with Windows 7 64 bits, so I finally added X64 support to most of my old projects. Besides, I also added some new. For example, some compression algorithm and SHA3 Candidates. Following are the algorithms list: Checksum CRC16 CRC32 ADLER32 Compression FastLZ LZF LZMA LZMAT MiniLZO QuickLZ Encode Base64 ARC4 XXTEA DES AES Hash Checksums (CRC16/CRC32/ADLER32) MD2 MD4 MD5 SHA1 SHA2 (SHA224/256/384/512) SHA3 Candidates BLAKE BMW (Blue Midnight Wish) CUBEHASH ECHO SHABAL SKEIN Some points to mention: All of the subroutines have one or more examples to demonstrate the usage. Since the function and usage of subroutine are easy to understand. A complete subroutines and parameters list are unavailability now. Sorry for my lazy. All of the subroutines here invoked by Lazycat's method (through CallWindowProc API). My MemoryDLL UDF is not necessary this time. Although MemoryFuncCall (part of MemoryDLL) is still good, but inevitably, it is slower than CallWindowProc. Some subroutines have the same name with my old machine code version UDF. But for some reason, I rearrange the position of the parameters. Please not mix up. If you notice, yes, checksums are duplicated. But they receive different parameters. One is the old style, and another use the same interface as other hashes. Choose what you like, but don't use them in the same time. Some algorithm already supported by the standard UDF "Encryption.au3". But I still provide them, because some system lack of the full support of Windows Crypt Library. If you are looking for only one hash algorithm, for example, used in encryption, I suggested "SHABAL_TINY.au3". Although it is a bit slower then SHABAL, but it is smaller, and it supports different size of output (from 32 to 512 bits).AutoIt Machine Code Algorithm Collection.zip
    1 point
  4. Skype UDF v1.2 Introduction :Skype4COM represents the Skype API as objects, with :methodspropertieseventscollectionscachingSkype4COM provides an ActiveX interface to the Skype API. Develop for Skype in a familiar programming environment, such as Visual Studio or Delphi, using preferred scripting languages such as VBScript, PHP, or Javascript. Requirements : Skype 3.0+ must be installedWindows 2000, XP+ Update : Version 1.2 Fixed _Skype_ProfileGetHandle function Version 1.1 Fixed _Skype_ChatGetBookmarked function Added missing _Skype_ChatGetTopic function Version 1.0 Fixed _Skype_ChatGetAll function Version 0.9 Fixed Mute value returned by the _Skype_OnEventMute callback function Version 0.8 Error ObjEvent is set if none already set Version 0.7 Changed _Skype_GetChatActive to _Skype_GetChatAllActive Version 0.6 Added _Skype_GetCache Added _Skype_SetCache Changed Skype_Error function Minor bugs fixed Version 0.5 Fixed _Skype_ChatCreate Version 0.4 Fixed _Skype_ChatGetMessages Fixed "Skype - SciTE.au3" script Version 0.3 Minor changes Updated Skype in AutoIt example Version 0.2 Fixed _Skype_ChatAddMembers Various bugs fixed _Functions list : (346) Example GUI : Notes : Skype's access control must be accepted manually :After running the example script, click on the "Allow access" button of SkypeThis version is NOT complete If you are running on a 64 bits OS, add this line to your script : #AutoIt3Wrapper_UseX64=n Attachments :Pack (UDF + ExampleGUI)Version 1.2 : Skype-UDF_1.0.0.2.zip Examples : (put them into the "Example folder")-Answers to incomming calls even if you are already in a call : Auto Answer.au3-Shows how to use the OnMute event : Mute Event.au3 Happy coding
    1 point
  5. DllCall is a powerful way to use AutoIt code to run functions that were created in other languages and are stored in shared libraries outside of AutoIt. With DllCall, you can call Windows APIs directly, execute pieces of code that shipped with another vendor's product, and pass information between that code and your own script. However, DllCall is intended for the advanced user who is already familiar with how that stuff works. That definitely isn't me, and I find the process of converting variable types, handling ByRefs with odd syntax, and keeping track of return values in an array cumbersome. So I wrote a script to help me with it. It should help beginners get started with DllCall too. I was a little surprised that I didn't find something like this on the forum already. Maybe the intended audience doesn't have the same trouble that I do, or maybe those who don't "get" it don't care enough to. I'm hoping to bridge that gap a little. With this script, you can input the information from the MSDN documentation on a DLL function straight into the GUI and it will generate AutoIt code to call it and return its data. You can choose whether to report debugging information via ConsoleWrite or MsgBox or neither. It doesn't handle fancy things like DllStructs and callbacks, but it may help you get started. A great tutorial I used when I was starting to learn this stuff myself is Dealing with DLLs in AutoIt by Andreas Karlsson. My script is intended as a programmatic approximation of the concepts on pages 1 to 8 of that document. It is not a replacement for a good tutorial and self-learning. I wrote it as a shortcut for my own future use because I only wanted to learn it once. :-) Here it is. I'm curious to know what you all think. #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Library\Repositories #NO BACKUP#\Google Drive - Toastyking\Development\Snippet Library\AutoIt\CodeWizards\DllCallCodegen\FormMain.kxf $FormMain = GUICreate("DllCall Code Generator", 825, 421) $Label1 = GUICtrlCreateLabel("DLL Name", 16, 32, 55, 17) $InputDll = GUICtrlCreateInput("user32.dll", 120, 29, 121, 21) $Label2 = GUICtrlCreateLabel("Function Name", 16, 59, 76, 17) $InputFunc = GUICtrlCreateInput("", 120, 56, 121, 21) $RadioFuncAnsi = GUICtrlCreateRadio("ANSI", 256, 57, 49, 17) $RadioFuncUnicode = GUICtrlCreateRadio("Unicode", 312, 56, 73, 17) GUICtrlSetState(-1, $GUI_CHECKED) $Label3 = GUICtrlCreateLabel("Return Type", 16, 85, 63, 17) $InputReturnType = GUICtrlCreateInput("int", 120, 82, 121, 21) $ComboCallConv = GUICtrlCreateCombo("", 120, 110, 121, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "stdcall|cdecl") $ListViewParams = GUICtrlCreateListView("#|Type|Value|Method", 16, 245, 362, 126, BitOR($GUI_SS_DEFAULT_LISTVIEW,$LVS_NOSORTHEADER)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50) $Label4 = GUICtrlCreateLabel("For all types, use the type name specified on MSDN.", 16, 8, 251, 17) $Label5 = GUICtrlCreateLabel("Parameters:", 16, 136, 60, 17) $Label6 = GUICtrlCreateLabel("Type", 24, 157, 28, 17) $Label7 = GUICtrlCreateLabel("Value (0 for null)", 152, 157, 80, 17) $Label8 = GUICtrlCreateLabel("Method", 280, 157, 39, 17) $InputParamType = GUICtrlCreateInput("", 24, 176, 121, 21) $InputParamValue = GUICtrlCreateInput("", 152, 176, 121, 21) $ComboParamByref = GUICtrlCreateCombo("", 280, 176, 89, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Input/ByVal|Output/ByRef") $ButtonParamAdd = GUICtrlCreateButton("Add Parameter", 24, 213, 91, 25) $ButtonParamDelete = GUICtrlCreateButton("Clear All", 128, 213, 107, 25) $Label9 = GUICtrlCreateLabel("Calling convention", 16, 112, 91, 17) $Label10 = GUICtrlCreateLabel("Generated AutoIt code:", 409, 8, 115, 17) $EditCode = GUICtrlCreateEdit("", 408, 29, 401, 342, BitOR($ES_READONLY,$WS_HSCROLL,$WS_VSCROLL)) $ButtonTest = GUICtrlCreateButton("Test Code", 344, 381, 107, 25) $ButtonCopy = GUICtrlCreateButton("Copy to Clipboard", 464, 381, 107, 25) $ButtonInsert = GUICtrlCreateButton("Insert in SciTE", 586, 381, 107, 25) $ButtonGenonly = GUICtrlCreateButton("Nothing Else", 704, 381, 107, 25) $ComboOutput = GUICtrlCreateCombo("", 98, 383, 121, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "ConsoleWrite|MsgBox|$vDllCallReturn only") $Label11 = GUICtrlCreateLabel("Output method:", 16, 387, 77, 17) $Label12 = GUICtrlCreateLabel("Generate code and:", 232, 387, 99, 17) ;~ GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $aParams[1][3] GUICtrlSetData($ComboParamByref,"Input/ByVal") GUICtrlSetData($ComboOutput,"ConsoleWrite") GUICtrlSetData($ComboCallConv,"stdcall") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $ButtonParamAdd _ConvertType(GUICtrlRead($InputParamType)) ; Use the parameter type selected If @error Then If MsgBox(49,"Unrecognized Type","Unrecognized parameter type """ & GUICtrlRead($InputParamType) & """. Make sure you are using an MSDN return type." & @CRLF & @CRLF & "If you are certain that the parameter type is correct and you happen to know the equivalent AutoIt parameter type, click OK. You will be prompted later for the AutoIt parameter type.",0,$FormMain) = 2 Then ContinueLoop EndIf If GUICtrlRead($ComboParamByref) = "Output/ByRef" And StringLeft(GUICtrlRead($InputParamValue),1) <> "$" Then MsgBox(48,"Error","To use this parameter value as a ByRef, you must specify the name of a variable used in your AutoIt script, which must begin with a '$' symbol.",0,$FormMain) ContinueLoop EndIf ; Input seems okay; proceed. ReDim $aParams[UBound($aParams) + 1][3] ; Add a "row" to the array $aParams[UBound($aParams) - 1][0] = GUICtrlRead($InputParamType) $aParams[UBound($aParams) - 1][1] = GUICtrlRead($InputParamValue) $aParams[UBound($aParams) - 1][2] = GUICtrlRead($ComboParamByref) ; Clear input fields and refocus GUICtrlSetData($InputParamType,"") GUICtrlSetData($InputParamValue,"") GUICtrlSetData($ComboParamByref,"Input/ByVal") GUICtrlCreateListViewItem(UBound($aParams) - 1 & "|" & $aParams[UBound($aParams) - 1][0] & "|" & $aParams[UBound($aParams) - 1][1] & "|" & $aParams[UBound($aParams) - 1][2],$ListViewParams) ControlFocus($FormMain,"",$InputParamType) Case $ButtonParamDelete ; Delete all items _GUICtrlListView_DeleteAllItems($ListViewParams) ReDim $aParams[1][3] Case $ButtonTest $sDllCallOut = _GenerateCode("MsgBox") ; Always use MsgBox for output when generating for testing. GUICtrlSetData($EditCode,$sDllCallOut) If $sDllCallOut <> "" Then GUISetState(@SW_DISABLE,$FormMain) GUICtrlSetData($ButtonTest,"Executing...") FileDelete(@TempDir & "\DllCallExec.au3") FileWrite(@TempDir & "\DllCallExec.au3",$sDllCallOut); Write code to temporary file to be executed. $nExit = RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @TempDir & '\DllCallExec.au3"',@TempDir) ; Execute the temporary file. If $nExit <> 0 Then Switch $nExit Case 1 MsgBox(16,"DLL Code Generator","The AutoIt interpreter encountered an error while parsing or executing the generated code." & @CRLF & "Exit code: " & $nExit,0,$FormMain) Case Else MsgBox(16,"DLL Code Generator","There was a problem with the DllCall (possibly incorrect parameters). The AutoIt interpreter ended unexpectedly." & @CRLF & "Exit code: " & $nExit,0,$FormMain) EndSwitch EndIf GUICtrlSetData($ButtonTest,"Test Code") GUISetState(@SW_ENABLE,$FormMain) FileDelete(@TempDir & "\DllCallExec.au3") WinActivate($FormMain) EndIf Case $ButtonGenonly $sDllCallOut = _GenerateCode(GUICtrlRead($ComboOutput)) GUICtrlSetData($EditCode,$sDllCallOut) Case $ButtonCopy $sDllCallOut = _GenerateCode(GUICtrlRead($ComboOutput)) GUICtrlSetData($EditCode,$sDllCallOut) If ClipPut($sDllCallOut) Then ToolTip("Copied!") Else ToolTip("Copy failed!") EndIf Sleep(1000) ToolTip("") Case $ButtonInsert $sDllCallOut = _GenerateCode(GUICtrlRead($ComboOutput)) GUICtrlSetData($EditCode,$sDllCallOut) If ClipPut($sDllCallOut) Then ControlSend("[CLASS:SciTEWindow]","","Scintilla1","^v") Case $InputFunc If StringRight(GUICtrlRead($InputFunc),1) == "W" Then ; Check if last character of entered function name is a capital "W" GUICtrlSetState($RadioFuncUnicode,$GUI_CHECKED) Else GUICtrlSetState($RadioFuncAnsi,$GUI_CHECKED) EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GenerateCode($sOutputType = "") Local $sArch, $sReturnTypeOut, $sParamTypeOut, $sDllFuncName, $sDllCallOut, $sCmdOutStart, $sCmdOutEnd, $fOutputGen Switch $sOutputType Case "ConsoleWrite" $sCmdOutStart = 'ConsoleWrite(' $sCmdOutEnd = ' & @CRLF)' $fOutputGen = 1 Case "MsgBox" $sCmdOutStart = 'MsgBox(0,"DllCall Code Generator",' $sCmdOutEnd = ')' $fOutputGen = 1 Case Else $sCmdOutStart = "" $sCmdOutEnd = "" $fOutputGen = 0 EndSwitch If GUICtrlRead($RadioFuncAnsi) = $GUI_CHECKED Then $sArch = "a" If GUICtrlRead($RadioFuncUnicode) = $GUI_CHECKED Then $sArch = "w" $sDllFuncName = GUICtrlRead($InputDll) & "/" & GUICtrlRead($InputFunc) $sReturnTypeOut = _ConvertType(GUICtrlRead($InputReturnType)) If @error Then $sReturnTypeOut = InputBox("Unrecognized Type","Unrecognized return type """ & GUICtrlRead($InputReturnType) & """. Make sure you are using an MSDN return type." & @CRLF & @CRLF & "If you are certain that the return type is correct and you happen to know the equivalent AutoIt return type, you may enter the AutoIt return type here.","","",Default,220,Default,Default,0,$FormMain) If $sReturnTypeOut = "" Then Return SetError(1,0,"") EndIf $sReturnTypeOut = _ConvertTypeArch($sReturnTypeOut,$sArch) If GUICtrlRead($ComboCallConv) <> "stdcall" Then $sReturnTypeOut &= ':' & GUICtrlRead($ComboCallConv) $sDllCallOut = 'Local $aDllCallReturn,$vDllCallReturn' $sDllCallOut = '$aDllCallReturn = DllCall("' & GUICtrlRead($InputDll) & '","' & $sReturnTypeOut & '","' & GUICtrlRead($InputFunc) & '"' If UBound($aParams) > 1 Then For $x = 1 To UBound($aParams) - 1 $sParamTypeOut = '' $sParamTypeOut = _ConvertTypeArch(_ConvertType($aParams[$x][0]),$sArch) If $sParamTypeOut = '' Then $sParamTypeOut = InputBox("Unrecognized Type","Unrecognized parameter type """ & $aParams[$x][0] & """. Make sure you are using an MSDN parameter type." & @CRLF & @CRLF & "If you are certain that the parameter type is correct and you happen to know the equivalent AutoIt parameter type, you may enter the AutoIt parameter type here.","","",Default,220,Default,Default,0,$FormMain) If $sParamTypeOut = "" Then Return(SetError(1,0,"")) If StringRight($sParamTypeOut,1) = "*" Then $sParamTypeOut = StringTrimRight($sParamTypeOut,1) ; If the user added an asterisk to the end of the parameter type, remove it; it will be added back later if necessary. EndIf $sDllCallOut &= ',"' & $sParamTypeOut If $aParams[$x][2] = "Output/ByRef" Then $sDllCallOut &= '*' $sDllCallOut &= '","' & $aParams[$x][1] & '"' Next EndIf $sDllCallOut &= ')' & @CRLF ; Generate code to check for DllCall execution error. If $fOutputGen = 1 Then $sDllCallOut &= _ 'If @error Then' & @CRLF & _ ' Switch @error' & @CRLF & _ ' Case 1' & @CRLF & _ ' ' & $sCmdOutStart & '"DllCall error (' & $sDllFuncName & '): Unable to use the DLL file. Possibly a problem with the parameters."' & $sCmdOutEnd & @CRLF & _ ' Case 2' & @CRLF & _ ' ' & $sCmdOutStart & '"DllCall error (' & $sDllFuncName & '): Unknown return type."' & $sCmdOutEnd & @CRLF & _ ' Case 3' & @CRLF & _ ' ' & $sCmdOutStart & '"DllCall error (' & $sDllFuncName & '): Function not found in DLL file. Remember that function names are case sensitive."' & $sCmdOutEnd & @CRLF & _ ' Case 4' & @CRLF & _ ' ' & $sCmdOutStart & '"DllCall error (' & $sDllFuncName & '): Incorrect number of parameters."' & $sCmdOutEnd & @CRLF & _ ' Case 5' & @CRLF & _ ' ' & $sCmdOutStart & '"DllCall error (' & $sDllFuncName & '): Bad parameter."' & $sCmdOutEnd & @CRLF & _ ' Case Else' & @CRLF & _ ' ' & $sCmdOutStart & '"DllCall error (' & $sDllFuncName & '): Unknown/unspecified error."' & $sCmdOutEnd & @CRLF & _ ' EndSwitch' & @CRLF & _ ' $vDllCallReturn = ""' & @CRLF & _ 'Else' & @CRLF If $fOutputGen = 1 Then $sDllCallOut &= ' ' $sDllCallOut &= '$vDllCallReturn = $aDllCallReturn[0]' & @CRLF ; Generate code to assign returned ByRef values back to their AutoIt variables. If UBound($aParams) > 1 Then For $x = 1 To UBound($aParams) - 1 If $aParams[$x][2] = "Output/ByRef" Then If $fOutputGen = 1 Then $sDllCallOut &= ' ' $sDllCallOut &= $aParams[$x][1] & ' = $aDllCallReturn[' & $x & ']' & @CRLF EndIf Next EndIf ; Generate code to output values of the variables passed to the DllCall via ByRef. If $fOutputGen = 1 Then $sDllCallOut &= ' ' & $sCmdOutStart If UBound($aParams) > 1 Then For $x = 1 To UBound($aParams) - 1 If $aParams[$x][2] = "Output/ByRef" Then $sDllCallOut &= '"' & $aParams[$x][1] & ' = " & ' & $aParams[$x][1] & ' & @CRLF & ' EndIf Next EndIf $sDllCallOut &= '"DllCall return value: " & $vDllCallReturn' & $sCmdOutEnd & @CRLF $sDllCallOut &= "EndIf" & @CRLF EndIf Return $sDllCallOut EndFunc ; Convert the MSDN variable type to AutoIt variable type Func _ConvertType($MSDN_Type) Switch $MSDN_Type Case 'ATOM' Return 'WORD' Case 'BOOL' Return 'BOOL' Case 'BOOLEAN' Return 'BOOLEAN' Case 'BYTE' Return 'BYTE' Case 'CHAR' Return 'str' Case 'COLORREF' Return 'DWORD' Case 'CONST' Return 'const' Case 'DWORD' Return 'DWORD' Case 'DWORDLONG' Return 'ULONG' Case 'DWORD_PTR' Return 'DWORD_PTR' Case 'DWORD32' Return 'UINT' Case 'DWORD64' Return 'INT64' Case 'FLOAT' Return 'FLOAT' Case 'HACCEL' Return 'HANDLE' Case 'HALF_PTR' Return 'ptr' Case 'HANDLE' Return 'HANDLE' Case 'HBITMAP' Return 'HANDLE' Case 'HBRUSH' Return 'HANDLE' Case 'HCONV' Return 'HANDLE' Case 'HCONVLIST' Return 'HANDLE' Case 'HCURSOR' Return 'HICON' Case 'HDC' Return 'HANDLE' Case 'HDDEDATA' Return 'HANDLE' Case 'HDESK' Return 'HANDLE' Case 'HDROP' Return 'HANDLE' Case 'HDWP' Return 'HANDLE' Case 'HENHMETAFILE' Return 'HANDLE' Case 'HFILE' Return 'int' Case 'HFONT' Return 'HANDLE' Case 'HGIDOBJ' Return 'HANDLE' Case 'HGLOBAL' Return 'HANDLE' Case 'HHOOK' Return 'HANDLE' Case 'HICON' Return 'HANDLE' Case 'HINSTANCE' Return 'HANDLE' Case 'HKEY' Return 'HANDLE' Case 'HKL' Return 'HANDLE' Case 'HLOCAL' Return 'HANDLE' Case 'HMENU' Return 'HANDLE' Case 'HMETAFILE' Return 'HANDLE' Case 'HMODULE' Return 'HANDLE' Case 'HMONITOR' Return 'HANDLE' Case 'HPALETTE' Return 'HANDLE' Case 'HPEN' Return 'HANDLE' Case 'HRESULT' Return 'LONG' Case 'HRGN' Return 'HANDLE' Case 'HRSRC' Return 'HANDLE' Case 'HSZ' Return 'HANDLE' Case 'HWINSTA' Return 'HANDLE' Case 'HWND' Return 'HWND' Case 'INT_PTR' Return 'INT_PTR' Case 'INT32' Return 'int' Case 'INT' Return 'int' Case 'INT64' Return 'INT64' Case 'LANGID' Return 'WORD' Case 'LARGE_INTEGER' Return 'INT64' Case 'LCID' Return 'DWORD' Case 'LGRPID' Return 'DWORD' Case 'LONG' Return 'LONG' Case 'LONGLONG' Return 'INT64' Case 'LONG_PTR' Return 'LONG_PTR' Case 'LONG32' Return 'int' Case 'LONG64' Return 'INT64' Case 'LPARAM' Return 'LPARAM' Case 'LPBOOL' Return 'int' Case 'LPBYTE' Return 'int' Case 'LPCOLORREF' Return 'DWORD' Case 'LPCSTR' Return 'str' Case 'LPCTSTR' Return 'str' Case 'LPCWSTR' Return 'wstr' Case 'LPDWORD' Return 'DWORD' Case 'LPHANDLE' Return 'HANDLE' Case 'LPINT' Return 'int' Case 'LPLONG' Return 'long' Case 'LPSTR' Return 'str' Case 'LPTSTR' Return 'str' Case 'LPVOID' Return 'ptr' Case 'LPWORD' Return 'WORD' Case 'LPWSTR' Return 'wstr' Case 'LRESULT' Return 'LRESULT' Case 'PBOOL' Return 'BOOL' Case 'PBOOLEAN' Return 'BOOLEAN' Case 'PBYTE' Return 'BYTE' Case 'PCHAR' Return 'str' Case 'PCSTR' Return 'str' Case 'PCTSTR' Return 'str' Case 'PCWSTR' Return 'wstr' Case 'PDWORD' Return 'DWORD' Case 'PDWORDLONG' Return 'UINT64' Case 'PDWORD_PTR' Return 'DWORD_PTR' Case 'PDWORD32' Return 'UINT' Case 'PDWORD64' Return 'INT64' Case 'PFLOAT' Return 'FLOAT' Case 'PHALF_PTR' Return 'ptr' Case 'PHANDLE' Return 'HANDLE' Case 'PHKEY' Return 'HANDLE' Case 'PINT' Return 'int' Case 'PINT_PTR' Return 'INT_PTR' Case 'PINT32' Return 'int' Case 'PINT64' Return 'INT64' Case 'PLCID' Return 'DWORD' Case 'PLONG' Return 'LONG' Case 'PLONGLONG' Return 'INT64' Case 'PLONG_PTR' Return 'LONG_PTR' Case 'PLONG32' Return 'long' Case 'PLONG64' Return 'INT64' Case 'POINTER_32' Return 'ptr' Case 'POINTER_64' Return 'ptr' Case 'POINTER_SIGNED' Return 'ptr' Case 'POINTER_UNSIGNED' Return 'ULONG_PTR' Case 'PSHORT' Return 'SHORT' Case 'PSIZE_T' Return 'ULONG_PTR' Case 'PSSIZE_T' Return 'LONG_PTR' Case 'PSTR' Return 'str' Case 'PTBYTE' Return 'BYTE' Case 'PTCHAR' Return 'wstr' Case 'PTSTR' Return 'wstr' Case 'PUCHAR' Return 'BYTE' Case 'PUHALF_PTR' Return 'ptr' Case 'PUINT' Return 'UINT' Case 'PUINT_PTR' Return 'UINT_PTR' Case 'PUINT32' Return 'UINT' Case 'PUINT64' Return 'UINT64' Case 'PULARGE_INTEGER' Return 'UINT64' Case 'PULONG' Return 'ULONG' Case 'PULONGLONG' Return 'UINT64' Case 'PULONG_PTR' Return 'ULONG_PTR' Case 'PULONG32' Return 'ULONG' Case 'PULONG64' Return 'UINT64' Case 'PUSHORT' Return 'USHORT' Case 'PVOID' Return 'ptr' Case 'PWCHAR' Return 'wstr' Case 'PWORD' Return 'WORD' Case 'PWSTR' Return 'wstr' Case 'SC_HANDLE' Return 'HANDLE' Case 'SC_LOCK' Return 'ptr' Case 'SERVICE_STATUS_HANDLE' Return 'HANDLE' Case 'SHORT' Return 'SHORT' Case 'SIZE_T' Return 'ULONG_PTR' Case 'SSIZE_T' Return 'LONG_PTR' Case 'TBYTE' Return 'wstr' Case 'TCHAR' Return 'wstr' Case 'UCHAR' Return 'BYTE' Case 'UHALF_PTR' Return 'ptr' Case 'UINT' Return 'UINT' Case 'UINT_PTR' Return 'UINT_PTR' Case 'UINT32' Return 'UINT' Case 'UINT64' Return 'UINT64' Case 'ULARGE_INTEGER' Return 'UINT64' Case 'ULONG' Return 'ULONG' Case 'ULONGLONG' Return 'UINT64' Case 'ULONG_PTR' Return 'ULONG_PTR' Case 'ULONG32' Return 'ULONG' Case 'ULONG64' Return 'UINT64' Case 'UNICODE_STRING' Return 'ptr' Case 'USHORT' Return 'USHORT' Case 'USN' Return 'INT64' Case 'VOID' Return 'none' Case 'WCHAR' Return 'wstr' Case 'WORD' Return 'WORD' Case 'WPARAM' Return 'WPARAM' Case Else SetError(1) Return "" EndSwitch EndFunc ;==> ; Some variable types should be converted from their ANSI to Unicode types or vice versa. Func _ConvertTypeArch($MSDN_Type,$sArch) Switch $MSDN_Type Case 'STR' If $sArch = "a" Then Return "str" If $sArch = "w" Then Return "wstr" Case 'WSTR' If $sArch = "a" Then Return "str" If $sArch = "w" Then Return "wstr" Case Else Return $MSDN_Type EndSwitch EndFunc Here is an example: Function: GetDiskFreeSpaceW (MSDN page: http://msdn.microsoft.com/en-us/library/aa364935(VS.85).aspx) Input this: Click Test Code, and get this: Click Insert in SciTE to insert the code into your script. Updated 2014/01/28: Edit 2015/11/25: Fixed broken link
    1 point
  6. <gasp> Lesson #1 : always read the helpfile
    1 point
  7. #include <Array.au3> Local $array = ["thing1-08", "thing2-09", "thing3-07", "thing4-05", "thing5-10"] _MixArray($array) _ArraySort($array) _MixArray($array) _ArrayDisplay($array) MsgBox(0, "", $array[0]) Func _MixArray(ByRef $array) For $i = 0 To UBound($array) - 1 $array[$i] = StringRegExpReplace($array[$i], "(.*)(-)(.*)", "$3$2$1") Next EndFunc But you are right, this array trouble is strange indeed
    1 point
  8. knucklesCZ, This is one way of doing it: #include <Array.au3> Local $array = ["thing1-08", "thing2-09", "thing3-07", "thing4-05", "thing5-10"] ; Add a new column _ArrayColInsert($array, 1) For $i = 0 To UBound($array) - 1 ; Extract numeric part and add to new column $array[$i][1] = StringRegExpReplace($array[$i][0], ".*-(.*)", "$1") Next _ArrayDisplay($array, "Col added", Default, 8) ; Sort on the number column _ArraySort($array, Default, Default, Default, 1) _ArrayDisplay($array, "Sorted", Default, 8) ; Delete the column _ArrayColDelete($array, 1) _ArrayDisplay($array, "Col deleted", Default, 8) M23
    1 point
  9. Tsiyoshi, @ScriptDir does not have a trailing " " so you need to add it yourself: $aDate = FileGetTime($sRoot & "\" & $aList[$i], 0, 0) M23
    1 point
  10. water

    Blocks appearing order

    Show us your script and we will do our best to tell you how to solve your problem.
    1 point
  11. or add the one line to turn redirection off...I dont think that burden falls on the function though, if the user is going to play with syswow and sys32 stuff then the user should turn redirection off, as many other functions will behave unexpectedly in similar fashion. DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) Run("C:\Windows\System32\notepad.exe") Run("C:\Windows\SysWOW64\notepad.exe") sleep(2500) _ProcessCloseByPath("C:\Windows\SysWOW64\notepad.exe") Func _ProcessCloseByPath($sPath) $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\ROOT\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT ExecutablePath,ProcessId FROM Win32_Process WHERE ExecutablePath = " & '"' & stringreplace($sPath, "\" , "\\") & '"', "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $sPID = $objItem.ProcessId processclose($sPID) Next Endif EndFunc
    1 point
  12. Melba23

    GUISetState Doubt

    TheDcoder, The edit box is a control, not a GUI - so try this: $GUI = GUICreate("Test") $edit_box = GUICtrlCreateEdit("Test", -1, -1) GUICtrlSetState($edit_box, $GUI_DISABLE) ; Now the edit control is disabled GUISetState(@SW_SHOW, $GUI) M23
    1 point
  13. RTFC

    Changing languages (Visual C)

    Hi McLEMUR, A decent starting point with lots of simple examples is http://www.cplusplus.com/doc/tutorial/, or try https://www.learncpp.com/ Two other reference sites I've found useful in the past are http://en.cppreference.com/w/cpp and http://www.java2s.com/Tutorial/Cpp/CatalogCpp.htm But coming from AutoIt, diving into C++ will be an uphill struggle (if you'll forgive me the metaphor mixing ). There is a lot of basic functionality that you'd expect any sophisticated language to have (*cough* garbage collection *cough*), that you'll either have to add yourself or find a good library for. An immense help for me has been the (free!) Boost libraries, see http://www.boost.org/, (and tutorials I found here, although I didn't use these much myself). Boost has really saved me acres of time, and it's quite intuitive to use. You'll need plenty of perseverance though, and think of your C++ compiler as simultaneously retarded and autistic. Every typo will likely crash your code, and the error messages you get may have nothing whatsoever to do with what actually went wrong, or be so generic that they don't help you. Of course, there's always http://stackoverflow.com/ if when you get stuck, but in my experience, some C++ forum members take on some of the same attributes as C++ compilers, i.e., being unforgiving towards beginners. Just google "I hate C++" to get an idea of what people run up against in your position. On second thought, maybe you'd better not, to remain motivated. Personally, I use C++ only for tasks that require speed and a reasonably high-level of complexity (CUDA interfacing in parallel computing, matrix computing with Eigen), but user-friendly it ain't, nor will it ever be. Can't really tell you much about the transition from AutoIt, because I started from the other end (Assembly), so it was more a question of mapping the concepts used there onto the C++ framework. I fear that coming from AutoIt, it'll be much harder. As far as compilers are concerned, CodeBlocks is much easier to start with, but at some point you'll run into situations where you'll need the extra control of literally hundreds of compiler/linker settings that MSVC offers. So you either start easy and have the extra pain of switching later, or bite the bullet now (although these newer versions of MSVC are more user-friendly than the earlier stuff). Hope it works out for you (but please do not PM me if you get stuck, okay? )
    1 point
  14. Not sure what exactly you are looking for. Is this something to automate through AutoIt3? Manually: In the left-bottom of the SciTE window you find the currentline and Ctrl+G will bring up a Goto window. Jos
    1 point
  15. Malkey

    Regex / SRE conditional

    Here is another way. #include <Array.au3> $tex = 'Alice has $200' & @CRLF & 'Bob has $10' & @CRLF & 'John has null' $x = StringRegExp($tex, '(?i).+\hhas\h(?!null).+', 3) _ArrayDisplay($x)
    1 point
  16. jguinch

    Regex / SRE conditional

    It seems you don't need a conditional pattern for this. Just use (?m) and capture values from line containing a price $d+ at the end of line #Include <Array.au3> $sString = "Alice has $200" & @CRLF & _ "Bob has $10" & @CRLF & _ "John has null" $aValues = StringRegExp($sString, "(?im)^([a-z-]+).*\$(\d+)", 3) Local $aResult[UBound($aValues) / 2][2] For $i = 0 To UBound($aValues) - 1 Step 2 $aResult[$i / 2][0] = $aValues[$i] $aResult[$i / 2][1] = $aValues[$i + 1] Next _ArrayDisplay($aResult)
    1 point
  17. nice. rejects: 1) list displays element [0] which is the items count. 2) string is inserted at caret position, which may be even middle of a line if users are not actually bothering to place it where they want. suggestion: make it jump to top, or detect the last #include and insert after it. (i did something similar for the >LFN UDF script converter).
    1 point
  18. I've seen a few questions since I've been back on how to handle IE events. I've answered a couple, but the last time I answered one, they said it looked complicated. So here's an attempt to help them and others easily track html document events (basic, 2, 3, and 4). There are links within the source to msdn explaining the events they capture. I've provided two "simple" examples. Things to note: When doing these, since they are callback methods, I wanted to treat them like we would GUIRegisterMsg a bit. So the 3 params you'll have to have in your event handler (if you don't use the internal) are (names can be different, but the data will be specific when sent to it). Param1: Event object variable Param2: Target object variable (target is: object.currentTarget, object.Target, object.srcElement if you're wondering) Param3: Type variable (to hold a string) Take a look at the example if you have questions. As always, if you see something that could be better or added let me know. Changes: ; B0.0.2 Fixed: Error for include in examples ; B0.0.2 Fixed: Missing volatile functions (Major) Downloads: 2015-01-03 HTMLDocumentEvents.B001.zip 2015-01-04 HTMLDocumentEvents.B002.zip
    1 point
  19. Hi all, I got bored so I decided to rewrite Mike Singleton / Postern's excellent 1983 Spectrum game Snake Pit. It's a fairly faithful recreation with a couple of minor tweaks over the original. All the assets are embedded into the script so there are no extra files required. Credit to UEZ for the File to Base64 String functions and for _GDIPlus_ScaleImage and to Tom Vernooij for _ArrayRandom. The code is way to large for a code box so I'll just attach the file. Comments welcome but I probably won't be spending much time improving any of the multitude of inefficiencies. I'm not a programmer, I'm more of a fiddler so don't expect to see best practices for variable/function naming or just about anything else. Known bugs. Occasionally pressing 'S' to restart doesn't work correctly, I can't be bothered to fix it so just press 'S' again. Speed is inconsistent. I tried to dynamically adjust the sleep but just made it worse. Object of game: While $playerAlive = True AvoidSnakes() Eat Eggs($lotsOf) EatSnakesStartingFromTail() IncreaseSpeedAndStartAgain() WEnd Enjoy! SnakePit.au3
    1 point
  20. To post code on the forum, please use the following procedure: Click the Code button on the editor toolbar. Select the code type (for most people this will either be AutoIt or Plain Text - AutoIt is the default) Paste or type your code and then click OK.
    1 point
  21. AZJIO

    Themes for SciTE

    Themes Notepad++ > to > Themes SciTE $key=1 ; если 1, то тема копируется в папку пользователя и перезапуск скайта отобразит новую тему. Если 0 то тема создаётся в виде конфига в папке темы, который нужно переместить в папку конфигуратора тем скайта. If FileExists(@ProgramFilesDir&'Notepad++themes') Then $WorkingDir=@ProgramFilesDir&'Notepad++themes' Else $WorkingDir=@WorkingDir EndIf $OpenFile = FileOpenDialog('Открыть', $WorkingDir , "Themes (*.xml)") If @error Then Exit $file = FileOpen($OpenFile, 0) $text1 = FileRead($file) FileClose($file) $text=StringRegExpReplace($text1,'(?s)(^.*)(e="autoit".*?</Le)(.*)$','2') $DEFAULT=StringRegExpReplace($text,'(?s)(.*?"DEFAULT".*?fgColor=")(w{6})(.*)','2') $COMMENT_LINE=StringRegExpReplace($text,'(?s)(.*?"COMMENT LINE".*?fgColor=")(w{6})(.*)','2') $COMMENT=StringRegExpReplace($text,'(?s)(.*?"COMMENT".*?fgColor=")(w{6})(.*)','2') $NUMBER=StringRegExpReplace($text,'(?s)(.*?"NUMBER".*?fgColor=")(w{6})(.*)','2') $FUNCTION=StringRegExpReplace($text,'(?s)(.*?"FUNCTION".*?fgColor=")(w{6})(.*)','2') $INSTRUCTION_WORD=StringRegExpReplace($text,'(?s)(.*?"INSTRUCTION WORD".*?fgColor=")(w{6})(.*)','2') $MACRO=StringRegExpReplace($text,'(?s)(.*?"MACRO".*?fgColor=")(w{6})(.*)','2') $STRING=StringRegExpReplace($text,'(?s)(.*?"STRING".*?fgColor=")(w{6})(.*)','2') $OPERATOR=StringRegExpReplace($text,'(?s)(.*?"OPERATOR".*?fgColor=")(w{6})(.*)','2') $VARIABLE=StringRegExpReplace($text,'(?s)(.*?"VARIABLE".*?fgColor=")(w{6})(.*)','2') $SENT=StringRegExpReplace($text,'(?s)(.*?"SENT".*?fgColor=")(w{6})(.*)','2') $PREPROCESSOR=StringRegExpReplace($text,'(?s)(.*?"PREPROCESSOR".*?fgColor=")(w{6})(.*)','2') $SPECIAL=StringRegExpReplace($text,'(?s)(.*?"SPECIAL".*?fgColor=")(w{6})(.*)','2') $EXPAND=StringRegExpReplace($text,'(?s)(.*?"EXPAND".*?fgColor=")(w{6})(.*)','2') $COMOBJ=StringRegExpReplace($text,'(?s)(.*?"COMOBJ".*?fgColor=")(w{6})(.*)','2') $BG=StringRegExpReplace($text,'(?s)(.*?bgColor=")(w{6})(.*)','2') If StringLen($DEFAULT)>6 Then $DEFAULT=0 If StringLen($COMMENT_LINE)>6 Then $COMMENT_LINE=0 If StringLen($COMMENT)>6 Then $COMMENT=0 If StringLen($NUMBER)>6 Then $NUMBER=0 If StringLen($FUNCTION)>6 Then $FUNCTION=0 If StringLen($INSTRUCTION_WORD)>6 Then $INSTRUCTION_WORD=0 If StringLen($MACRO)>6 Then $MACRO=0 If StringLen($STRING)>6 Then $STRING=0 If StringLen($OPERATOR)>6 Then $OPERATOR=0 If StringLen($VARIABLE)>6 Then $VARIABLE=0 If StringLen($SENT)>6 Then $SENT=0 If StringLen($PREPROCESSOR)>6 Then $PREPROCESSOR=0 If StringLen($SPECIAL)>6 Then $SPECIAL=0 If StringLen($EXPAND)>6 Then $EXPAND=0 If StringLen($COMOBJ)>6 Then $COMOBJ=0 If StringLen($BG)>6 Then $BG=0 $text=StringRegExpReplace($text1,'(?s)(^.*)(<GlobalStyles>.*?</GlobalStyles>)(.*)$','2') $Selected_text_colour=StringRegExpReplace($text,'(?s)(.*?"Selected text colour".*?fgColor=")(w{6})(.*)','2') $Selected_text_colourBg=StringRegExpReplace($text,'(?s)(.*?"Selected text colour".*?bgColor=")(w{6})(.*)','2') $Fold_marginBg=StringRegExpReplace($text,'(?s)(.*?"Fold margin".*?bgColor=")(w{6})(.*)','2') $Fold_margin=StringRegExpReplace($text,'(?s)(.*?"Fold margin".*?fgColor=")(w{6})(.*)','2') $Caret_colour=StringRegExpReplace($text,'(?s)(.*?"Caret colour".*?fgColor=")(w{6})(.*)','2') $Line_number_margin=StringRegExpReplace($text,'(?s)(.*?"Line number margin".*?fgColor=")(w{6})(.*)','2') $Line_number_marginBg=StringRegExpReplace($text,'(?s)(.*?"Line number margin".*?bgColor=")(w{6})(.*)','2') $Current_line_background_colourBg=StringRegExpReplace($text,'(?s)(.*?"Current line background colour".*?bgColor=")(w{6})(.*)','2') $Brace_highlight_style=StringRegExpReplace($text,'(?s)(.*?"Brace highlight style".*?fgColor=")(w{6})(.*)','2') $Brace_highlight_styleBg=StringRegExpReplace($text,'(?s)(.*?"Brace highlight style".*?bgColor=")(w{6})(.*)','2') $Global_overrideFN=StringRegExpReplace($text,'(?s)(.*?"Global override".*?fontName=")([0-9a-zA-Z_ ]+?)(".*)','2') $Global_overrideFS=StringRegExpReplace($text,'(?s)(.*?"Global override".*?fontSize=")(d+)(".*)','2') If StringLen($Selected_text_colour)>6 Then $Selected_text_colour=0 If StringLen($Selected_text_colourBg)>6 Then $Selected_text_colourBg=0 If StringLen($Fold_marginBg)>6 Then $Fold_marginBg=0 If StringLen($Fold_margin)>6 Then $Fold_margin=0 If StringLen($Caret_colour)>6 Then $Caret_colour=0 If StringLen($Line_number_margin)>6 Then $Line_number_margin=0 If StringLen($Line_number_marginBg)>6 Then $Line_number_marginBg=0 If StringLen($Current_line_background_colourBg)>6 Then $Current_line_background_colourBg=0 If StringLen($Brace_highlight_style)>6 Then $Brace_highlight_style=0 If StringLen($Brace_highlight_styleBg)>6 Then $Brace_highlight_styleBg=0 If StringLen($Global_overrideFN)>30 Then $Global_overrideFN='Arial' If StringLen($Global_overrideFS)>2 Then $Global_overrideFS=10 $text= _ '#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#' & @CRLF & _ '# START: DO NOT CHANGE ANYTHING AFTER THIS LINE #-#-#-#-#' & @CRLF & _ '# Created by SciTEConfig' & @CRLF & _ '#------------------------------------------------------------' & @CRLF & _ 'font.base=font:'&$Global_overrideFN&',size:'&$Global_overrideFS&',$(font.override)' & @CRLF & _ 'font.monospace=font:'&$Global_overrideFN&',size:'&$Global_overrideFS & @CRLF & _ 'proper.case=0' & @CRLF & _ 'check.updates.scite4autoit3=0' & @CRLF & _ 'use.tabs=1' & @CRLF & _ 'indent.size=4' & @CRLF & _ 'indent.size.*.au3=4' & @CRLF & _ 'tabsize=4' & @CRLF & _ '#Background' & @CRLF & _ 'style.au3.32=style.*.32=$(font.base),back:#'&$BG & @CRLF & _ '# Brace highlight' & @CRLF & _ 'style.au3.34=fore:#'&$Brace_highlight_style&',back:#'&$Brace_highlight_styleBg&'' & @CRLF & _ '# Brace incomplete highlight' & @CRLF & _ 'style.au3.35=fore:#'&$COMMENT_LINE&',italics,back:#'&$BG & @CRLF & _ @CRLF & _ '# Line Number Margin - колонка номеров строк' & @CRLF & _ 'style.au3.33=fore:#'&$Line_number_margin&',back:#'&$Line_number_marginBg&',$(font.base)' & @CRLF & _ 'style.au3.37=fore:#'&$Line_number_margin&',back:#'&$Line_number_marginBg&'' & @CRLF & _ '#line.margin.visible=1' & @CRLF & _ 'line.margin.width=1+' & @CRLF & _ @CRLF & _ '# Колонка плюсиков для разворачивания блоков' & @CRLF & _ 'fold.margin.colour=#'&$Fold_margin & @CRLF & _ 'fold.margin.highlight.colour=#'&$Fold_marginBg & @CRLF & _ '#fold.compact=0' & @CRLF & _ @CRLF & _ '# Мигающий курсор' & @CRLF & _ 'caret.fore=#'&$Caret_colour & @CRLF & _ 'caret.line.back=#'&$Current_line_background_colourBg&'' & @CRLF & _ '#caret.width=2' & @CRLF & _ '#caret.line.back.alpha=100' & @CRLF & _ @CRLF & _ '# Выделенная область курсором' & @CRLF & _ 'selection.fore=#'&$STRING & @CRLF & _ 'selection.back=#'&$Selected_text_colourBg & @CRLF & _ '# selection.alpha=75' & @CRLF & _ @CRLF & _ '# Вертикальная линия справа, edge.mode=0 убирает эту линию, edge.column - отступ слева до линии' & @CRLF & _ 'edge.colour=#'&$Line_number_margin & @CRLF & _ 'edge.mode=0' & @CRLF & _ '#edge.column=500' & @CRLF & _ @CRLF & _ '#Console - запись в консоль при выполнении скрипта по F5' & @CRLF & _ 'style.errorlist.32=back:#'&$BG&',$(font.monospace)' & @CRLF & _ 'style.errorlist.0=fore:#'&$STRING & @CRLF & _ 'style.errorlist.5=fore:#000000' & @CRLF & _ 'style.errorlist.3=fore:#'&$OPERATOR & @CRLF & _ 'style.errorlist.4=fore:#'&$FUNCTION & @CRLF & _ 'style.errorlist.11=fore:#'&$COMMENT & @CRLF & _ 'style.errorlist.12=fore:#'&$SENT & @CRLF & _ 'error.marker.fore=fore:#ff0000,italics,back:#'&$BG & @CRLF & _ 'colour.error=fore:#ff0000,back:#'&$OPERATOR $text&= @CRLF & _ '#White space' & @CRLF & _ 'style.au3.0=fore:#'&$DEFAULT&',back:#'&$BG & @CRLF & _ '#Comment line' & @CRLF & _ 'style.au3.1=fore:#'&$COMMENT_LINE&',italics,back:#'&$BG & @CRLF & _ '#Comment block' & @CRLF & _ 'style.au3.2=fore:#'&$COMMENT&',italics,back:#'&$BG & @CRLF & _ '#Number' & @CRLF & _ 'style.au3.3=fore:#'&$NUMBER&',back:#'&$BG & @CRLF & _ '#Function' & @CRLF & _ 'style.au3.4=fore:#'&$FUNCTION&',back:#'&$BG & @CRLF & _ '#Keyword' & @CRLF & _ 'style.au3.5=fore:#'&$INSTRUCTION_WORD&',back:#'&$BG & @CRLF & _ '#Macro' & @CRLF & _ 'style.au3.6=fore:#'&$MACRO&',back:#'&$BG & @CRLF & _ '#String' & @CRLF & _ 'style.au3.7=fore:#'&$STRING&',back:#'&$BG & @CRLF & _ '#Operator' & @CRLF & _ 'style.au3.8=fore:#'&$OPERATOR&',back:#'&$BG & @CRLF & _ '#Variable' & @CRLF & _ 'style.au3.9=fore:#'&$VARIABLE&',back:#'&$BG & @CRLF & _ '#Sent keys' & @CRLF & _ 'style.au3.10=fore:#'&$SENT&',bold,back:#'&$BG & @CRLF & _ '#Pre-Processor' & @CRLF & _ 'style.au3.11=fore:#'&$PREPROCESSOR&',back:#'&$BG & @CRLF & _ '#Special' & @CRLF & _ 'style.au3.12=fore:#'&$SPECIAL&',back:#'&$BG & @CRLF & _ '#Abbrev-Expand' & @CRLF & _ 'style.au3.13=fore:#'&$EXPAND&',bold,back:#'&$BG & @CRLF & _ '#Com Objects' & @CRLF & _ 'style.au3.14=fore:#'&$COMOBJ&',bold,back:#'&$BG & @CRLF & _ '#Standard UDF''s' & @CRLF & _ 'style.au3.15=fore:#'&$DEFAULT&',back:#'&$BG If $key Then $file = FileOpen(@UserProfileDir&'SciTEUser.properties', 2) FileWrite($file, $text) FileClose($file) Else $file = FileOpen($WorkingDir&''&StringRegExpReplace($OpenFile, '(^.*)(.*).(.*)$', '2')&'.SciTEConfig', 2) FileWrite($file, $text) FileClose($file) EndIf
    1 point
×
×
  • Create New...