Sign in to follow this  
Followers 0
Burrug

Macro runs stuck

11 posts in this topic

Hello,

I have created a macro with the ScriptWriter so I can automate the process of exporting a bunch of data from a database to an .xls file.

All of a sudden this recorded macro runs stuck, it just doen't continue like it doesn't recougnise the window within the software I use to export the data (Exact for Windows, a Dutch accounting program).

Is this a known bug, or am I doing something wrong?


Metal up your Ass..!

Share this post


Link to post
Share on other sites



Hello,

I have created a macro with the ScriptWriter so I can automate the process of exporting a bunch of data from a database to an .xls file.

All of a sudden this recorded macro runs stuck, it just doen't continue like it doesn't recougnise the window within the software I use to export the data (Exact for Windows, a Dutch accounting program).

Is this a known bug, or am I doing something wrong?

Couple of things here:

- Think you choose the wrong forum... (moved to Support)

- How in the world can you expect from us to give a proper answer with the info given, but my educated guess is that you have logic flaw in the script ...

Something like a WinWait() or WinWaitActive() could cause behaviour like this.

You will have to do some debugging to find the resaon for this issue.

Opt("TrayIconDebug", 1) could help you out .....


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 (edited)

The Opt("TrayIconDebug", 1) doesn't help for debugging, this is the piece of the script where it fails:

Line 23 t/m 42 (fail on 25)

WinWait("Exact voor Windows, versie 3.73 (Systeemonderhoud)","")
If Not WinActive("Exact voor Windows, versie 3.73 (Systeemonderhoud)","") Then WinActivate("Exact voor Windows, versie 3.73 (Systeemonderhoud)","")
WinWaitActive("Exact voor Windows, versie 3.73 (Systeemonderhoud)","")
MouseMove(473,25)
MouseDown("left")
MouseUp("left")
MouseMove(428,52)
MouseDown("left")
MouseUp("left")
WinWait("100 Exact Rapport","&Verplaatsen")
If Not WinActive("100 Exact Rapport","&Verplaatsen") Then WinActivate("100 Exact Rapport","&Verplaatsen")
WinWaitActive("100 Exact Rapport","&Verplaatsen")
MouseMove(295,101)
MouseDown("left")
MouseUp("left")
MouseMove(452,104)
MouseDown("left")
MouseUp("left")
WinWait("100 Artikelen","&Exporteren")
If Not WinActive("100 Artikelen","&Exporteren") Then WinActivate("100 Artikelen","&Exporteren")

So it does seem to fail on WinWaitActive() or WinWait()

Edited by Burrug

Metal up your Ass..!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This is something that your script translates to by a script I have.

_WinWaitActive("Exact voor Windows, versie 3.73 (Systeemonderhoud)", "")
MouseClick("left", 473, 25)
MouseClick("left", 428, 52)
_WinWaitActive("100 Exact Rapport", "&Verplaatsen")
MouseClick("left", 295, 101)
MouseClick("left", 452, 104)
WinWait("100 Artikelen", "&Exporteren")
If Not WinActive("100 Artikelen", "&Exporteren") Then WinActivate("100 Artikelen", "&Exporteren")

Func _WinWaitActive($title, $text = "")
    WinWait($title, $text)
    If Not WinActive($title, $text) Then
        WinActivate($title, $text)
    EndIf
    WinWaitActive($title, $text)
EndFunc

You have 3 windows and you nouseclick twice on 2 of them. Hmm, what can I say but totally unaware of your problem with this script and the script ends with a window with no action. Sorry, but generated scripts like this are dependant on resolution and many other factors that is hard for a forum member (like myself) to debug :whistle: .

Edited by MHz

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yes I do understand that, it's a difficult problem to solve from a distance..

Now I have made this of my script:

line 1 to 50

Opt("TrayIconDebug",1)
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Opt("TrayIconDebug",1)
Func _WinWaitActive($title, $text = "")
    WinWait($title, $text)
    If Not WinActive($title, $text) Then
        WinActivate($title, $text)
    EndIf
    WinWaitActive($title, $text)
EndFunc
WinWait("Program Manager","FolderView")
If Not WinActive("Program Manager","FolderView") Then WinActivate("Program Manager","FolderView")
WinWaitActive("Program Manager","FolderView")
MouseMove(1251,25)
MouseDown("left")
MouseUp("left")
Send("{ENTER}")
WinWait("Exact voor Windows, versie 3.7","Gebruikersnaam")
If Not WinActive("Exact voor Windows, versie 3.7","Gebruikersnaam") Then WinActivate("Exact voor Windows, versie 3.7","Gebruikersnaam")
WinWaitActive("Exact voor Windows, versie 3.7","Gebruikersnaam")
Send("********{ENTER}")
WinWait("Administratie openen","M:\ADMINI~1\EXACT\10")
If Not WinActive("Administratie openen","M:\ADMINI~1\EXACT\10") Then WinActivate("Administratie openen","M:\ADMINI~1\EXACT\10")
WinWaitActive("Administratie openen","M:\ADMINI~1\EXACT\10")
MouseMove(374,48)
MouseDown("left")
MouseUp("left")
WinWait("Exact voor Windows, versie 3.73 (Systeemonderhoud)","")
If Not WinActive("Exact voor Windows, versie 3.73 (Systeemonderhoud)","") Then WinActivate("Exact voor Windows, versie 3.73 (Systeemonderhoud)","")
_WinWaitActive("Exact voor Windows, versie 3.73 (Systeemonderhoud)","")
MouseMove(473,25)
MouseDown("left")
MouseUp("left")
MouseMove(428,52)
MouseDown("left")
MouseUp("left")
WinWait("100 Exact Rapport","&Verplaatsen")
If Not WinActive("100 Exact Rapport","&Verplaatsen") Then WinActivate("100 Exact Rapport","&Verplaatsen")
_WinWaitActive("100 Exact Rapport","&Verplaatsen")
MouseMove(295,101)
MouseDown("left")
MouseUp("left")
MouseMove(452,104)
MouseDown("left")
MouseUp("left")
WinWait("100 Artikelen","&Exporteren")
If Not WinActive("100 Artikelen","&Exporteren") Then WinActivate("100 Artikelen","&Exporteren")

It still doesn't work and I don't get any debugmessages or something like it...

Edited by Burrug

Metal up your Ass..!

Share this post


Link to post
Share on other sites

hover over your tray icon when the program gets hung ( using the Opt("TrayIconDebug", 1) line ) that will give you the debugging message(s)

Share this post


Link to post
Share on other sites

You will not get debug messages.

This is what I see atm.

Opt("TrayIconDebug", 1)
Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 0)
Opt("TrayIconDebug", 1)

_WinWaitActive("Program Manager", "FolderView")
MouseClick("left", 1251, 25)
Send("{ENTER}")
_WinWaitActive("Exact voor Windows, versie 3.7", "Gebruikersnaam")
Send("********{ENTER}")
_WinWaitActive("Administratie openen", "M:\ADMINI~1\EXACT\10")
MouseClick("left", 374, 48)
_WinWaitActive("Exact voor Windows, versie 3.73 (Systeemonderhoud)", "")
MouseClick("left", 473, 25)
MouseClick("left", 428, 52)
_WinWaitActive("100 Exact Rapport", "&Verplaatsen")
MouseClick("left", 295, 101)
MouseClick("left", 452, 104)
_WinWaitActive("100 Artikelen", "&Exporteren")

Func _WinWaitActive($title, $text = "")
    WinWait($title, $text)
    If Not WinActive($title, $text) Then
        WinActivate($title, $text)
    EndIf
    WinWaitActive($title, $text)
EndFunc

It has no meaning to me as of last time. If you want logic to a script then you may need to manually create the script along with using Autoit info tool to create a script which can work without resolution problems...

Your working with Excel, so I can only recommend ExcelCom.au3 or similar if searched in Scripts'n'Scraps forum. Using COM will give you better control. A macro recorder will give you good but not reliable results.

If you think your recording is bad, then try again, but do not expect a miracle. :whistle:

@4gotn1 = good advice.

Share this post


Link to post
Share on other sites

May just be me, but wouldnt it be smarter to use ControlSend()'s or ControlClick()'s


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

May just be me, but wouldnt it be smarter to use ControlSend()'s or ControlClick()'s

Office is basically like a java app so AutoIt cannot see it. Com is the best solution if possible.

Share this post


Link to post
Share on other sites

Office is basically like a java app so AutoIt cannot see it. Com is the best solution if possible.

Ah.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I now have removed some of the WinWait() and WinWaitActive() functions en the script is working much better now, thanks for all the help!


Metal up your Ass..!

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
Sign in to follow this  
Followers 0