Jump to content
Sign in to follow this  
kokoilie

Can ObjCreate be used with a program created in Autoit?

Recommended Posts

I'm using irrlight to display 3D models in a window but I can't create any controls in this window
and I thought I could compile the code and use objcreate () to display the irrlight (3D) part and overlay it with the autoit gui controls

if it won't work is there a way to add gui controls on to the window created by the .dll?

Edited by kokoilie

Share this post


Link to post
Share on other sites

I have never used it myself but maybe the >Au3Irrlicht UDF is what you are looking for.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-30 - Version 1.6.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

About the Irrlicht UDF that's exactly what i'm using.

How exactly do I cache the render and use it as background? Or more importantly how resource effective this will be?

Edited by kokoilie

Share this post


Link to post
Share on other sites

Maybe it will be the same way as to render texture from the camera, but if I can't do it with irrlicht can you tell me about a 3D system that you used or know how to work with?

Share this post


Link to post
Share on other sites

Maybe it will be the same way as to render texture from the camera, but if I can't do it with irrlicht can you tell me about a 3D system that you used or know how to work with?

I'm sorry but I have never actually done 3D programming. I know that if you hook in to DirectX or OpenGL directly instead of using a helper library, you can use almost anything as a texture source.

Share this post


Link to post
Share on other sites

It can be done by punching holes in the Gui like so...

#include "./Bin/au3Irrlicht2.au3"
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

$Gui = GUICreate("AutoIt Window", 800, 600, -1, -1)
HotKeySet("{ESC}", "_exit")

;Embed Irrlicht RenderWindow---------------------------------------------------------------------------------------
_IrrStart($IRR_EDT_opengl, 1024, 768, $IRR_BITS_PER_PIXEL_32, $IRR_windowed, $IRR_SHADOWS, $IRR_capture_EVENTS, $IRR_VERTICAL_SYNC_Off)
_IrrSetWindowCaption( "IrrLicht Window")

    Local $outer_rgn, $inner_rgn, $combined_rgn

    $outer_rgn = _WinAPI_CreateRectRgn(0, 0, 800, 600)
    $inner_rgn = _WinAPI_CreateRectRgn(103, 102, 200, 122)
    $combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0)
    _WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF)
    _WinAPI_DeleteObject($outer_rgn)
    _WinAPI_DeleteObject($inner_rgn)
    _WinAPI_SetWindowRgn(WinGetHandle("IrrLicht Window", ""), $combined_rgn)

GUICtrlCreateButton("Hey", 100, 80, 100, 22)

WinMove("IrrLicht Window", "", -3, -22)
_WinAPI_Setparent(WinGetHandle("IrrLicht Window", ""), $Gui)
WinActivate("AutoIt Window")

GUISetState()
;--------------------------------------------------------------------------------------------------------------------
;add your IrrLicht stuff here.....

WHILE _IrrRunning()

    _IrrBeginScene(128,128,128)
    _IrrDrawScene()
    _IrrEndScene()
    Sleep(5)
WEND

Func _exit()
    _IrrStop()
    Exit
EndFunc ; _exit

Some guy's script + some other guy's script = my script!

Share this post


Link to post
Share on other sites

Thanks Werty, works like a charm.

Never thought I could use that (actually never knew it's an option). Well guess i'm still green and have much to learn.

One more thing... can I put those "punched holes" back or should I try to make the whole gui that way?

Share this post


Link to post
Share on other sites

It would be easier just making the autoit window wider than the irrlicht window, now that's it's embedded, and then use the extra space for controls like buttons, tabs etc.

Then there's no need to punch holes.

Something like this...

#include "./Bin/au3Irrlicht2.au3"
;#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

$Gui = GUICreate("AutoIt Window", 800, 458, -1, -1)
HotKeySet("{ESC}", "_exit")

;Embed Irrlicht RenderWindow---------------------------------------------------------------------------------------
_IrrStart($IRR_EDT_opengl, 640, 480, $IRR_BITS_PER_PIXEL_32, $IRR_windowed, $IRR_SHADOWS, $IRR_capture_EVENTS, $IRR_VERTICAL_SYNC_Off)
_IrrSetWindowCaption( "IrrLicht Window")
_WinAPI_SetWindowRgn(WinGetHandle("IrrLicht Window", ""), _WinAPI_CreateRectRgn(3, 22, 640, 480)) ; Cut off IrrLicht Window Border

GUICtrlCreateButton("Hey1", 680, 40, 100, 22)
GUICtrlCreateButton("Hey2", 680, 80, 100, 22)
GUICtrlCreateButton("Hey3", 680, 120, 100, 22)


WinMove("IrrLicht Window", "", -3, -22)
_WinAPI_Setparent(WinGetHandle("IrrLicht Window", ""), $Gui)
WinActivate("AutoIt Window")

GUISetState()
;--------------------------------------------------------------------------------------------------------------------
;add your IrrLicht stuff here.....

WHILE _IrrRunning()

    _IrrBeginScene(128,128,128)
    _IrrDrawScene()
    _IrrEndScene()
    Sleep(5)


WEND

Func _exit()
    _IrrStop()
    Exit
EndFunc ; _exit

Some guy's script + some other guy's script = my script!

Share this post


Link to post
Share on other sites

Actually now that I started playing with it and reversed the setparrent part so that the gui is child to the irrlicht render
so to hide the controls I don't want to see I just call GUISetState (@SW_HIDE)

Also the way I want to make it I don't even need to make the gui transparent while it's visible 

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By jantograaf
      Hi all,
      I'm trying to write a script that connects with a VBA/COM API to get the status of a connected phone. I've been looking up and down this forum for tips or other user's experiences, but I can't seem to find anything (even remotely) similar. It shouldn't be so hard to do, however.
      Software I'm trying to connect to
      I'm trying to integrate CallCenter by using their API, which is documented over here : JustRemotePhone API Reference
      Things I've tried
      I've tried using ObjCreate but I don't get any result, it always returns the same (negative) error.
      #Version 1 tried ObjCreate("JustRemotePhone.RemotePhoneService") #Version 2 tried ObjCreate("JustRemotePhoneCOM.RemotePhoneService") #Version 3 tried ObjCreate("JustRemotePhoneCOM.RemotePhoneService.Application") None of the three versions I tried seem to deliver any result other than a negative error value which basically says that the given class is not valid.
      I am starting to get the hang of AutoIt by now, but unmanaged programming languages and object-oriented stuff is still quite a grey zone for me. If anyone could help me 'talk' to this application, I'd be immensely grateful!
      Thanks in advance and kind regards from Belgium!
       
      Jan
    • By GarnetDagger
      I would love to have some help or guidance 
      I am able to Query from my database but I am not able to Update or insert etc because I lack the knowledge for it
       
      this is my code for to retrieve some data from and works perfect
       
      Dim $ueberschriften = "" Dim $anzahl = 0 Dim $dsncount = 1 Global $DSN = "MTXXV5" Global $Query = "Select * from VIEWS" Func SSSQL($SSQuery) ;SuperSonicSQL     ConsoleWrite($SSQuery & @LF)     $cmboVal = ""     $adoCon = ObjCreate("ADODB.Connection")     $adoCon.Open($DSN)     $adoRs = ObjCreate("ADODB.Recordset")     $adoSQL = $SSQuery     $adoRs.CursorType = 2     $adoRs.LockType = 3     $adoRs.Open($adoSQL, $adoCon)     With $adoRs         Global $QueryAnswer = .GetRows     EndWith     Return $QueryAnswer EndFunc   ;==>SSSQL and this is my failed attempt, The Query is correct but I want to able to use it in autoit instead of have to manual update or insert into flamerobin
       
      $SS_SQL_Insert_or_Update = "INSERT INTO DETECTION (DNAME,DTYPE,WINNAME,AREA,COLOR,MOUSE) VALUES ('PopUpTradeInviteYes        s                    ','SEARCH','XXX','175,240,550,240,65,228,82,234','5062478','0') " Func SSSQLIU($SS_SQL_Insert_or_Update) ;SuperSonicSQL :P     $cmboVal = ""     $adoCon = ObjCreate("ADODB.Connection")     $adoCon.Open($DSN)     $adoRs = ObjCreate("ADODB.Record")     $adoSQL =$SS_SQL_Insert_or_Update ;~     $adoRs.CursorType = 2     $adoRs.LockType = 4     $adoRs.Open($adoSQL, $adoCon) ;~     With $adoRs ;~         Global $QueryAnswer = .GetRows ;~     EndWith ;~     Return $QueryAnswer EndFunc   ;==>SSSQL I am at a total loss and I am just trying this at random but I am also going to sleep now
      I would love to have some minor examples
      "C:\_CC_V10_DetectionTAB.au3" (174) : ==> The requested action with this object has failed.:
      $adoRs.Open($adoSQL, $adoCon)
      $adoRs^ ERROR
    • By RichardL
      Local $sAxName Local $oMSComm $sAxName = "MSCOMMLib.MSComm.1" $oMSComm = ObjCreate($sAxName) MsgBox(0, Default, StringFormat("Name: %s, Obj %d, Err %d", $sAxName, IsObj($oMSComm), @error)) I'm talking to serial ports (for Arduino) using the MSComm object.  It all runs fine from SciTE or .exe.  If I compile to .a3x the object is not created.  I could manage without .a3x but I like it because it compiles faster.
       
       
    • By BobRoss
      Hi All,
      Now before I start, I have trawled through the forum & elsewhere for the last 24 hours or so & found nothing to even point me in the right direction.
      I have a rather large script that's doing various (AD reads & applying RegWrites based on the SID & AD reads....) & I've stripped it all back & the problem appears to lie with the create object which is calling a sproc I wrote to pull back various based on params passed.
      Now for the actual issue, all worked fine first time everywhere apart from within a Citrix xenapp session which is when I'm getting hit with the Exception Occured Script Line -1 - Variable must be of type 'Object'.
      Here is a stripped back portion which I've been testing with against xenapp (with a MsgBox added to easily see if anything did return), can anyone notice anything glaringly stupid that I'm doing?
      Global $AppError = ObjEvent("AutoIt.Error","ErrFunc") $Emp=@UserName $adDSN="Driver={SQL Server};Server=*****;Database=*****;Uid=****;Pwd=*****" $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ($adDSN) $FNsQuery = "exec [ooo_sp_ad_user] @user="&$Emp&",@type=1" $FNresult = $adCN.Execute($FNsQuery) $ADFirstName=$FNresult.Fields("").Value MsgBox(0, "AD Test", $ADFirstName) $adCN.Close Func ErrFunc() Local $HexNumber Local $strMsg $HexNumber = Hex($AppError.Number, 8) $strMsg = "Error Number: " & $HexNumber & @CRLF $strMsg &= "WinDescription: " & $AppError.WinDescription & @CRLF $strMsg &= "Script Line: " & $AppError.ScriptLine & @CRLF MsgBox(0, "ERROR", $strMsg) SetError(1) Endfunc Any pointers at all would be greatly appreciated.
      Thanks
      Bob
    • By AndyS01
      I have a test file that creates an Excel.Application object, and it works OK when I run it with F5, but when I compile it and run the executble, the operation fails.   Here is my code: Opt('MustDeclareVars', 1) Global $oMyError, $oExcel _Main() Exit (1) Func _Main() Local $str $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Initialize a COM error handler If IsObj($oMyError) Then $oExcel = ObjCreate("Excel.Application") If IsObj($oExcel) Then $str = "Created the Excel.Application object OK" Else $str = "ObjCreate() FAILED!" EndIf Else $str = "ObjEvent() FAILED!" EndIf MsgBox(0, "results", $str) EndFunc ;==>_Main Func MyErrFunc() Local $str $str = "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext ClipPut($str) MsgBox(0, "AutoItCOM Test", $str & @CRLF & "(results are in the clipboard)") Exit (1) EndFunc ;==>MyErrFunc Here is the error info:
      We intercepted a COM Error ! err.description is: err.windescription: Not enough storage is available to complete this operation. err.number is: 8007000E err.lastdllerror is: 0 err.scriptline is: -1 err.source is: err.helpfile is: err.helpcontext is:
×
×
  • Create New...