My JScript :
Code: Select all
curl -k -o result.txt https://www.google.fr
But when I start it programmatically using platformSupport5x::system or shell_native::shellExecute or useExe => doesn't works.
Code: Select all
curl -k -o result.txt https://www.google.fr
all works fine - I recover the contain of this page in result.txt file.curl -k -o result.txt https://www.toernooiklapper.nl/tools/index.php
Code: Select all
constants
fic_result = "result.txt".
clauses
onFileNew(_Source, _MenuTag):-
Fic_js = "recup_url.bat",
Fic_url = "url.txt", % this file contain only https://www.toernooiklapper.nl/tools/index.php
if file::existFile(fic_result) then
try
file::delete(fic_result) % to clean the result of the preceeding test
catch _ do
succeed()
end try
end if,
if file::existFile(Fic_js) then
try
file::delete(Fic_js)
catch _ do
succeed()
end try
end if,
if file::existFile(Fic_url) then
try
file5x::file_str(Fic_url,URL),
Syntax = string::format("curl -k -o % %",fic_result,URL),
file5x::file_str(Fic_js,Syntax), % the bat file is created here, and if (after my application is closed) I double-clic manually on it, the command works fine
if file::existFile(Fic_js) then
platformSupport5x::system(Fic_js,1,_),
stdio::write("ok"),stdio::nl % this line works fine but the batch command (started by platformSupport5x::system) doesn't recover the contain of the html page
end if
catch _ do
succeed()
end try
else
vpiCommonDialogs::note("Traitement impossible :",string::format("Il manque le fichier suivant :\n\n%",Fic_url))
end if,
!.
onFileNew(_Source, _MenuTag).
Code: Select all
constants
fic_result = "result.txt".
clauses
onFileNew(_Source, _MenuTag):-
Fic_url = "url.txt",
if file::existFile(Fic_url) then
try
file5x::file_str(Fic_url,URL),
Syntax_cmd = string::format("start curl -k -o % %",fic_result,URL),
Exe = useExe::new(string::concat("cmd /c ",Syntax_cmd)),
Exe:setShowWindow(false),
Exe:run(),
stdio::write("ok"),stdio::nl
catch _ do
succeed()
end try
else
vpiCommonDialogs::note("Traitement impossible :",string::format("Il manque le fichier suivant :\n\n%",Fic_url))
end if.
Code: Select all
Exe = useExe::new(string::format(@"c:\somewhere\curl.exe -k-o % %", fic_result, URL)),
Code: Select all
Exe = useExe::new(string::format(@"-k-o % %", fic_result, URL)),
Exe:setApplicationName(@"c:\somewhere\curl.exe"),
Code: Select all
clauses
run():-
console::init(),
CURL = useExe::new(@"C:\Program Files\cURL\bin\curl.exe -k -o result.txt http://www.visual-prolog.com"),
CURL:run(),
_ = CURL:wait().