Jump to content
Sign in to follow this  
LetsAuto

AutoIt scripts IN VB2010

Recommended Posts

LetsAuto

Hi everyone. I dont know how to import AutoIt scripts to a standard Visual Basic program (in visual basic 2010), and I really need to learn how to do this in order to get my stuff done. If anyone could try to help me, i need to design a multi-step gui and it would be so much easier on VB, but i need the scripting functions as well. to cut out the junk --- how do i get an AutoIt script inside of a VB2010 program?

Share this post


Link to post
Share on other sites
water

Why do you think creating/handling a GUI is much easier in VB? What have you tried so far in AutoIt? Koda?

I think AutoIt is as good in GUI creation/handling as in the rest of the scripting functionality you want to do with AutoIt.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
LetsAuto

okay, so I have tried creating the GUI in AutoIt and it does work, with the options i want it to have, but I am much more familiar with VB and the

script i was given to work with was already written in AutoIt so I wanted to keep that going. I dont know what Koda is so i have not tried anything

with that. but for me personally VB would be easier. i love autoIt for the scripting but trying to figure out how to create an installation wizard

using AutoIt is getting very stressful because i dont know the language that well

Share this post


Link to post
Share on other sites
wraithdu

You cannot directly include a script via AutoItX (either COM or direct DLL API). You should read the AutoItX help file to familiarize yourself with the COM / DLL interfaces and the available functions.

Share this post


Link to post
Share on other sites
water

Koda is the graphical GUI designer for AutoIt. You create the GUI by moving the controls to the positions you need. Then Koda creates the AutoIt code for you.

Press Alt+m in SciTE and you will see what I mean.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
LetsAuto

@water, are you sure it's Alt+m? because it just gives me that little ding noise.. im using AutoIt v3, maybe its a different hotkey?

@wraithdu, and if that is the case, is it even possible to add an AutoIt script to VB?

Share this post


Link to post
Share on other sites
wraithdu

That's my point, no you cannot just 'add a script' to any other language. AutoItX provides COM and DLL API access to a subset of AutoIt's core functions, but you need to use these as you would any other 3rd party library. It does not have a facility to just import or run an actual AutoIt script.

Share this post


Link to post
Share on other sites
water

If you click the "Tools" tab in SciTE and the entry "Koda (Forms Designer)" is missing then you didn't install the full SciTE package.

Go to this page and download "AutoIt Script Editor. (Customised version of SciTE with lots of additional coding tools for AutoIt)".


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
LetsAuto

right, so if i want to import the library using the COM capabilities of VB2010, how would i go about doing that? because i did

Add a reference...

COM...

AutoItX3 1.0 Type Library

OK

and then it went to the RECENT tab of the Add Reference window on VB... what do i do from here?

Share this post


Link to post
Share on other sites
LetsAuto

thank you, now Koda does work.. but along with that i would like to know how to finish the COM stuff for VB as well

Share this post


Link to post
Share on other sites
water

Maybe thread helps?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
LetsAuto

Im sorry, quite honestly it did not help at all.. i just need some step by step instructions... and honestly, i dont know where i can find the dll or autoitv3, or the COM stuff...

Share this post


Link to post
Share on other sites
LetsAuto

i got the library imported to VB, i dont especially like the feel of Koda... but now in VB i have

Namespace AutoItX3Lib
Class dll
Mouseclick("primary",455,300,1,75)
sleep(500)
MouseClick("primary",455,343,1,75)
sleep(500)
End Class
End Namespace

but thats in VB not au3... its saying its expecting a declaration...? and im guessing from there i just call it to the actual program?

Share this post


Link to post
Share on other sites
water

In the directory where you installed AutoIt is a subdirectory named "AutoItX". There you'll find an AutoItX.chm file which should give you further information or even examples.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
LetsAuto

thats good an all, but i follow the cmd instructions, and its saying that its registered as AutoitX3.Control.. and my VB is only finding the AutoItX3Lib.dll.... this is the first time ive done language blends and im having a very difficult time with this. thank you for all of your help so far also

Share this post


Link to post
Share on other sites
Richard Robertson

Do you actually know how to use VB.Net? Because that "sample" code you posted shows a clear misunderstanding of it. I believe you need to learn both languages and be very comfortable with both before trying to combine them.

Share this post


Link to post
Share on other sites
LetsAuto

i do know vb, that was just copy paste from an AutoIt because i had no clue what i was doing and i was just trying random things to see if i was doing it right.. that was just the dll.vb which i have never used or seen on vb because i have never tried to mix languages... all i want to do is design a wzard using VB.. and then just call an AutoIt function for the very last button of the GUI..... so there is only one projected instance of AutoIt3 in my entire solution

Share this post


Link to post
Share on other sites
LetsAuto

okay, i just found a link where i can create the GUI and just tell my au3 file to run the vb solution first.... ?

Share this post


Link to post
Share on other sites
LetsAuto

well can i create an autoIt that runs a VB script? i mean i can get it to run an application, so whats so different about it running a solution?

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  

  • Similar Content

    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning community!
      I am working on a script which read from a text file ( .txt ) and should import all the content in a SQLite3 DB, in order to execute some queries that should be difficult to execute on a text file.
      So, I was looking for something very very fast, because the file could be very large ( I don't know exaclty how much can became big, but I know a lot of rows, it's a log file ... )
      I found the "Import method", but I don't know If I can implement it in a query ( @jchd, it's your turn!  )
      Do you know some methods that I can implement in my script to have a very very fast import of thousands and thousands rows in a SQLite3 DB?
      Thanks a lot
      Francesco
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      I'm working on this little project for a week, and, what I'm trying to do could be useful for many users as well...
      I'm trying to do a "Report Generator", which reads the data that have to report from a text file (.txt) formatted with this pattern;
      Data1;Data2;Data3;Data4;Data5;;

      YES, there are 2 semi-colon at the end of the line.

      In detail, Data1 is a date/time stamp with this format: YYYY/MM/DD HH:MM:SS ;

      When the script starts, the user is prompted to choose 2 dates which I'll call as:
      Report_Date_Start; Report_Date_Start. So, the report, should cover all dates between Report_Date_Start AND Report_Date_End.

      And, already at this point, I don't know how to do the query... How can I say to the script:
      SELECT * FROM (.txt) WHERE Data1 BETWEEN Report_Date_Start AND Report_Date_End; ?

      I thought that I could do a _DateDiff, but if the difference between the two dates is months and not days, how can I do the trick?
      Should I make a Switch...Case with the _DateDiff() and see then calculate all the dates between Report_Date_Start AND Report_Date_End... But then, how can I compare the dates in the file with all the dates between Report_Date_Start AND Report_Date_End? I'm going crazy, I know...

      I've already made a "Export Tool", which exports the content of the .txt file in a .db, managed with SQLite... I mean, there I could easily do a query like I did above the thread, but, this "export", for 1080 rows, takes 28 seconds to be done. And, 1080 rows are daily rows that are added every day in the .txt file, so, in a week, the file could be easily 7000+ rows, which means that the "export" would take 3 minutes to be done... And we can go over and over...
      I'll post just for be "complete" what I've done about the export, so, maybe, someone could say how to improve it in terms of efficency...
       
      Local $aContenutoFileAuditReport = "" _FileReadToArray($sFileAudit_Report, $aContenutoFileAuditReport) If(IsArray($aContenutoFileAuditReport) And Not @error) Then Local $aContenutoFileAuditReport_Splitted = "" Local $sQuery = "" Local $hInizioConteggio = TimerInit() For $i = 1 To UBound($aContenutoFileAuditReport) - 1 $aContenutoFileAuditReport_Splitted = StringSplit($aContenutoFileAuditReport[$i], ";") $sQuery = "INSERT INTO FileDB_Report(DATESTAMP, TIMESTAMP, USER_ID, OBJECT_ID, DESCRIPTION, COMMENT) " & _ "VALUES(" & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[0]) & "," & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[1]) & "," & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[3]) & "," & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[4]) & "," & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[5]) & "," & _ _SQLite_FastEscape($aContenutoFileAuditReport_Splitted[6]) & ");" If(_SQLite_Exec($hFileDB_Report, $sQuery) <> $SQLITE_OK) Then ConsoleWrite("Errore durante l'esecuzione della query #" & $i & @CRLF) Else ConsoleWrite("Query eseguita correttamente #" & $i & @CRLF) EndIf Next ConsoleWrite("Esportazione completata in: " & Round(TimerDiff($hInizioConteggio)/1000, 0) & " secondi") Else MsgBox($MB_ICONERROR, "Errore!", "Errore durante la lettura del file nell'array." & @CRLF & "Errore: " & @error) EndIf I know that I can't do queries from a .txt file...
      [19:18] 
      I've been writing this post from 18:40 maybe...
      By the way, if @jchd or someone else could tell me if I can import a formatted .txt file in SQLite and then, do queries on the DB, I'd be very happy for that...
      About the report in PDF, I'm talking with @taietel in order to know how to create a PDF.
      I hope someone will help me
      Sorry for the "long" list of questions...
      Thank you for everything you've done for me
      I have to say that this is the community of programming language that I've loved most!
      By the way, I'll be back tomorrow in the morning ( ~ 9:15 a.m. Italian time ), so, excuse me if I can't answer before that time.
      Hope you guys have a wonderful day/night.

      Thanks again

      Francesco
    • PINTO1927
      By PINTO1927
       
      Hello guys, I would have the need to import into the GUICtrlCreateListView all * .txt files in a folder. The * .txt files contain all of the same formatting separated by "|", the script should go on every single file and bring me back the result in the GUICtrlCreateListView. For now I only managed to upload a single file * .txt into the GUICtrlCreateListView with this code:
      Case $Button_Find $File_txt = "\\cond\UPDATE\test.txt" Dim $Array_List _FileReadToArray($File_txt, $Array_List) $Limit_Array = UBound($Array_List) - 1 For $i = 1 To $Limit_Array $All_Box = String($Array_List[$i]) GUICtrlCreateListViewItem($All_Box, $List) Next For $i2 = 0 To _GUICtrlListView_GetColumnCount($List) _GUICtrlListView_SetColumnWidth($List, $i2, $LVSCW_AUTOSIZE_USEHEADER) Next
    • PINTO1927
      By PINTO1927
      Hello guys,
      I built a gui where a GUICtrlCreateListView with two columns is present.
      Through an "Import" button I would be able to import the contents of an .xls or .txt.
      Can you help me?
      Thank's
    • ur
      By ur
      Is there any way to skip the execution of a particular block of code like any condition or expression, if the au3 file is included as library.?
      Like, in my code I wrote all the functionality as functions and called them in 4 lines.
      Now I have another requirement where I need to use the same code but different.So I am importing this code so that I can use these functions.
      But the code block which is outside the functions (main code) is being executed when I import the au3 file.Is there any condition to check whether the file is running directly or included in another au3 file as library, so that I can keep the same here.
       
      Please suggest if any ideas.
×