Leaderboard
Popular Content
Showing content with the highest reputation on 01/01/2017 in all areas
-
Detect whether Microsoft Word is installed?
Subz reacted to InunoTaishou for a topic
Local $oWord = ObjCreate("Word.Application") If IsObj($oWord) then ConsoleWrite ("ObjCreate: Version: " & $oWord.Caption & " " & $oWord.Version & " & Build: " & $oWord.Build & @LF) $oWord.Quit EndIf ConsoleWrite("RegRead: " & RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\winword.exe", "Path") & @LF)1 point -
Use #RequireAdmin at the top of your script1 point
-
$FileArray = StringSplit($BinarydData, @CRLF, 1+2) Or $FileArray = StringRegExp($BinarydData, "[^\r\n]+", 3)1 point
-
1 point
-
1 point
-
StringInStr <> 0 but still else
genius257 reacted to JLogan3o13 for a topic
1 point -
Internal conversions Limitations This code is based on a copy of Example5.au3 in "Examples\Demo examples\5) Simple numeric variables\". See post 11. ;#AutoIt3Wrapper_UseX64=y #include "..\..\..\Includes\InspectVariable.au3" Opt( "MustDeclareVars", 1 ) Example6() Func Example6() ; Change to your local digit grouping and decimal symbols ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Local $sLocalGroupingSymbol = ".", $sLocalDecimalSymbol = "," ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Local $sDec1 = "3.1415926535897932384626433832", $sDec ; pi with 28 decimals $sDec1 = StringReplace( $sDec1, ".", $sLocalDecimalSymbol, -1 ) AccessVariables03( DecimalsAdd, $sDec1, $sDec1, $sDec ) ConsoleWrite( "DecimalsAdd:" & @CRLF ) ConsoleWrite( " " & $sDec1 & @CRLF ) ConsoleWrite( "+ " & $sDec1 & @CRLF ) ConsoleWrite( "--------------------------------" & @CRLF ) ConsoleWrite( "= " & $sDec & @CRLF & @CRLF ) $sDec1 = "3.1415926535897932384626433832" ; pi with 28 decimals $sDec1 = StringReplace( $sDec1, ".", $sLocalDecimalSymbol, -1 ) AccessVariables03( DecimalsAddError, $sDec1, $sDec1, $sDec ) ConsoleWrite( "DecimalsAddError:" & @CRLF ) ConsoleWrite( " " & $sDec1 & @CRLF ) ConsoleWrite( "+ " & $sDec1 & @CRLF ) ConsoleWrite( "--------------------------------" & @CRLF ) ConsoleWrite( "= " & $sDec & @CRLF & @CRLF ) EndFunc Func DecimalsAdd( $psDec1, $psDec2, $psDec ) Local $tVar1 = DllStructCreate( $tagVARIANT ), $pVar1 = DllStructGetPtr( $tVar1 ) Local $tVar2 = DllStructCreate( $tagVARIANT ), $pVar2 = DllStructGetPtr( $tVar2 ) VariantChangeType( $pVar1, $psDec1, 0, $VT_DECIMAL ) VariantChangeType( $pVar2, $psDec2, 0, $VT_DECIMAL ) VarAdd( $pVar1, $pVar2, $psDec ) VariantChangeType( $psDec, $psDec, 0, $VT_BSTR ) EndFunc Func DecimalsAddError( $psDec1, $psDec2, $psDec ) VariantChangeType( $psDec1, $psDec1, 0, $VT_DECIMAL ) VariantChangeType( $psDec2, $psDec2, 0, $VT_DECIMAL ) VarAdd( $psDec1, $psDec2, $psDec ) VariantChangeType( $psDec, $psDec, 0, $VT_BSTR ) EndFunc You can find the example as Example6.au3 in Tests\Examples\3) Internal conversions\ in zip in first post. Output in SciTE console: DecimalsAdd: 3,1415926535897932384626433832 + 3,1415926535897932384626433832 -------------------------------- = 6,2831853071795864769252867664 DecimalsAddError: 3.14159265358979 + 3.14159265358979 -------------------------------- = 6,2831853071795864769252867664 Internal conversions for DecimalsAdd: Conversions for $sDec1 and $sDec2 Function entry: AutoIt string -> Pointer to variant string Function exit: Pointer to variant string -> AutoIt string Internal conversions for DecimalsAddError: Conversions for $sDec1 and $sDec2 Function entry: AutoIt string -> Pointer to variant string Function exit: Pointer to variant decimal -> AutoIt double In DecimalsAddError the strings with 28 decimals on function entry are converted to doubles with 14 decimals on function exit. We certainly don't want this. We'll lose a great deal of the accuracy of the string variables. In AutoIt there is no internal decimal type. The decimal variant is converted to the internal type that fits best: Double. In this example it's not a problem. We can just use the code in DecimalsAdd. However, it can certainly be a problem for methods of real COM objects. COM methods When I was creating this example I was playing with $oUIAutomation.RectToVariant method (Tests\Examples\0) Accessing variables\Example1.au3). It takes a rectangle structure as input and returns a 1D array with four elements (left, top, width, height). This works fine. But $oUIAutomation.VariantToRect which takes a 1D array with four elements as input and returns a rectangle structure does not work. And there is nothing to do about it. On method entry the AutoIt array is converted to a safearray of variants. But VariantToRect does not take a safearray of variants as input parameter. It takes a safearray of doubles as input parameter. The consequence is that the method is not working. See Tests\Examples\0) Accessing variables\Example2.au3. Example2.au3 returns the error code $iErr = -2147024809 = 0x80070057 = E_INVALIDARG (One or more arguments are invalid). See, however, a workaround using Com subclassing in post 16 below. Zip Zip at bottom of first post is updated.1 point
-
please set Fake User and Password and then post here a result from: _ADO_ConnectionString_Access1 point
-
RegFreeCOM Au3X Example
Professor_Bernd reacted to ptrex for a topic
RegFreeCOM Au3X Example Some time ago, someone in the support forum was asking if it is possible to distribute COM DLL's, on different machines, and not registering them. Well infact it is possible, using the MS SxS Manifest approach. For those who don't know what SxS is, it's an other word for ESCAPING DLL HELL : More information on how to build RegFreeCOM Manifest files, look here : Simplify App Deployment with ClickOnce and Registration-Free COM Download this example. RegFreeCOM_Au3X_Example.zip Save it to a machine running at least XP, and don't register any AutoItX3.dll. Run the "RegFreeCOM_Au3X_Example.exe" and see what happenes. Copy it to an other machine an try again. You will see that you are liberated from DLL registration as of now. The SxS technique is using an XML Manifest file to replace the need to use "regsvr32" for registering the COM objects. For those who remember my example on how to create COM objects, without the need of a DLL. This is next complimentary technique,l that allow you to create, run and distribute COM objects, by just distributing some files. This is an other example : Make sure no Au3X.Dll is installed on that machine. Or run : regsvr32 "C:\Program Files\AutoIt3\AutoItX\AutoItX3.dll" /u In order to run this -> Compile the code to RegFreeCOM_Au3X_Example.exe And put it in the same folder as where the Manifest files are located. (Can be a USB stick) $oAutoIt = ObjCreate("AutoItX3.Control.1") $oAutoIt.Run("notepad.exe") ;Wait for the window "Untitled" to exist and be active $oAutoIt.WinWaitActive ("Untitled") $oAutoIt.Send("{Enter}") $oAutoIt.Send("This is an example of : ") $oAutoIt.Send("{Enter}") sleep(500) $oAutoIt.Send("How to get rid of the need of the registry,") $oAutoIt.Send("{Enter}") sleep(1000) $oAutoIt.Send("in order to run COM object like Au3X.dll") $oAutoIt.Send("{Enter}") sleep(1000) $oAutoIt.Send("{Enter}") $oAutoIt.Send("{Enter}") $oAutoIt.send("Enjoy!") See here for more REGFREE examples tested on different platforms : https://www.autoitscript.com/forum/topic/204813-use-autoitx-as-com-rot-object-without-regsvr32-registration/?do=findComment&comment=1472426 https://www.autoitscript.com/forum/topic/204813-use-autoitx-as-com-rot-object-without-regsvr32-registration/?do=findComment&comment=1472602 Enjoy !! ptrex1 point