Jump to content

problem with my saving file process


Recommended Posts

Hi everyone ! (Im french, sorry for my bad english)

I'm an AutoIt's newbie and I have a problem with my saving file process.

My script have to launch OpenWorkbench many times, and save the current project loaded as XML AND RMP file. Sometimes, the first generated file takes so much time to be created that my script pass the second saving file process. We can call this an OpenWorkbench's lag, and my problem is to detect when this lag is over to engage the second part of my saving file process without using sleep().

here's the related part of my function :

note : ; english for "enregistrer sous" is "save as"

help me :D

I'm not clear about which part causes you a problem. What does the log show, or can you indicate in the code the part that doesn't wait as you would like?

If the time to save a file is long then why can't you wait until a certain window appears without having a time limit, or by making the time limit much longer than 30 seconds say?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Sleep(2000)

; ------------------------------------------------------------

; 1 - Phase d'enregistrement de la copie locale en .RMP save as an RMP file

; ------------------------------------------------------------

WinActivate("[CLASS:Open Workbench Class; TITLE:Open Workbench]", "")

Send("!f")

Send("{DOWN 4}")

Send("{ENTER}")

Sleep(2000)

ControlCommand("Enregistrer sous",'',"[CLASS:ComboBox; INSTANCE:3]","SelectString", 'Fichiers Workbench (*.rmp)')

ControlCommand("Enregistrer sous",'',"[CLASS:Edit; INSTANCE:1]","EditPaste", $Projet&'~'&$date)

Send("{ENTER}")

; Verification si le fichier existe deja et donc si le système demande à le remplacer

If WinWaitActive("Enregistrer sous","",4)<>0 Then

Send("{LEFT}")

Send("{ENTER}")

EndIf

If WinWaitActive("[CLASS:Open Workbench Class; TITLE:Open Workbench]","",30)==0 Then ; I tried to check when the focus come back to the main window of OpenWorkBench for being sure that send() functions will work with the next function

logEnr($fichierERR,GetDatetime()&"[sAUVEGARDE] impossible d'enregistrer : "&$Projet&"~"&$date&".rmp")

Return 0

EndIf

Sleep(3000) ; Here is the problem, if openworkbench's got a lag, the next function can't work and so can't create the xml I want.

; ------------------------------------------------------------

; 2 - Phase d'enregistrement de la copie locale en .XML save as an XML file

; ------------------------------------------------------------

WinActivate("[CLASS:Open Workbench Class; TITLE:Open Workbench]", "")

Send("!f")

Send("{DOWN 4}")

Send("{ENTER}")

Sleep(2000)

ControlCommand("Enregistrer sous",'',"[CLASS:ComboBox; INSTANCE:3]","SelectString", 'Fichiers XML (*.xml)')

ControlCommand("Enregistrer sous",'',"[CLASS:Edit; INSTANCE:1]","EditPaste", $Projet&'~'&$date)

Send("{ENTER}")

; Verification si le fichier existe deja et donc si le système demande à le remplacer

If WinWaitActive("Enregistrer sous","",4)<>0 Then

Send("{LEFT}")

Send("{ENTER}")

EndIf

If WinWaitActive("[CLASS:Open Workbench Class; TITLE:Open Workbench]","",30)==0 Then

logEnr($fichierERR,GetDatetime()&"[sAUVEGARDE] impossible d'enregistrer : "&$Projet&"~"&$date&".xml")

Return 0

EndIf

these 2 functions are exactly the same, but sometimes a lag appears at the end of the first function, so the second function can't execute properly because OpenWorkBench is busy.

Here is the process I want to obtain:

1-> open Openworkbench with a project

2-> creating RMP file

3-> creating XML file

4-> close OpenWorkBench

1->open an other projet

2-> etc ....

Link to comment
Share on other sites

these 2 functions are exactly the same, but sometimes a lag appears at the end of the first function, so the second function can't execute properly because OpenWorkBench is busy.

Here is the process I want to obtain:

1-> open Openworkbench with a project

2-> creating RMP file

3-> creating XML file

4-> close OpenWorkBench

1->open an other projet

2-> etc ....

Could you add something like

while WinExists("Enregistrer sous");or the title of the window which closes when the saving has finished.
sleep(100)
wend

But why do you limit the wait to 30 seconds? Or have I not understood?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...