KB505

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

10 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted

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

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted

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. 

Share this post


Link to post
Share on other sites

#4 ·  Posted

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)?

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  Posted

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

Share this post


Link to post
Share on other sites

#6 ·  Posted

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


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#7 ·  Posted

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

Share this post


Link to post
Share on other sites

#8 ·  Posted

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 ? 

Share this post


Link to post
Share on other sites

#9 ·  Posted

KB505,

Stick to just the one thread please.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#10 ·  Posted

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.


√-1 2^3 ∑ π, and it was delicious!

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