Leaderboard
Popular Content
Showing content with the highest reputation on 01/30/2024 in all areas
-
queensoft, I wish all the UDF problems were solved by the OP! M233 points
-
Hi Folks. I've written this UDF based on a scipt of Christian Korittke with which you can write a string in a PDF file. You can specify some format of the PDF like font size and type, spacing to the edge a.s.o. Further functions like exact coordinates of the string in the PDF will be included soon. Would you please test it and give feedback to me so I can fix errors and enhance the function? ; Function Name: _StringToPDF() ; Description: Create PDF File ; Parameter(s): $Text - Text in the PDF (I love Autoit) ; $File - Path and Filename of the PDF (c:\Test.pdf) ; $Size - Papersize A4 or A3 ; $Rand_x - Spacing between the text and the vertical edges, Default 20 ; $Rand_y - Spacing between the text and the horizontal edges, Default 24 ; $Schriftart - Fonts (Times-Roman, Helvetica and Courier), Default Courier ; $Fett - Value if the font is bold, Default 0 (normal) ; $Kursiv - Value if the font is italic, Default 0 (normal) ; $Schrift - Size of the font, Default 12 ; $Autor - Name of the autor, Default "unknown" ; $Titel - Title of the PDF, Default "MyPDF" ; ; Author(s): Christian Korittke <Christian_Korittke@web.de> ; Tamer Hosgör <Tamer@TamTech.info> Func _StringToPDF ( $Text, $File, $Size="A4", $Rand_x=20, $Rand_y=24, $Schriftart="Courier", $Fett=0, $Kursiv=0, $Schrift=12, $Autor="unknown", $Titel="MyPDF") If $Size = "A4" Then $Size_x = 210 $Size_y = 297 ElseIf $Size = "A3" Then $Size_x = 420 $Size_y = 297 EndIf $Zeilen = 1 If $Fett = 1 Or $Kursiv = 1 Then If $Schriftart = "Times-Roman" Then If $Fett = 1 Then $Schriftart = "Times-Bold" ElseIf $Kursiv = 1 Then $Schriftart = "Times-Italic" EndIf If $Fett = 1 And $Kursiv = 1 Then $Schriftart = "Times-BoldItalic" ElseIf $Schriftart = "Helvetica" Then If $Fett = 1 Then $Schriftart = "Helvetica-Bold" ElseIf $Kursiv = 1 Then $Schriftart = "Helvetica-Oblique" EndIf If $Fett = 1 And $Kursiv = 1 Then $Schriftart = "Helvetica-BoldOblique" Else If $Fett = 1 Then $Schriftart = "Courier-Bold" ElseIf $Kursiv = 1 Then $Schriftart = "Courier-Oblique" EndIf If $Fett = 1 And $Kursiv = 1 Then $Schriftart = "Courier-BoldOblique" EndIf EndIf If $Schrift = 8 Then $Abstand = 9 ElseIf $Schrift = 9 Then $Abstand = 11 ElseIf $Schrift = 10 Then $Abstand = 12 ElseIf $Schrift = 11 Then $Abstand = 13 ElseIf $Schrift = 12 Then $Abstand = 15 ElseIf $Schrift = 14 Then $Abstand = 17 ElseIf $Schrift = 16 Then $Abstand = 19 ElseIf $Schrift = 18 Then $Abstand = 21 ElseIf $Schrift = 20 Then $Abstand = 24 ElseIf $Schrift = 22 Then $Abstand = 26 ElseIf $Schrift = 24 Then $Abstand = 28 ElseIf $Schrift = 26 Then $Abstand = 30 ElseIf $Schrift = 28 Then $Abstand = 32 ElseIf $Schrift = 36 Then $Abstand = 41 ElseIf $Schrift = 48 Then $Abstand = 55 EndIf If Not StringInStr($Text,@CRLF) = 0 Then $Text = StringSplit($Text,@CRLF) $Zeilen = $Text[0] / 2 + 1 EndIf ; Umrechnung $Wert = 2.834175 $Size_y = Round($Size_y * $Wert) $Size_x = Round($Size_x * $Wert) $Rand_x = Round($Rand_x * $Wert) $Rand_y = Round($Rand_y * $Wert) FileWriteLine($File,"%PDF-1.2") FileWriteLine($File,"%âãÏÓ") FileWriteLine($File,"1 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Author ("&$Autor&")") FileWriteLine($File,"/CreationDate (D:"&@YEAR&@MON&@MDAY&@HOUR&@MIN&@SEC&")") FileWriteLine($File,"/Creator (Ahnungslos)") FileWriteLine($File,"/Producer (Ahnungslos)") FileWriteLine($File,"/Title ("&$Titel&")") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"4 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Type /Font") FileWriteLine($File,"/Subtype /Type1") FileWriteLine($File,"/Name /F1") FileWriteLine($File,"/Encoding 5 0 R") FileWriteLine($File,"/BaseFont /"&$Schriftart) FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"5 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Type /Encoding") FileWriteLine($File,"/BaseEncoding /WinAnsiEncoding") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"6 0 obj") FileWriteLine($File,"<<") FileWriteLine($File," /Font << /F1 4 0 R >>") FileWriteLine($File," /ProcSet [ /PDF /Text ]") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"7 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Type /Page") FileWriteLine($File,"/Parent 3 0 R") FileWriteLine($File,"/Resources 6 0 R") FileWriteLine($File,"/Contents 8 0 R") FileWriteLine($File,"/Rotate 0") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"8 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Length 9 0 R") FileWriteLine($File,">>") FileWriteLine($File,"stream") FileWriteLine($File,"BT") If $Zeilen = 1 Then FileWriteLine($File,"/F1 "&$Schrift&" Tf") FileWriteLine($File,"1 0 0 1 "&$Rand_y&" "&$Size_y - $Rand_x - $Abstand&" Tm") FileWriteLine($File,"("&$Text&") Tj") Else For $Counter = 1 To $Zeilen FileWriteLine($File,"/F1 "&$Schrift&" Tf") FileWriteLine($File,"1 0 0 1 "&$Rand_y&" "&$Size_y - $Rand_x - $Abstand * $Counter&" Tm") FileWriteLine($File,"("&$Text[$Counter * 2 - 1]&") Tj") Next EndIf FileWriteLine($File,"ET") FileWriteLine($File,"endstream") FileWriteLine($File,"endobj") FileWriteLine($File,"9 0 obj") FileWriteLine($File,"78") FileWriteLine($File,"endobj") FileWriteLine($File,"2 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Type /Catalog") FileWriteLine($File,"/Pages 3 0 R") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"3 0 obj") FileWriteLine($File,"<<") FileWriteLine($File,"/Type /Pages") FileWriteLine($File,"/Count 1") FileWriteLine($File,"/MediaBox [ 0 0 "&$Size_x&" "&$Size_y&" ]") FileWriteLine($File,"/Kids [ 7 0 R ]") FileWriteLine($File,">>") FileWriteLine($File,"endobj") FileWriteLine($File,"0 10") FileWriteLine($File,"0000000000 65535 f ") FileWriteLine($File,"0000000013 00000 n ") FileWriteLine($File,"0000000591 00000 n ") FileWriteLine($File,"0000000634 00000 n ") FileWriteLine($File,"0000000156 00000 n ") FileWriteLine($File,"0000000245 00000 n ") FileWriteLine($File,"0000000307 00000 n ") FileWriteLine($File,"0000000372 00000 n ") FileWriteLine($File,"0000000453 00000 n ") FileWriteLine($File,"0000000576 00000 n ") FileWriteLine($File,"trailer") FileWriteLine($File,"<<") FileWriteLine($File,"/Size 10") FileWriteLine($File,"/Root 2 0 R") FileWriteLine($File,"/Info 1 0 R") FileWriteLine($File,">>") FileWriteLine($File,"startxref") FileWriteLine($File,"712") FileWriteLine($File,"%%EOF") FileClose($File) EndFunc1 point
-
How to tell why sqlite update is failing?
argumentum reacted to BryanWall for a topic
Noted. I will remember to do so in the future. Where I'm at currently, unfortunately, has nothing to do with sqlite. I'll post some sample code below but basically I'm reading a txt file, converting some of the data to hex and writing the hex to a temp file. The temp file is then written to sqlite blob. The problem I'm seeing, is that the temp file is suddenly disappearing. ... never mind. I think the file is disappearing because of variable setting/exit conditions being done wrong. If that is the case, apologies for wasting everyone's time and I will look into deleting this if I'm right.1 point -
Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team1 point
-
Intermittent problem running Powershell scripts
argumentum reacted to VeeDub for a topic
@argumentum Thanks for sharing. I have replaced my function with _RunWaitEx I've watched the first calls to the function and the powershell is executing as it should. Which is not unlike my function most of the time. Hopefully _RunWaitEx just works. But if we get the same behaviour that I've been observing some of the time, I've also added some logging for: UpdateEventLog("@error: " & @error) UpdateEventLog("Exitcode: " & @extended) UpdateEventLog("Exitcode: " & $iExitCode) UpdateEventLog("Output: " & $sOutput) Which will hopefully give me some idea what is going on.1 point -
Intermittent problem running Powershell scripts
VeeDub reacted to argumentum for a topic
Run it as in the example https://www.autoitscript.com/autoit3/docs/functions/StderrRead.htm Let me know it it worked. Or, use this RunWaitEx().1 point -
Try this workaround: #include <Word.au3> #include "WordConstants.au3" #include <GDIPlus.au3> #include <Clipboard.au3> _GDIPlus_Startup() Global $hBitmapGDI = _GDIPlus_BitmapCreateFromMemory(_Base64String()) Global $bPNG = _GDIPlus_StreamImage2BinaryString($hBitmapGDI) $iFormat_PNG = _ClipBoard_RegisterFormat("PNG") _ClipBoard_Open(0) _ClipBoard_Empty() $iSize = BinaryLen($bPNG) $hMemory = _MemGlobalAlloc($iSize, $GHND) $hLock = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte png[" & $iSize & "]", $hLock) $tData.png = Binary($bPNG) _MemGlobalUnlock($hMemory) MsgBox(0, "Copy Image as PNG to clipboard", _ "Clipboard handle: " & _ClipBoard_SetDataEx($hMemory, $iFormat_PNG)) _MemGlobalFree($hMemory) _GDIPlus_ImageDispose($hBitmapGDI) _GDIPlus_Shutdown() Exit Func _GDIPlus_StreamImage2BinaryString($hBitmap, $sFormat = "PNG", $iQuality = 80, $bSave = False, $sFilename = @ScriptDir & "\Converted.jpg") ;coded by UEZ 2013 build 2014-01-25 Local $sImgCLSID, $tGUID, $tParams Switch $sFormat Case "JPG" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Local $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 Local $pData = DllStructGetPtr($tData) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Case "PNG", "BMP", "GIF", "TIF" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Case Else Return SetError(1, 0, 0) EndSwitch Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx If @error Then Return SetError(2, 0, 0) _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) If @error Then Return SetError(3, 0, 0) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(4, 0, 0) Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(5, 0, 0) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) If $bSave Then Local $hFile = FileOpen($sFilename, 18) If @error Then Return SetError(6, 0, $bData) FileWrite($hFile, $bData) FileClose($hFile) EndIf Return $bData EndFunc ;==>_GDIPlus_StreamImage2BinaryString Func _Base64String($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Base64String $Base64String &= 'm7MAiVBORw0KGgoAAAAADUlIRFIlAHBkARgIBgAocOIElVQAGAlwSFlzEAAACxIBDAHS3QB+/AAAA3RJRABBVHgB7ZsxbwDTUBSFDWKq1ACVSmwMwNof0ACNhQXGDsxIlQC6UcHGPwC1WwAlpM79AbCwsADxA7oCAxsSWQCROnM+iFOSWgCJRJN3bsq50gBVHDt59/g79gDzs/PSdYkQCAKBQgJ1JnCjvPgAvcMhidta+UAAeUe5Of7AT70Afld+Vp6N13UA3duDyeI6LKwAiyEbgvlU+UQA+VDJ+3lxro0AH5XvlKdK3g8ARzHD/IYMnwEAPbzbWnip3FcALjKh/87sK2YAHCtfK0ezG6sAnUE3Lwmss+IAuaR8U75Q/qsAGewN36UN2qIAzdJR0RDOCroAGi4eVzFiFjwAbdEmbVOjZFQAM4SL9Sfl4xUA0qJtalCrXFQAMgRAH5T3GlAAoga1yplS5aIAThfCUdvCDJUAmcRXLe0oR5MANf2CafRV5QwAORGH1maAnpoA1C4TFQxh5LMAymvGItjULjMA+mrfZU3fd9AAVTEcXeZoapEAAUPbz7XyrvIAouv6T7ssbvoA3GZgEBrQYg8AZ5cFhH07gQsAAWhBkzWchvBAbMoO4C/6BAagALBa2DU5DeGpAG21sGtyGcIdAHKl7qo/MNBkAL17dxnCj0tVAOO+U5jLEH7pAKsaVm0uQzarCLohXQECCvvhlQDmMoQJCVXDqgDNZQizQ6qGVQCbyxCm6lSNLwBOYS5DzrTTPABhrRZoQpstXACGsMPMm6oWdgBNTkOY/VEt7ACanIbMn1HY3gAquis0WcNpCAAAjq17P10cLQBosobTEHac6QCddghjDWixxwCt5gqmf6sedQB7h6+kgRmFzgBAw8gpoK/tPgBD0HGkfN8LMgC8UhsNJaKCIQCAeKZk0lrroAAmtctE+y5reADX6S52lUzv3AAa/sjS1/5QiwC7+jtCia6q3wC7' $Base64String &= 'KmcIerhDfgCkbHGmUINa1gC7ctW/FJUMQQAcgHaUq7ym0AA2NcqZIU1dNQBD0EQXwuyPAwDlMofEtEWbtABdqpuSnklUNACkF8fIh+mdbwCUVzGG79IGbQCVGU1Jy2C0nwDbOyhjzso/cwCBN/QJJrFxdABf6z99VhllzQBx5PcmjvKTcQCyYlt5Lf8WzSDOJUIgBLkA/AQAfgGdGnQnr6IELMkA5QBJRU5EAK5CYII=' $Base64String = _WinAPI_Base64Decode($Base64String) If @error Then Return SetError(1, 0, 0) Local $tSource = DllStructCreate('byte[' & BinaryLen($Base64String) & ']') DllStructSetData($tSource, 1, $Base64String) Local $tDecompress _WinAPI_LZNTDecompress($tSource, $tDecompress, 962) If @error Then Return SetError(3, 0, 0) $tSource = 0 Local Const $bString = Binary(DllStructGetData($tDecompress, 1)) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\Test.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Base64String Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode Func _WinAPI_LZNTDecompress(ByRef $tInput, ByRef $tOutput, $iBufferSize) $tOutput = DllStructCreate("byte[" & $iBufferSize & "]") If @error Then Return SetError(1, 0, 0) Local $aRet = DllCall("ntdll.dll", "uint", "RtlDecompressBuffer", "ushort", 0x0002, "struct*", $tOutput, "ulong", $iBufferSize, "struct*", $tInput, "ulong", DllStructGetSize($tInput), "ulong*", 0) If @error Then Return SetError(2, 0, 0) If $aRet[0] Then Return SetError(3, $aRet[0], 0) Return $aRet[6] EndFunc ;==>_WinAPI_LZNTDecompress It converts the image to a PNG image in the memory to put it to the clipboard afterwards. I tested it with MS Word and it worked properly.1 point
-
MbTcp - Modbus TCP UDF
marcoauto reacted to kurtykurtyboy for a topic
Here is something that I have been wanting in AutoIt for years but sadly no one had created it yet. Well, I decided to hunker down and do something about it! I present to you, MbTCP - a Modbus TCP/IP UDF. What is Modbus? Modbus is a communications protocol commonly used to communicate with various types of PLC's, sensors, SCADA systems, and many other industrial applications. Modbus TCP is the ethernet variant (as opposed to Modbus RTU which uses a serial connection). This UDF takes care of all the behind-the-scenes legwork and makes it easy to get right to the data. No need to worry about which function codes to use or how to format the data. Modbus typically works on discrete coils and inputs (think BOOL) or 16-bit registers (think INT). However, some devices support 32-bit signed and unsigned integers and 32-bit floating point numbers. This is possible by reading or writing 2 consecutive 16-bit registers and formatting them on both ends. The UDF will take care of all that as well (although maybe not in the most sophisticated ways...😏 ). Because there is no standard for working with 32-bit numbers, it is necessary to have the option to enable or disable big-endianness. Similarly, not all devices start counting at register 1. Some of them actually start at register 0. The UDF allows you to define these parameters when creating the connection to the device. Available data types for input and holding registers are INT16, UINT16, INT32, UINT32, and FLOAT32. Function List: ; _MbTcp_Connect ......................: Open a connection to a remote device ; _MbTcp_ReadCoils ....................: Read 1 or more output coils (function code 1) ; _MbTcp_ReadDiscreteInputs ...........: Read 1 or more discrete inputs (function code 2) ; _MbTcp_ReadHoldingRegisters .........: Read 1 or more holding registers (function code 3) ; _MbTcp_ReadInputRegisters ...........: Read 1 or more input registers (function code 4) ; _MbTcp_WriteCoils ...................: Write 1 or more output coils (function code 5 and 15) ; _MbTcp_WriteRegisters ...............: Write 1 or more holding registers (function code 6 and 16) ; _MbTcp_Disconnect ...................: Close the connection to a device ; _MbTcp_DisconnectAll ................: Close the connection to all connected devices To get started, follow these easy steps: Create a new connection to the device using _MbTcp_Connect Call any of the available read or write functions That's it. The program will automatically clean up any connections that are left open on exit. You may also manually disconnect from any device if needed. The most basic example of use. Connect to a device and read one holding register starting at register 2. #include "MbTcp.au3" ;connect to device at IP 127.0.0.1 Local $iConnection1 = _MbTcp_Connect("127.0.0.1") If @error Then MsgBox(16, "Error", "Failed to connect to the Modbus device at 127.0.0.1." & @CRLF & "Error Code: " & @error) Exit Else ConsoleWrite("Successfully connected to device at 127.0.0.1" & @CRLF) EndIf ;read 1 holding register Local $iReadData = _MbTcp_ReadHoldingRegisters($iConnection1, 2, 1) If @error Then MsgBox(16, "Error", "Failed to read the Modbus value." & @CRLF & "Error Code: " & @error) Else ConsoleWrite("Value: " & $iReadData & @CRLF) EndIf The next example shows how we can format the data to return an unsigned integer instead of the default signed integer. In the following example, we connect to a device that uses big-endian word order and starts at register 0 instead of 1. Then we read and write a group of registers. I may add more examples here if needed. There are a number of Modbus simulators out there if you want to test locally on your computer. But I really like a tool named Mod_RSsim link. Let me know if you find any issues. I know I will probably end up needing to add a timeout option. MbTcp_20230620.zip1 point -
For many months I have searched for the correct writing to be able to use a conditional formatting in an Excel, but looking for a condition on cells with text not with numbers. After many tests, fortunately I discovered the secret yesterday. The correct syntax is not the same as for numbers. In the case of text it is like this: ;*********************************************************************************** ; Ejemplo que rellena un rango con valores y luego le aplica un Formato Condicional ; siguiendo criterios de TEXTO. ; Autor: Antonio Miguel Fernandez ;*********************************************************************************** #include <Excel.au3> ; Que en los textos de las celdas se encuentre la letra J $BUSCAR= "j" ; Crear el Objeto Excel y presentarlo al usuario Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookNew($oExcel) ; Rellena el rango de celdas con distintos valores For $i = 1 To 10 Step 1 _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "00"&$i, "A"&$i) _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Name0"&$i, "B"&$i) $Texto = Aleatorio() _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $Texto, "C"&$i) $Texto = Aleatorio() _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $Texto, "D"&$i) _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "10000"&$i, "E"&$i) _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "=SUMA(A"&$i&";E"&$i&")", "F"&$i) Next ; Da formato al rango Global Const $xlDouble = -4119 ; Borde de celdas con lineas dobles. With $oExcel.ActiveWorkbook.Sheets(1) .Range("A:E").Font.Color = 0x111111 .Range("A:E").Font.Size = 9 .Range("A:M").Font.Name = "Arial" .Range("F1:F10").Borders.LineStyle = $xlDouble EndWith ; Creando las condiciones a verificar. $oExcel.Range("B1:D10").Select ; Rango donde aplicar el formato. ;$oExcel.Selection.FormatConditions.Delete ; Borrar los posibles formatos que hubiera en estas seleccion anteriormente. ; Formato condicional dependiendo del TEXTO que hay en las celdas. Local Const $xlTextString=9 ;Cadena de texto ;-------------------------------------------------------- Local Const $xlBeginsWith=2 ;Begins with a specified value. Local Const $xlContains=0 ;Contains a specified value. Local Const $xlDoesNotContain=1 ;Does not contain the specified value. Local Const $xlEndsWith=3 ;Endswith the specified value ;*************************************************************************** $oExcel.Selection.FormatConditions.Add($xlTextString,Default,Default,Default,$BUSCAR,$xlContains,Default,Default) ;*************************************************************************** $oExcel.Selection.FormatConditions($oExcel.Selection.FormatConditions.Count).SetFirstPriority With $oExcel.Selection.FormatConditions(1).Font .Color = -16383844 .TintAndShade = 0 EndWith With $oExcel.Selection.FormatConditions(1).Interior .PatternColorIndex = -4105 ;xlAutomatic .Color = 13551615 .TintAndShade = 0 EndWith $oExcel.Selection.FormatConditions(1).StopIfTrue = False Func Aleatorio() Local $sText = "" For $i = 1 To Random(5, 20, 1) ; Return an integer between 5 and 20 to determine the length of the string. $sText &= Chr(Random(65, 122, 1)) ; Return an integer between 65 and 122 which represent the ASCII characters between a (lower-case) to Z (upper-case). Next Return $sText EndFunc1 point
-
Okay, noted. Thank you for letting me know. I'll rephrase the question.0 points