Jump to content

AUTOIT BASICS


rkr
 Share

Recommended Posts

Hi, i am new to Autoit. I was trying to automate a simple process with excel on win10. the code is below. i initially ran with mousecoordinates set to screen option(default) - it ran seamless

#include <AutoItConstants.au3>
run("C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE","",@SW_MAXIMIZE)
;run(
winwait("Excel")
;MouseClick("left", 555, 272, 3, 0)
MouseClick("primary", 490, 351, 32, 0)
winwait("Book1 - Excel")
MouseClick("primary", 56, 236, 1, 0)
send("hello")
Send("{TAB 4}")
send("check")

.. the code was slightly altered, and when i opted mousecoords to window origin, excel window opens behind the active window ( i have to minimise the active window and click manually to continue from line 4 below)

#include <AutoItConstants.au3>
AutoItSetOption("MouseCoordMode",0)
run("C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE","",@SW_MAXIMIZE)
;run(
Global $a1, $a2 , $a3
$a1=1.0
$a2=2.5
$a3=$a1+$a2
winwait("Excel")
;
DirCreate ( "d:\xyz\abc" )
MouseClick("primary", 513, 227, 33, 0)
winwait("Book1 - Excel")
MouseClick("primary", 62, 242, 1, 0);Opt("MouseCoordMode",0)
;
send($a1)
Send("{TAB 1}")
send($a2)
Send("{TAB 1}")
send($a3)
mouseclick("primary",0,0,3,0)
;Send("{TAB 1}")
send("{enter}")
mouseclick("primary",218,352,1,0)
send("d:\xyz\abc\11.xlsx" )
send("{enter}")


 

Link to comment
Share on other sites

  • Developers

You would want to use _EXEL_* Functions available in AutoIt3 in stead of trying to do this with mouse clicks/

Jos

Edited by Jos
Typo

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I would first try the _Excel_* functions ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

We are :)
I just undergo our yearly security audit. So I'm definitely in "picky" mode this week :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

thanks all.. is there a good book to go through for Autoit. i feel the online/autoit help file a bit non structured.. Eg; it doesnt explain why particular libraries are included.. i felt that the tutorial lacks a flow. please suggest

Link to comment
Share on other sites

Please check the tutorials in the wiki. 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

14 minutes ago, rkr said:

Eg; it doesnt explain why particular libraries are included..

An easy way to figure out why something was included in the script is to comment it out and see what the result is.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

@rkr not sure what you expect from a flow.  Tell your programming background and you get better direction. If you are a full starter in programming then its better to look on google for a base introduction in programming.

As given above it starts here https://www.autoitscript.com/ and from there you reach wiki, help, tutorials etc.

As you need excel you have to open it and then basically it starts here https://www.autoitscript.com/autoit3/docs/libfunctions/_Excel_Open.htm

And a full list https://www.autoitscript.com/autoit3/docs/libfunctions/

To me it does not make sense to say that include excel.au3 will help in reaching out to excel it certainly will not do something with ms word. And normally it works the other way around. When you are going to use a certain function the help will tell you which library to include. 

 

 

Edited by junkew
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...