Jump to content

Macro runs stuck


Burrug
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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

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

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
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.

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