Leaderboard
Popular Content
Showing content with the highest reputation on 08/30/2021 in all areas
-
Recently somebody asked how it could possible to manage the new feature of Virtual Desktop under Windows 10. With the incentive of @KaFu I started to get something together that could be useful. Since this code was never released under AutoIt, I felt it could serve as a good example. Let me know what you think. Version 2021-09-19 * Added support to IApplicationView and IVirtualDesktopPinnedApps interfaces (see example 2) Example 1. The documented interface of IVirtualDesktopManager offers a very limited list of methods. Someone may ask WTF is it useful for ? Well, I don't have an answer for that. #include <Constants.au3> #include <GUIConstants.au3> If @OSVersion <> "WIN_10" Then Exit MsgBox($MB_SYSTEMMODAL, "", "This script only runs on Win 10") ; VirtualDesktopManager object Local $CLSID_VirtualDesktopManager = "{aa509086-5ca9-4c25-8f95-589d3c07b48a}" Local $IID_IVirtualDesktopManager = "{a5cd92ff-29be-454c-8d04-d82879fb3f1b}" Local $tagIVirtualDesktopManager = _ "IsWindowOnCurrentVirtualDesktop hresult(hwnd;bool*);" & _ "GetWindowDesktopId hresult(hwnd;clsid*);" & _ "MoveWindowToDesktop hresult(hwnd;clsid);" ; object creation Local $oVDM = ObjCreateInterface($CLSID_VirtualDesktopManager, $IID_IVirtualDesktopManager, $tagIVirtualDesktopManager) ConsoleWrite(IsObj($oVDM) & @CRLF) ; create process owned window Local $hWnd = GUICreate("Test"), $bActive GUISetState() ; check if window is on current desktop (not mandatory to own the window) Local $iHresult = $oVDM.IsWindowOnCurrentVirtualDesktop($hWnd, $bActive) ConsoleWrite($iHresult & "/" & $bActive & @CRLF) ; returns the CLSID of the desktop where the window resides Local $sCLSID $iHresult = $oVDM.GetWindowDesktopId($hWnd, $sCLSID) ConsoleWrite($iHresult & "/" & $sCLSID & @CRLF) Local $hNote = WinGetHandle("[CLASS:Notepad]") $iHresult = $oVDM.GetWindowDesktopId($hNote, $sCLSID) ; (not mandatory to own the window) ConsoleWrite($iHresult & "/" & $sCLSID & @CRLF) ; moves the window to a specific desktop (mandatory to own the window) $iHresult = $oVDM.MoveWindowToDesktop($hWnd, $sCLSID) ConsoleWrite($iHresult & @CRLF) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd To perform this example you need to work a bit. Create a second Desktop, start Notepad, go back to the first, and run this script: the GUI window will be transferred from the first desktop to the second. Warning : you cannot use this method if you do not own the window (process-wise). Example 2 : The "undocumented" interface of IVirtualDesktopManagerInternal has a lot more methods and resolves all the requests someone could have using Virtual Desktops. #include <Constants.au3> Opt("MustDeclareVars", True) If @OSVersion <> "WIN_10" Then Exit MsgBox($MB_SYSTEMMODAL, "", "This script only runs on Win 10") ; Instanciation objects Local $CLSID_ImmersiveShell = "{c2f03a33-21f5-47fa-b4bb-156362a2f239}" Local $IID_IUnknown = "{00000000-0000-0000-c000-000000000046}" Local $IID_IServiceProvider = "{6D5140C1-7436-11CE-8034-00AA006009FA}" Local $tIID_IServiceProvider = __uuidof($IID_IServiceProvider) Local $tagIServiceProvider = _ "QueryService hresult(struct*;struct*;ptr*);" ; VirtualDesktopManagerInternal object Const Enum $eLeftDirection = 3, $eRightDirection Local $CLSID_VirtualDesktopManagerInternal = "{C5E0CDCA-7B6E-41B2-9FC4-D93975CC467B}" Local $tCLSID_VirtualDesktopManagerInternal = __uuidof($CLSID_VirtualDesktopManagerInternal) Local $IID_IVirtualDesktopManagerInternal = "{F31574D6-B682-4CDC-BD56-1827860ABEC6}" Local $tIID_IVirtualDesktopManagerInternal = __uuidof($IID_IVirtualDesktopManagerInternal) Local $tagIVirtualDesktopManagerInternal = _ "GetCount hresult(int*);" & _ "MoveViewToDesktop hresult(ptr;ptr);" & _ "CanViewMoveDesktops hresult(ptr;bool*);" & _ "GetCurrentDesktop hresult(ptr*);" & _ "GetDesktops hresult(ptr*);" & _ "GetAdjacentDesktop hresult(ptr;int;ptr*);" & _ "SwitchDesktop hresult(ptr);" & _ "CreateDesktopW hresult(int*);" & _ "RemoveDesktop hresult(ptr;ptr);" & _ "FindDesktop hresult(struct*;ptr*);" ; ApplicationViewCollection object Local $CLSID_IApplicationViewCollection = "{1841C6D7-4F9D-42C0-AF41-8747538F10E5}" Local $tCLSID_IApplicationViewCollection = __uuidof($CLSID_IApplicationViewCollection) Local $IID_IApplicationViewCollection = "{1841C6D7-4F9D-42C0-AF41-8747538F10E5}" Local $tIID_IApplicationViewCollection = __uuidof($IID_IApplicationViewCollection) Local $tagIApplicationViewCollection = _ "GetViews hresult(struct*);" & _ "GetViewsByZOrder hresult(struct*);" & _ "GetViewsByAppUserModelId hresult(wstr;struct*);" & _ "GetViewForHwnd hresult(hwnd;ptr*);" & _ "GetViewForApplication hresult(ptr;ptr*);" & _ "GetViewForAppUserModelId hresult(wstr;int*);" & _ "GetViewInFocus hresult(ptr*);" ; ApplicationView object Local $IID_IApplicationView = "{372E1D3B-38D3-42E4-A15B-8AB2B178F513}" Local $tagIApplicationView = _ "GetIids hresult(ulong*;ptr*);" & _ "GetRuntimeClassName hresult(str*);" & _ "GetTrustLevel hresult(int*);" & _ "SetFocus hresult();" & _ "SwitchTo hresult();" & _ "TryInvokeBack hresult(ptr);" & _ "GetThumbnailWindow hresult(hwnd*);" & _ "GetMonitor hresult(ptr*);" & _ "GetVisibility hresult(int*);" & _ "SetCloak hresult(int;int);" & _ "GetPosition hresult(clsid;ptr*);" & _ "SetPosition hresult(ptr);" & _ "InsertAfterWindow hresult(hwnd);" & _ "GetExtendedFramePosition hresult(struct*);" & _ "GetAppUserModelId hresult(wstr*);" & _ "SetAppUserModelId hresult(wstr);" & _ "IsEqualByAppUserModelId hresult(wstr;int*);" & _ "GetViewState hresult(uint*);" & _ "SetViewState hresult(uint);" & _ "GetNeediness hresult(int*);" ; VirtualDesktopPinnedApps object Local $CLSID_VirtualDesktopPinnedApps = "{b5a399e7-1c87-46b8-88e9-fc5747b171bd}" Local $tCLSID_VirtualDesktopPinnedApps = __uuidof($CLSID_VirtualDesktopPinnedApps) Local $IID_IVirtualDesktopPinnedApps = "{4ce81583-1e4c-4632-a621-07a53543148f}" Local $tIID_IVirtualDesktopPinnedApps = __uuidof($IID_IVirtualDesktopPinnedApps) Local $tagIVirtualDesktopPinnedApps = _ "IsAppIdPinned hresult(wstr;bool*);" & _ "PinAppID hresult(wstr);" & _ "UnpinAppID hresult(wstr);" & _ "IsViewPinned hresult(ptr;bool*);" & _ "PinView hresult(ptr);" & _ "UnpinView hresult(ptr);" ; Miscellaneous objects Local $IID_IObjectArray = "{92ca9dcd-5622-4bba-a805-5e9f541bd8c9}" Local $tagIObjectArray = _ "GetCount hresult(int*);" & _ "GetAt hresult(int;ptr;ptr*);" Local $IID_IVirtualDesktop = "{FF72FFDD-BE7E-43FC-9C03-AD81681E88E4}" Local $tIID_IVirtualDesktop = __uuidof($IID_IVirtualDesktop) Local $tagIVirtualDesktop = _ "IsViewVisible hresult(ptr;bool*);" & _ "GetId hresult(clsid*);" ; objects creation Local $pService Local $oImmersiveShell = ObjCreateInterface($CLSID_ImmersiveShell, $IID_IUnknown, "") ConsoleWrite("Immersive shell = " & IsObj($oImmersiveShell) & @CRLF) $oImmersiveShell.QueryInterface($tIID_IServiceProvider, $pService) ConsoleWrite("Service pointer = " & $pService & @CRLF) Local $oService = ObjCreateInterface($pService, $IID_IServiceProvider, $tagIServiceProvider) ConsoleWrite("Service = " & IsObj($oService) & @CRLF) Local $pApplicationViewCollection, $pVirtualDesktopManagerInternal, $pVirtualDesktopPinnedApps $oService.QueryService($tCLSID_IApplicationViewCollection, $tIID_IApplicationViewCollection, $pApplicationViewCollection) ConsoleWrite("View collection pointer = " & $pApplicationViewCollection & @CRLF) Local $oApplicationViewCollection = ObjCreateInterface($pApplicationViewCollection, $IID_IApplicationViewCollection, $tagIApplicationViewCollection) ConsoleWrite("View collection = " & IsObj($oApplicationViewCollection) & @CRLF) $oService.QueryService($tCLSID_VirtualDesktopManagerInternal, $tIID_IVirtualDesktopManagerInternal, $pVirtualDesktopManagerInternal) ConsoleWrite("Virtual Desktop pointer = " & $pVirtualDesktopManagerInternal & @CRLF) Local $oVirtualDesktopManagerInternal = ObjCreateInterface($pVirtualDesktopManagerInternal, $IID_IVirtualDesktopManagerInternal, $tagIVirtualDesktopManagerInternal) ConsoleWrite("Virtual Desktop = " & IsObj($oVirtualDesktopManagerInternal) & @CRLF) $oService.QueryService($tCLSID_VirtualDesktopPinnedApps, $tIID_IVirtualDesktopPinnedApps, $pVirtualDesktopPinnedApps) ConsoleWrite("Virtual Desktop Pinned Apps = " & $pVirtualDesktopPinnedApps & @CRLF) Local $oVirtualDesktopPinnedApps = ObjCreateInterface($pVirtualDesktopPinnedApps, $IID_IVirtualDesktopPinnedApps, $tagIVirtualDesktopPinnedApps) ConsoleWrite("Virtual Desktop Pinned Apps = " & IsObj($oVirtualDesktopPinnedApps) & @CRLF) Local $iCount, $pCurrent, $pLeft, $pNew, $iHresult, $hWnd, $pView, $pArray, $pDesktop, $oArray, $oView, $sView, $bValue ; gives the number of virtual desktops $iHresult = $oVirtualDesktopManagerInternal.GetCount($iCount) ConsoleWrite("Number of Desktop = " & $iCount & "/" & $iHresult & @CRLF) If $iCount > 1 Then Exit MsgBox($MB_SYSTEMMODAL, "", "Please close all additional Virtual Desktops") ; creates a new virtual desktop $iHresult = $oVirtualDesktopManagerInternal.CreateDesktopW($pNew) ConsoleWrite("Create = " & $pNew & "/" & $iHresult & @CRLF) $iHresult = $oVirtualDesktopManagerInternal.SwitchDesktop($pNew) ConsoleWrite("Switch = " & $iHresult & @CRLF) Run("Notepad.exe") WinWait("[CLASS:Notepad]") ; enumerates all desktops $iHresult = $oVirtualDesktopManagerInternal.GetDesktops($pArray) $oArray = ObjCreateInterface($pArray, $IID_IObjectArray, $tagIObjectArray) ConsoleWrite("Array = " & IsObj($oArray) & @CRLF) $oArray.GetCount($iCount) ConsoleWrite("Count = " & $iCount & @CRLF) $oArray.GetAt(0, DllStructGetPtr($tIID_IVirtualDesktop), $pDesktop) ConsoleWrite("Desktop 0 = " & $pDesktop & @CRLF) $oArray.GetAt(1, DllStructGetPtr($tIID_IVirtualDesktop), $pCurrent) ConsoleWrite("Desktop 1 = " & $pCurrent & @CRLF) ; gives the current desktop id $iHresult = $oVirtualDesktopManagerInternal.GetCurrentDesktop($pCurrent) ConsoleWrite("Current = " & $pCurrent & "/" & $iHresult & @CRLF) ; returns the adjacent desktop id $iHresult = $oVirtualDesktopManagerInternal.GetAdjacentDesktop($pCurrent, $eLeftDirection, $pLeft) ConsoleWrite("Get Left = " & $pLeft & "/" & $iHresult & @CRLF) ; switches to a specific desktop MsgBox ($MB_SYSTEMMODAL,"","Now it will return to previous desktop") Sleep(500) ; gives time for the msg box to close $iHresult = $oVirtualDesktopManagerInternal.SwitchDesktop($pLeft) ConsoleWrite("Switch = " & $iHresult & @CRLF) ; get pointer to a view based on hwnd and create an application view $hWnd = WinGetHandle("[CLASS:Notepad]") $iHresult = $oApplicationViewCollection.GetViewForHwnd($hWnd, $pView) ConsoleWrite("View from handle = " & $pView & "/" & $iHresult & @CRLF) $oView = ObjCreateInterface($pView, $IID_IApplicationView, $tagIApplicationView) ConsoleWrite("Application view = " & IsObj($oView) & @CRLF) $iHresult = $oView.GetAppUserModelId($sView) ConsoleWrite("Get App ID = " & $sView & "/" & $iHresult & @CRLF) ; verify if app is pinned with ptr and string $iHresult = $oVirtualDesktopPinnedApps.IsViewPinned($pView, $bValue) ConsoleWrite("Is View Pinned = " & $bValue & "/" & $iHresult & @CRLF) $iHresult = $oVirtualDesktopPinnedApps.IsAppIdPinned($sView, $bValue) ConsoleWrite("Is AppId Pinned = " & $bValue & "/" & $iHresult & @CRLF) ; move application to a specific desktop $iHresult = $oVirtualDesktopManagerInternal.MoveViewToDesktop($pView, $pDesktop) ConsoleWrite("Move = " & $iHresult & @CRLF) Sleep(2000) ; deletes an existing desktop $iHresult = $oVirtualDesktopManagerInternal.RemoveDesktop($pNew, $pDesktop) ConsoleWrite("Delete = " & $iHresult & @CRLF) Func __uuidof($sGUID) Local $tGUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID) If @error Then Return SetError(@error, @extended, 0) Return $tGUID EndFunc ;==>__uuidof Enjoy.3 points
-
In this thread it was mentioned how a software could manage single/multiple monitors. I was curious to see how it could be possible to make it work without the tool. So I made a script that change brightness (VCP 10) of my primary monitor for a few seconds. To learn about the VCP commands refer to : https://www.ddcutil.com/vcpinfo_output/ Among other commands, you can turn on/off (VCP D6) secondary monitor, change contrast (VCP 12), etc. In the example you can see (and parse) all commands allowed by your monitor(s). #include <String.au3> #include <Array.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> Local $aPos, $aData = _WinAPI_EnumDisplayMonitors() If IsArray($aData) Then ReDim $aData[$aData[0][0] + 1][5] For $i = 1 To $aData[0][0] $aPos = _WinAPI_GetPosFromRect($aData[$i][1]) For $j = 0 To 3 $aData[$i][$j + 1] = $aPos[$j] Next Next EndIf _ArrayDisplay($aData, '_WinAPI_EnumDisplayMonitors') Local $hWnd = _WinAPI_GetDesktopWindow() ConsoleWrite($hWnd & @CRLF) $hMonitor = _WinAPI_MonitorFromWindow($hWnd, $MONITOR_DEFAULTTONEAREST) ConsoleWrite($hMonitor & @CRLF) Local $aRet = DllCall("Dxva2.dll", "int", "GetNumberOfPhysicalMonitorsFromHMONITOR", "handle", $hMonitor, "int*", 0) ;_ArrayDisplay($aRet) Local $iNumberMonitor = $aRet[2] Const $tag_PHYSICAL_MONITOR = "handle hPhysicalMonitor; wchar strPhysicalMonitorDescription[128];" Local $tPhysicalMonitor = DllStructCreate(_StringRepeat($tag_PHYSICAL_MONITOR, $iNumberMonitor)) $aRet = DllCall("Dxva2.dll", "int", "GetPhysicalMonitorsFromHMONITOR", "handle", $hMonitor, "int", $iNumberMonitor, "struct*", $tPhysicalMonitor) ;_ArrayDisplay($aRet) MsgBox($MB_SYSTEMMODAL, "", $tPhysicalMonitor.strPhysicalMonitorDescription) $aRet = DllCall("Dxva2.dll", "int", "GetCapabilitiesStringLength", "handle", $tPhysicalMonitor.hPhysicalMonitor, "int*", 0) ;_ArrayDisplay($aRet) Local $iLength = $aRet[2] + 1 Local $tCapabilities = DllStructCreate("char sCapabilities[" & $iLength & "];") $aRet = DllCall("Dxva2.dll", "int", "CapabilitiesRequestAndCapabilitiesReply", "handle", $tPhysicalMonitor.hPhysicalMonitor, _ "ptr", DllStructGetPtr($tCapabilities), "int", $iLength) ;_ArrayDisplay($aRet) ConsoleWrite($tCapabilities.sCapabilities & @CRLF) Local Enum $MC_MOMENTARY, $MC_SET_PARAMETER ; _MC_VCP_CODE_TYPE $aRet = DllCall("Dxva2.dll", "int", "GetVCPFeatureAndVCPFeatureReply", "handle", $tPhysicalMonitor.hPhysicalMonitor, _ "byte", 0x10, "int*", 0, "int*", 0, "int*", 0) ;_ArrayDisplay($aRet) ConsoleWrite($aRet[3] = $MC_MOMENTARY ? "Momentary" : ($aRet[3] = $MC_SET_PARAMETER ? "Set" : "Unknown") & @CRLF) ConsoleWrite("Current value = " & $aRet[4] & "/" & "Maximum = " & $aRet[5] & @CRLF) Local $iCurrent = $aRet[4] $aRet = DllCall("Dxva2.dll", "int", "SetVCPFeature", "handle", $tPhysicalMonitor.hPhysicalMonitor, _ "byte", 0x10, "int", 20) Sleep(5000) $aRet = DllCall("Dxva2.dll", "int", "SetVCPFeature", "handle", $tPhysicalMonitor.hPhysicalMonitor, _ "byte", 0x10, "int", $iCurrent) $aRet = DllCall("Dxva2.dll", "int", "DestroyPhysicalMonitors", "int", $iNumberMonitor, "ptr", DllStructGetPtr($tPhysicalMonitor)) ;_ArrayDisplay($aRet)1 point
-
I am really happy to read that. Moments cannot be calculated on VectorOfVectorOfPoint. It can be calculated on VectorOfPoint. That means it should be done inside the loop. More over, the binaryImage is a bool, meaning its value is either True or False. The default value is False. Works because $hull_i is a VectorOfPoint and $Gaus is a pointer treated as an integer, therefore equivalent to True. By the way, keep in mind that $hull_i is the last calculated convexHull. I am not sure this is what you want. It think it should be done inside the loop, as well as the center caculation. It should be corrected to _cveMomentsTyped("VectorOfPoint", $hull_i, False, $moments) Doesn't work because $contours is a VectorOfVectorOfPoint. It should be inside the loop in this form. _cveMomentsTyped("VectorOfPoint", $tVectorPointPtr2.value, False, $moments2)1 point
-
Encrypt / Decrypt executable FILE (via AutoIT) - (Moved)
JockoDundee reacted to Musashi for a topic
I'm afraid I don't know what exactly your goal is, since AutoIt+Html was not part of your initial question. A quick search on "autoit html report" reveals some hits that are quite useful, e.g. _array2htmltable I agree with that. The use of Html (depending on the task) can allow a very flexible implementation. Another approach would be e.g. the use of the Excel UDF from @water. However, for a detailed assistance we need more precise background information.1 point -
To encrypt or decrypt files , AutoIt offers the following functions (you probably already found them yourself). Decrypts a file with specified key and algorithm : _Crypt_DecryptFile Encrypts a file with specified key and algorithm : _Crypt_EncryptFile At runtime, the program/script must be present in an unencrypted form so that the interpreter can execute it. Sensitive data (passwords etc.) should not be stored in the source code anyway. It also doesn't matter much whether you use the format .au3 (clear code), .a3x (tokenized code) or .exe ('compiled' , a3x plus interpreter). .a3x and .exe may provide minimal protection against DAUs, but nothing to rely on. Note : The following project from @RTFC might be of interest to you : codecrypter-encrypt-your-script1 point
-
@dakotadevada I really don't know what bugging you, but I use HTML reports in AutoIt. It gives me the power to draw HTML reports, including SVG images and scalable content. All you have to do is display the .html file. As to your original question about decrypting executables? I think you are the only person with any comprehension as to what you think that question entails.1 point
-
$contours is a VectorOfVectorOfPoint. Therefore, if used as a Mat, like shown in _cveConvexHullTyped, it will crash. convexHull cannot but applied on a VectorOfVectorOfPoint. It can only be applied on a VectorOfPoint or on a Mat. Local $hull = _VectorOfVectorOfPointCreate() Local $hull_i = _VectorOfPointCreate() Local $tVectorPointPtr = DllStructCreate("ptr value") For $i = 0 To _VectorOfVectorOfPointGetSize($contours) - 1 _VectorOfVectorOfPointGetItemPtr($contours, $i, $tVectorPointPtr) ;_cveConvexHullTyped($typeOfPoints, $points, $typeOfHull, $hull, $clockwise = false, $returnPoints = true) _cveConvexHullTyped("VectorOfPoint", $tVectorPointPtr.value, "VectorOfPoint", $hull_i) _VectorOfVectorOfPointPush($hull, $hull_i) Next ;Func _cveDrawContoursTyped($typeOfImage, $image, $typeOfContours, $contours, $contourIdx, $color, ... ; _cveDrawContoursTyped("Mat", $img, "VectorOfVectorOfPoint", $contours, -1, _cvRGB(0, 255, 0), 3) _cveDrawContoursTyped("Mat", $img, "VectorOfVectorOfPoint", $hull, -1, _cvRGB(255, 0, 0), 3)1 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
-
Ya, but you got me hook. So I didn't work (having fun) for nothing : #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <Math.au3> Opt("MustDeclareVars", True) Global Const $SIZE = 400, $BORDER = 50, $RADIUS = ($SIZE - 2 * $BORDER) / 2, $CIRCLE_SIZE = 4 _GDIPlus_Startup() Example() Func Example() Local Const $aDegree = [10, 92, 318, 323, 325, 327] Local $hGUI = GUICreate("GDI+", $SIZE, $SIZE) GUISetState(@SW_SHOW) Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Local $hPen = _GDIPlus_PenCreate(0xFFFF0000, $CIRCLE_SIZE) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsDrawEllipse($hGraphic, $BORDER, $BORDER, $SIZE - $BORDER * 2, $SIZE - $BORDER * 2, $hPen) Local $radian, $x, $y For $i = 0 To UBound($aDegree) - 1 $radian = _Radian(Mod(450 - $aDegree[$i], 360)) $x = Round($RADIUS * Cos($radian)) + $SIZE / 2 - $CIRCLE_SIZE $y = $SIZE / 2 - Round($RADIUS * Sin($radian)) - $CIRCLE_SIZE _GDIPlus_GraphicsFillEllipse($hGraphic, $x, $y, $CIRCLE_SIZE * 2, $CIRCLE_SIZE * 2) Next Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) EndFunc ;==>Example1 point
-
Why ? Your client is paying you on the size of the exe ?1 point