|
Post by angelo2449 on Oct 26, 2019 6:33:22 GMT -5
Hi Guis,
this code:
[AltezzaDiVolo]
run "C:\AutocadSupporto\LibertyTre\ScegliDrone.exe " + "C:\AutoCadSupporto\LibertyTre\ScegliDrone.tkn"
open "C:\AutocadSupporto\Droni\HVolo.dat" for input as #18
input #18, AltezzaDiVolo$
close #18
#main.altezza, using("#######.##", val(trim$(AltezzaDiVolo$)))
wait
e I would like the program to wait for the execution of > ScegiDrone < before collecting the variable > AltezzaDiVolo$ <.
How do I do it ?, Thanks.
|
|
|
Post by Rod on Oct 26, 2019 9:06:59 GMT -5
|
|
|
Post by mknarr on Oct 26, 2019 9:07:58 GMT -5
See this in Alyce's Restaurant Shell Wait Shell Wait
|
|
|
Post by angelo2449 on Oct 27, 2019 9:32:53 GMT -5
OK it works! Do you know how I can close> Notice <with a command? Thanks.
|
|
|
Post by Rod on Oct 27, 2019 9:45:49 GMT -5
No, Notice requires user input. If the program you are running executes automatically and closes automatically and you know the time it takes to execute then you can just put a delay in the main program.
'issue the run command Timer 500, [done] wait
[done] timer 0 'retrieve your variable
That would wait half a second then move on to get your file.
|
|
|
Post by angelo2449 on Oct 27, 2019 10:54:34 GMT -5
Thanks, I solved the problem with this switch code
open "C:\AutocadSupporto\DroniXXX.dat" for output as #3 close #3
if FileExists("C:\AutocadSupporto\DroniXXX.dat") then print "OK >>>>>>>>>>>>>>>>>>>>>" kill "C:\AutocadSupporto\DroniXXX.dat" end if
' ---------------------------- function FileExists(FilePath$) dim FileExistsInfo$(1,1) ' ritorna 0 (zero) se il file non esiste, 1 (uno) se esiste files "", FilePath$, FileExistsInfo$( FileExists = val(FileExistsInfo$(0,0)) end function ' ------------------------------------------------
Now I will create 'C: Autocad Supporto\DroneXXX.dat' from "C:\AutocadSupporto\LibertyTre\ScegliDrone.exe " + "C:\AutoCadSupporto\LibertyTre\ScegliDrone.tkn" And everything will work! Thanks, Angelo.
|
|
|
Post by Rod on Oct 27, 2019 16:58:19 GMT -5
Ok, yes repetitively checking if a file exists is a way to wait for an ancillary program to complete.
|
|
|
Post by angelo2449 on Oct 28, 2019 1:30:48 GMT -5
This is the finished and working code:
[AltezzaDiVolo]
run "C:\AutocadSupporto\LibertyTre\ScegliDrone.exe " + "C:\AutoCadSupporto\LibertyTre\ScegliDrone.tkn"
[Frena]
if FileExists("C:\AutocadSupporto\Droni\Freno.dat") then kill "C:\AutocadSupporto\Droni\Freno.dat"
open "C:\AutocadSupporto\Droni\HVolo.dat" for input as #18 line input #18, AltezzaDiVolo$ line input #18, TipoD$ close #18
#main.altezza, using("#######.##", val(trim$(AltezzaDiVolo$))) else #main.altezza, "In Attesa" goto [Frena] end if
if FileExists("C:\AutocadSupporto\Droni\Freno.dat") then kill "C:\AutocadSupporto\Droni\Freno.dat" end if
wait
Ciao Rod
|
|
|
Post by Carl Gundel on Oct 29, 2019 10:50:24 GMT -5
Ok, yes repetitively checking if a file exists is a way to wait for an ancillary program to complete. Usually the best way is to make the file with one name, and when you're done rename it to the filename that you will test for. That way you won't accidentally proceed when the file is still open and being written to.
|
|
|
Post by angelo2449 on Nov 3, 2019 17:31:09 GMT -5
I have improved the code further, now it works perfectly without the use of files
In the first program
[Scegli.Salva]
.................... ....................
#scegli.edit, "!cls"; #scegli.edit, "Controllo#"; #scegli.edit, "!selectall"; #scegli.edit, "!copy";
.................... ....................
wait
---------------------------------------------------
In the second program
[AltezzaDiVolo]
on error goto[Errore]
#main.editx, "!cls"; #main.editx, ""; #main.editx, "!selectall"; #main.editx, "!copy";
run "C:\AutocadSupporto\LibertyTre\ScegliDrone.exe " + "C:\AutoCadSupporto\LibertyTre\ScegliDrone.tkn"
[Frena]
#main.editx, "!cls"; #main.editx, "!paste"; #main.editx, "!contents? String$";
timer 200, [Vai] wait
[Vai]
if trim$(String$) = "Controllo#" then
if FileExists("C:\AutocadSupporto\Droni\HVolo.dat") then open "C:\AutocadSupporto\Droni\HVolo.dat" for input as #18 line input #18, AltezzaDiVolo$ line input #18, TipoD$ close #18 end if
#main.altezza, using("#######.##", val(trim$(AltezzaDiVolo$))) else #main.altezza, "In Attesa" goto [Frena] end if
wait
In this way, with a good string encoding it is possible to exchange any data with any language. Ciao from Italy.
|
|