13lack13lade Posted July 23, 2013 Share Posted July 23, 2013 (edited) Hi Everyone! New AutoIt user, not a programmer in anyway however i am an excel power user and do know enough VBA to create macros etc however i have only ever taught myself and am having quite some trouble with AutoIt.. I am moving onto AutoIt now to automate alot of my excel macros i created for database manipulation but cannot for the life of me understand the coding... Have googled and youtubed for hours trying to find any sort of info i can... I have even read the UDF syntax however when i to do something, it never works... What im trying to do: I need to be able to open excel file, pull data out, open & paste into a datauploading program, open the CRM program and login, run the datauploading program script and then log out, close everything. What i don't understand: #include <Excel.au3> _ExcelBookOpen($sFilePath [, $fVisible = 1 [, $fReadOnly = False [, $sPassword = "" [, $sWritePassword = ""]]]]) Local $sFilePath1 = @ScriptDir & "Test.xls" ;This file should already existLocal $oExcel = _ExcelBookOpen($sFilePath1)If @error = 1 ThenMsgBox(0, "Error!", "Unable to Create the Excel Object")ExitElseIf @error = 2 ThenMsgBox(0, "Error!", "File does not exist - Shame on you!")ExitEndIf This is the example from the AutoIt Help and i dont understand where the @scriptDir came from? where the file path goes etc.. i know once i understand how it works i will be able to manipulate it like VBA but initally just dont understand.. Like i dont understand which is commands and what parts i change to suit me specifically... Any tips/advice/help would be muchly appreciated. - Apologies if this is a stupid post i just cannot find good information on AutoIt working with Excel. Edited July 23, 2013 by 13lack13lade Link to comment Share on other sites More sharing options...
water Posted July 23, 2013 Share Posted July 23, 2013 Is this statement in your script? _ExcelBookOpen($sFilePath [, $fVisible = 1 [, $fReadOnly = False [, $sPassword = "" [, $sWritePassword = ""]]]]) That's just the syntax description. Brackets denote optional parameters. So the above line should - if you use all default parameters - look like: _ExcelBookOpen($sFilePath, 1, False, "", "") My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
13lack13lade Posted July 23, 2013 Author Share Posted July 23, 2013 No i was simply using this as an example because obviously im going to need to open the excel file and thought this would be a good start. What i mean is $sFilePath would that mean that its _ExcelBookOpen($sC:/blahblah/blah.xls) or is $sFilePath the command? just unsure on how to use the syntax correctly Link to comment Share on other sites More sharing options...
water Posted July 23, 2013 Share Posted July 23, 2013 $sFilePath is a variable. Either use _ExcelBookOpen("C:\blahblah\blah.xls") or $sFilePath = "C:\blahblah\blah.xls" _ExcelBookOpen($sFilePath) And yes, you need to read the help file or some tutorials about the basics of AutoIt. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted July 23, 2013 Share Posted July 23, 2013 BTW: The Excel UDF that comes with AutoIt doesn't support the "new" formats (xlsx etc.), only okrs on the active worksheet and has some other limitations. If you like you can test my rewrite of the UDF (still an Alpha version). For download please see my signature. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
13lack13lade Posted July 23, 2013 Author Share Posted July 23, 2013 Thank you for your help, i will definately give the UDF a go and spend sometime going through the tutorials. I think i was just over complicating things and the code is abit intimidating at first but i look forward to figuring it out, it seems the possibilities for automation are endless! Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now