Sign in to follow this  
Followers 0
JohnOne

General Autoit3X question

4 posts in this topic

#1 ·  Posted (edited)

Have you ever had one of those moments where you have a thought, a moment of clarity. then as quick as it happend its gone again?

Well I did earlier today and I spent a while trying to invoke the thought again, unsucsessfuly.

All I remember was I wondered if you could call functions from Autoit3X.dll from within a regular AU3 script, and I think the thought was how such a thing could be useful.

So my question is can you think of a scenario where it might be useful?

I hope I'm making sense.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Considering AutoItX can't do anything that raw AutoIt can't, I'd have to say no.

Edited by Richard Robertson

Share this post


Link to post
Share on other sites

@JohnOne, Something like this?

Global $sAutoItX = RegRead("HKLM\Software\Wow6432Node\AutoIt v3\Autoit", "InstallDir") & "\AutoItX\AutoItX3_x64.dll"
ConsoleWrite("-> File is: " & $sAutoItX & @CRLF)


Global $oAutoIt = ObjCreate("AutoItX3.Control")
If Not IsObj($oAutoIt) Then
    _SomeCoolRegisterFunc($sAutoItX)
    $oAutoIt = ObjCreate("AutoItX3.Control")
EndIf

If Not IsObj($oAutoIt) Then
    MsgBox(48 + 262144, "Ahh!", "Something is wrong. God knows what.")
    Exit -1
EndIf

; THIS...
$oAutoIt.ToolTip("This is some tip from AutoItX version " & $oAutoIt.Version & @LF & "Visible enough?")
$oAutoIt.Sleep(2000)
$oAutoIt.ToolTip("")
$oAutoIt.ToolTip("Bye bye now...")
$oAutoIt.Sleep(800)



; Functions:
Func _SomeCoolRegisterFunc($sModule)
    If IsAdmin() Then Return _RegisterServer($sModule)
    Local $sShellExecuteString = ' /AutoIt3ExecuteLine ' & _
            '"Exit (' & _
            'DllCall(''ole32.dll'', ''long'', ''OleInitialize'', ''ptr'', 0) & ' & _
            'DllCall(''' & $sModule & ''', ''long'', ''DllRegisterServer'')' & _
            ')"'
    ShellExecuteWait('"' & @AutoItExe & '"', $sShellExecuteString, "", "runas", @SW_HIDE)
EndFunc   ;==>_SomeRegisterFunc

Func _RegisterServer($sDll)
    Local $fInit, $fError
    Local $aCall = DllCall("ole32.dll", "long", "OleInitialize", "ptr", 0)
    If Not @error Then $fInit = $aCall[0] <> 1 ; The COM library is already initialized
    $aCall = DllCall($sDll, "long", "DllRegisterServer")
    If @error Then $fError = True
    If $fInit Then DllCall("ole32.dll", "none", "OleUninitialize")
    If $fError Then Return SetError(2, 0, False)
    Return SetError($aCall[0] <> 0, $aCall[0], $aCall[0] = 0)
EndFunc   ;==>_RegisterServer

Btw, that's dumb. You know why?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

is it because its using the interpreter to make the call, and so its just plain slower that doing it normally?

My thought probably disappeard because it was stupid really, so its probably for the best I dont recall it.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0