Jump to content

creating an "insert"


ayatest
 Share

Go to solution Solved by ayatest,

Recommended Posts

Let sa that I have series of mouse clicks (and other operations), like below (this is for recording videos as well):

...

MouseClick("left",734,75,1)
Sleep(2000)
MouseClick("left",763,76,1)
Sleep(2000)
MouseClick("left",307,70,1)
Sleep(2000)
MouseClick("left",733,75,1)
Sleep(2000)
MouseClick("left",758,75,1)
Sleep(2000)
...

I'd like to define these operations in one place as an "item", that I can place in multiple places of the script later. Thus - I could edit the list separately, and use the whole item wen needed. Could someone post an example on how to make it? Thanks.

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

Link to comment
Share on other sites

 
MouseClicks()
 
Func MouseClicks()
    MouseClick("left",734,75,1)
    Sleep(2000)
    MouseClick("left",763,76,1)
    Sleep(2000)
    MouseClick("left",307,70,1)
    Sleep(2000)
    MouseClick("left",733,75,1)
    Sleep(2000)
    MouseClick("left",758,75,1)
    Sleep(2000)
EndFunc

By putting it into a function you can call this function anywhere in your script for multiple uses.

Does that help? :)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

I'm not sure yet. :-)

So the "MouseClicks" is a custom name (not AutoIt operator), yes? I ask, because mouse clicks will be one of few other items. (btw, why it;s used twice?)

And then to call the function, I do something like this?

Call("MouseClicks")

and it will perform all these steps in this particular place where it is called, yes? Or should I define smething more in the script's header?

Edited by ayatest

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

Link to comment
Share on other sites

Sorry, I'm sure it was a vague description.

Let me explain a little further. :)

Mouseclicks is a custom name I made up for the function.

When you create a function (function can be declared anywhere in the script) like so:

Func test()
  ;comment
EndFunc

You can then call that function all the time like so:

test()

So you do not have to use the Call() function.

When calling this function, it will stop wherever it is in that script, and go into the function line by line, until it has finished. Then, it will resume where it left off outside of the function.

Does that help clear things up? If not, please let me know, I'd be happy to explain anything you don't understand further. :)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Glad you got an understanding. My pleasure. ;)

Also, having a look at the AutoIt wiki will definitely give you loads of info, along with many tutorials.

EDIT: Also, on future topics (this really was just explanations) mark the answer that best solved your problem on the bottom right of the post.

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

This is my first day with autoit. :-)

Generally, from my experience, my best practice/learning, is - to have a specific problem to find a solution for it. Reading wiki and tutorials is helpful only to a certain degree, because there is a lot of terminology I don't understand (so sometimes I even don't have keywords so to speak) or don't have a context for it. It's easier for me to describe a problem (like a module, that should do something), see the code for it, and then integrate it into wider design.

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

Link to comment
Share on other sites

Which application do you try to automate?

Mouseclick is dependant on screen resolution and window positions. Most of the time there are more reliable ways to automate an application.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Multiple. I have some designs I made in Flowstone, and I have other kind of works (sometimes autoit is seeing things like buttons, sometimes not). Some of work is done for visual output (video recording), so mouse pointer must be visible and must go here and there.

But as for dependencies, correct me if I understand it wrong.

If there is a way to use relative coordinates (app window serves as offset), then I see no problem if app wanders on the screen. If not - what else can I specifically use to achieve the same functional (and visual?) mouse effect?

functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.

Link to comment
Share on other sites

If you need a visible mouse pointer then your approach is the best way in my opinion.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

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...