Jump to content

Runnning 2 times the same script and getting different results - ScriptWriter


Recommended Posts

Hello,

I'm trying to send an email automatically with Outlook.
I got a script moving the mouse thanks to Script Writter tool and it worked well. However, after restarting my computer, the  movement of the mouse doesn't click on the rght buttoms anymore although the desktop is exactly in the same conditions than before (item's positions, ...). I thought that the MousePosition was something absolute. 

Here is the script I use :

 

#region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=0000040C)  ---

#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '')
If $aResult[1] <> '0000040C' Then
  MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(0000040C->' & $aResult[1] & ')')
EndIf

EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

_AU3RecordSetup()
#endregion --- Internal functions Au3Recorder End ---

MouseClick("left",599,1419,1)
_WinWaitActivate("Boîte de réception - ################## - Outlook","Dernière modificatio")
MouseClick("left",45,118,1)
_WinWaitActivate("Sans titre - Message (HTML) ","&Revenir au message")
Send("############{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{SHIFTDOWN};{SHIFTUP}####{ENTER}")
MouseClick("left",216,244,1)
Send("{SHIFTDOWN}t{SHIFTUP}est")
MouseMove(31,268)
MouseDown("left")
MouseMove(71,284)
MouseUp("left")
_WinWaitActivate("Test - Message (HTML) ","&Revenir au message")
Send("{SHIFTDOWN}l{SHIFTUP}e{SPACE}bot{SPACE}fonctionne{SPACE}toujours{SHIFTDOWN};{SHIFTUP}")
MouseClick("left",45,212,1)
#endregion --- Au3Recorder generated code End ---

I really don't understand what's happenning.

Thank you for your help. 

Edited by Melba23
Personal info removed
Link to comment
Share on other sites

  • Developers

Don't use the point and click method when not needed!
There are UDF's available to send an outlook email in the background with usig a mouse or keyboard. Just search the forums.

JOs

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

Thank you for your answer. 
Actually, this Outlook script is just a test, I would like to create a script to make automatic back up in an old software. I don't have the API of this software and there is no automatic back up feature. Therefore, the only solution is to make a script that only makes mouse movement and text sending to reproduce all the actions I manually do to save a file in this software.

Thus, I will use a lot of point and click method. There is no way to use it properly ?

 

Thank you for your help. 

Link to comment
Share on other sites

  • Moderators

First off, when you say "ScriptWriter" I am assuming you mean au3record? That is, by its very nature, an unstable way to write any script. And if you want to write a "backup in an old software", why test and ask questions on Outlook rather than just asking your question on the software you actually are trying to automate? What is the software? And what do you find when you hover over the application's window with the AutoIt Window Info Tool (in the same directory where you installed AutoIt)?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Yes I mean au3record. 

You're right, the software is named "Ciel". When you open it, you have as usual a toolbar. The different actions to save are : 

1) Click on the buttom "Folder" in the toolbar which open it with drop-down list2) Click on the "Save and restaure" buttom in the drop-down list which opens another short drop-down list

3) Click on the "save" buttom is this last list which will open a new window

4) Write the destination folder in a bar of the window

5) Click on "save" buttom in the window

6) Wait until this file is well saved (it takes a few seconds)

Then I restart the operation with another file that I open. So I must wait between the 2 operations by adding a "sleep".

What do you mean by what I can see with the  AutoIt Window Info Tool  ? I see the same info than usually (Class, title, ...)

Thank you

Link to comment
Share on other sites

  • Moderators

So, hover over the "Folder" button and then post a screenshot of the Window Info Tool's output for that button please.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I will have access to the software tomorrow, I will do it as soon as possible. 

May I ask you why ? Which info are you looking for ? Finally, is that possible to make such script according to you ? What are the conditions that would make this possible ? 

Thank you

Link to comment
Share on other sites

Hello,

I would like to create a script to make automatic back up in an old software. I don't have the API of this software and there is no automatic back up feature. Therefore, the only solution is to make a script that only makes mouse movement and text sending to reproduce all the actions I manually do to save a file in this software.

When you open the software, you have as usual a toolbar. The different actions to save are : 

1) Click on the buttom "Folder" in the toolbar which open it with drop-down list

2) Click on the "Save and restaure" buttom in the drop-down list which opens another short drop-down list

3) Click on the "save" buttom is this last list which will open a new window

4) Write the destination folder in a bar of the window

5) Click on "save" buttom in the window

6) Wait until this file is well saved (it takes a few seconds)

Then I restart the operation with another file that I open. So I must wait between the 2 operations by adding a "sleep".

 

I know that scripts with MouseMove and MouseClick are not very stable. Is there a way to code this script so that it works properly ? 

Link to comment
Share on other sites

  • Moderators

KB505,

Stick to just the one thread please.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

If the Window Info Tool returns information about the different Controls (Buttons, Menu Items, etc.) then it will be much easier to perform the task you're after.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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