Sign in to follow this  
Followers 0
Hergonoway

problem with my saving file process

5 posts in this topic

#1 ·  Posted (edited)

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"

Sleep(2000)

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

; 1 - Phase d'enregistrement de la copie locale en .RMP

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

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

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

Return 0

EndIf

Sleep(3000) ; to delete è_é

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

; 2 - Phase d'enregistrement de la copie locale en .XML

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

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

help me :D

Edited by Hergonoway

Share this post


Link to post
Share on other sites



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.

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

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?

Thx for the advice, I tought about the same thing yesterday, and it does'nt really work :/

about the "30 second" line, that help me to detect if my saving process really don't work because of a Lag ... so if I can't focus to the main window after 30 seconds, I consider that my saving process got a problem and pass to another project after marked this projet in TODO.txt. Here is how it work :

[laucnh SCRIPT for 12hours] (1)

|

[load list of Project OR TODO.txt if it exist] (2)

|

|

/for every project/

---|

---L [open in OpenWorkBench] (3)

---|

---L [save as XML file] (4) -----------> if process not responding -> project ID in TODO.txt

---|

---L [save as RMP file] (5) ------------> if process not responding -> project ID in TODO.txt

---|

---L [Close OpenworkBench] (6)

|

L [end of process if the 12 hours passed, else goto (2)] (7)

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