Discussion:
Shell command validation
Jean-Luc Arnaud
2016-12-16 11:55:12 UTC
Permalink
Hi all,

As you may know, some shell commands need a validation from user, mainly
by hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple
file containing only a CR code, something like:

CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34) '
f is a folderitem on a simple file with only a CR character

Is there another way, maybe using directly a CR character in the command
string, something like:

CommandString=CommandString+" "+Chr(13)

Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?

TIA for any help
--
Jean-Luc Arnaud


_______________________________________________

Xojo forum:

https://forum.xojo.com/
Moi
2016-12-16 12:11:14 UTC
Permalink
Hello,

Just a guess, but have you tried with chr(10)? That is the Unix end of line.
Besides that, I'm not sure the shell let you enter that additional character
as is.

-----Message d'origine-----
De : nug-***@lists.xojo.com [mailto:nug-***@lists.xojo.com] De la
part de Jean-Luc Arnaud
Envoyé : 16 December 2016 12:55
À : Nug <***@lists.xojo.com>
Objet : Shell command validation

Hi all,

As you may know, some shell commands need a validation from user, mainly by
hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple file
containing only a CR code, something like:

CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34) '
f is a folderitem on a simple file with only a CR character

Is there another way, maybe using directly a CR character in the command
string, something like:

CommandString=CommandString+" "+Chr(13)

Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?

TIA for any help

--
Jean-Luc Arnaud


_______________________________________________

Xojo forum:

https://forum.xojo.com/


_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jean-Luc Arnaud
2016-12-16 12:24:41 UTC
Permalink
Thanks for replying.

Yes, I tested chr(10), chr(10)+chr(13).

In addition, I tested " echo." and " echo "+chr(13).

All unsuccessfully.

Jean-Luc Arnaud
Post by Moi
Hello,
Just a guess, but have you tried with chr(10)? That is the Unix end of line.
Besides that, I'm not sure the shell let you enter that additional character
as is.
-----Message d'origine-----
part de Jean-Luc Arnaud
Envoyé : 16 December 2016 12:55
Objet : Shell command validation
Hi all,
As you may know, some shell commands need a validation from user, mainly by
hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple file
CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34) '
f is a folderitem on a simple file with only a CR character
Is there another way, maybe using directly a CR character in the command
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jean-Pierre DOUCET
2016-12-16 13:18:48 UTC
Permalink
May be :
CommandString = CommandString + " \r"
or echo \r
Post by Jean-Luc Arnaud
Thanks for replying.
Yes, I tested chr(10), chr(10)+chr(13).
In addition, I tested " echo." and " echo "+chr(13).
All unsuccessfully.
Jean-Luc Arnaud
Post by Moi
Hello,
Just a guess, but have you tried with chr(10)? That is the Unix end of line.
Besides that, I'm not sure the shell let you enter that additional character
as is.
-----Message d'origine-----
part de Jean-Luc Arnaud
Envoyé : 16 December 2016 12:55
Objet : Shell command validation
Hi all,
As you may know, some shell commands need a validation from user, mainly by
hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple file
CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34) '
f is a folderitem on a simple file with only a CR character
Is there another way, maybe using directly a CR character in the command
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
JPD





_______________________________________________

Xo
Giulio Mastrosanti
2016-12-16 14:04:53 UTC
Permalink
Hi,

I have never played with interactive shells in Xojo, but I think it could be a solution in this case.
You could try to declare the shell as intreactive (Shell.Mode = 2). launch it and, after a short period, send it a return using the write or writline command.

Now I don’t know if this works, and what you need to send, a \r or chr(13).
maybe also that the command writeline sends your strings with a carriage return, so an empty text sent with writeline could do the trick.

sorry but just a guess, don’t know if it could work this way

Giulio


- - - - - - - - - - - - - - - - - - - - - - -
BitBazar Srl
Via Andrea Doria, 57
00192 Roma
tel +39 0639737052
tel +39 0639725787
http://www.bitbazar.com
- - - - - - - - - - - - - - - - - - - - - - -
Post by Jean-Pierre DOUCET
CommandString = CommandString + " \r"
or echo \r
Post by Jean-Luc Arnaud
Thanks for replying.
Yes, I tested chr(10), chr(10)+chr(13).
In addition, I tested " echo." and " echo "+chr(13).
All unsuccessfully.
Jean-Luc Arnaud
Post by Moi
Hello,
Just a guess, but have you tried with chr(10)? That is the Unix end of line.
Besides that, I'm not sure the shell let you enter that additional character
as is.
-----Message d'origine-----
part de Jean-Luc Arnaud
Envoyé : 16 December 2016 12:55
Objet : Shell command validation
Hi all,
As you may know, some shell commands need a validation from user, mainly by
hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple file
CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34) '
f is a folderitem on a simple file with only a CR character
Is there another way, maybe using directly a CR character in the command
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
JPD
_______________________________________________
https://forum.xojo.com/
____________________________________
Jean-Luc Arnaud
2016-12-16 16:22:51 UTC
Permalink
Great!

You're a Genius, Giulio.

This works perfectly writing a Chr(13)

Thanks a lot, Grazie mille!

Jean-Luc Arnaud
Post by Giulio Mastrosanti
Hi,
I have never played with interactive shells in Xojo, but I think it could be a solution in this case.
You could try to declare the shell as intreactive (Shell.Mode = 2). launch it and, after a short period, send it a return using the write or writline command.
Now I don’t know if this works, and what you need to send, a \r or chr(13).
maybe also that the command writeline sends your strings with a carriage return, so an empty text sent with writeline could do the trick.
sorry but just a guess, don’t know if it could work this way
Giulio
- - - - - - - - - - - - - - - - - - - - - - -
BitBazar Srl
Via Andrea Doria, 57
00192 Roma
tel +39 0639737052
tel +39 0639725787
http://www.bitbazar.com
- - - - - - - - - - - - - - - - - - - - - - -
Post by Jean-Pierre DOUCET
CommandString = CommandString + " \r"
or echo \r
Post by Jean-Luc Arnaud
Thanks for replying.
Yes, I tested chr(10), chr(10)+chr(13).
In addition, I tested " echo." and " echo "+chr(13).
All unsuccessfully.
Jean-Luc Arnaud
Post by Moi
Hello,
Just a guess, but have you tried with chr(10)? That is the Unix end of line.
Besides that, I'm not sure the shell let you enter that additional character
as is.
-----Message d'origine-----
part de Jean-Luc Arnaud
Envoyé : 16 December 2016 12:55
Objet : Shell command validation
Hi all,
As you may know, some shell commands need a validation from user, mainly by
hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple file
CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34) '
f is a folderitem on a simple file with only a CR character
Is there another way, maybe using directly a CR character in the command
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
JPD
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_____________________________
Giulio Mastrosanti
2016-12-16 16:35:11 UTC
Permalink
Glad it helped :)

and I take the chance to wish a ‘Buon Natale’ to everybody :)

Giulio

- - - - - - - - - - - - - - - - - - - - - - -
BitBazar Srl
Via Andrea Doria, 57
00192 Roma
tel +39 0639737052
tel +39 0639725787
http://www.bitbazar.com
- - - - - - - - - - - - - - - - - - - - - - -





<http://www.bitbazar.com/>
Post by Jean-Luc Arnaud
Great!
You're a Genius, Giulio.
This works perfectly writing a Chr(13)
Thanks a lot, Grazie mille!
Jean-Luc Arnaud
Post by Giulio Mastrosanti
Hi,
I have never played with interactive shells in Xojo, but I think it could be a solution in this case.
You could try to declare the shell as intreactive (Shell.Mode = 2). launch it and, after a short period, send it a return using the write or writline command.
Now I don’t know if this works, and what you need to send, a \r or chr(13).
maybe also that the command writeline sends your strings with a carriage return, so an empty text sent with writeline could do the trick.
sorry but just a guess, don’t know if it could work this way
Giulio
- - - - - - - - - - - - - - - - - - - - - - -
BitBazar Srl
Via Andrea Doria, 57
00192 Roma
tel +39 0639737052
tel +39 0639725787
http://www.bitbazar.com
- - - - - - - - - - - - - - - - - - - - - - -
Post by Jean-Pierre DOUCET
CommandString = CommandString + " \r"
or echo \r
Post by Jean-Luc Arnaud
Thanks for replying.
Yes, I tested chr(10), chr(10)+chr(13).
In addition, I tested " echo." and " echo "+chr(13).
All unsuccessfully.
Jean-Luc Arnaud
Post by Moi
Hello,
Just a guess, but have you tried with chr(10)? That is the Unix end of line.
Besides that, I'm not sure the shell let you enter that additional character
as is.
-----Message d'origine-----
part de Jean-Luc Arnaud
Envoyé : 16 December 2016 12:55
Objet : Shell command validation
Hi all,
As you may know, some shell commands need a validation from user, mainly by
hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple file
CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34) '
f is a folderitem on a simple file with only a CR character
Is there another way, maybe using directly a CR character in the command
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
JPD
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum
Jean-Luc Arnaud
2016-12-16 17:01:19 UTC
Permalink
Merry Christmas!

Fröhliches Weihnachten!

Buon Natale!

Feliz Navidad!

Joyeux Noël !

Jean-Luc Arnaud
Post by Giulio Mastrosanti
and I take the chance to wish a ‘Buon Natale’ to everybody
_______________________________________________

Xojo for
Tim Jones
2016-12-16 17:27:07 UTC
Permalink
Post by Jean-Luc Arnaud
Merry Christmas!
Fröhliches Weihnachten!
Buon Natale!
Feliz Navidad!
Joyeux Noël !
Mele Kalikimaka!

Tim


_______________________________________________

Xojo forum:

https://
Jean-Luc Arnaud
2016-12-16 18:05:32 UTC
Permalink
aloha!

Jean-Luc Arnaud
Post by Tim Jones
Post by Jean-Luc Arnaud
Merry Christmas!
Fröhliches Weihnachten!
Buon Natale!
Feliz Navidad!
Joyeux Noël !
Mele Kalikimaka!
Tim
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

http
Antonio Rinaldi
2016-12-19 18:24:00 UTC
Permalink
Marry Christmas and Happy New Year!!
Buon Natale e Buon Anno!!

Antonio
Grazie! Buon natale a tutti!!!
Thank you! Marry Christmas to all!!!
Post by Jean-Luc Arnaud
Merry Christmas!
Fröhliches Weihnachten!
Buon Natale!
Feliz Navidad!
Joyeux Noël !
Jean-Luc Arnaud
Post by Giulio Mastrosanti
and I take the chance to wish a ‘Buon Natale’ to everybody
_______________________________________________
https://forum.xojo.com/
------
Sergio Tamborini
Brescia
http://www.system-i.it
"C'è un equivoco di fondo. Si dice che il politico che ha avuto frequentazioni mafiose, se non viene giudicato colpevole dalla magistratura, è un uomo onesto. No! La magistratura può fare solo accertamenti di carattere giudiziale. Le istituzioni hanno il dovere di estromettere gli uomini politici vicini alla mafia, per essere oneste e apparire tali"
"There is a basic misunderstanding. It is said that political mafia has had acquaintances, if not found guilty by the courts, is an honest man. No. The judiciary can only do the findings of a judicial nature. Institutions have a duty to oust politicians close to the mafia, to be honest, these look "
Paolo Borsellino
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo

Jean-Luc Arnaud
2016-12-16 14:18:03 UTC
Permalink
Seems a good idea.

Unfortunately, this does not work.

Thanks

Jean-Luc Arnaud
Post by Jean-Pierre DOUCET
CommandString = CommandString + " \r"
or echo \r
Post by Jean-Luc Arnaud
Thanks for replying.
Yes, I tested chr(10), chr(10)+chr(13).
In addition, I tested " echo." and " echo "+chr(13).
All unsuccessfully.
Jean-Luc Arnaud
Post by Moi
Hello,
Just a guess, but have you tried with chr(10)? That is the Unix end of line.
Besides that, I'm not sure the shell let you enter that additional character
as is.
-----Message d'origine-----
part de Jean-Luc Arnaud
Envoyé : 16 December 2016 12:55
Objet : Shell command validation
Hi all,
As you may know, some shell commands need a validation from user, mainly by
hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple file
CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34) '
f is a folderitem on a simple file with only a CR character
Is there another way, maybe using directly a CR character in the command
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
JPD
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo
Roland Brouwers
2016-12-16 14:57:18 UTC
Permalink
Normally in linux a newline is \n

Roland Brouwers
Post by Jean-Luc Arnaud
Seems a good idea.
Unfortunately, this does not work.
Thanks
Jean-Luc Arnaud
Post by Jean-Pierre DOUCET
CommandString = CommandString + " \r"
or echo \r
Post by Jean-Luc Arnaud
Thanks for replying.
Yes, I tested chr(10), chr(10)+chr(13).
In addition, I tested " echo." and " echo "+chr(13).
All unsuccessfully.
Jean-Luc Arnaud
Post by Moi
Hello,
Just a guess, but have you tried with chr(10)? That is the Unix end of line.
Besides that, I'm not sure the shell let you enter that additional character
as is.
-----Message d'origine-----
part de Jean-Luc Arnaud
Envoyé : 16 December 2016 12:55
Objet : Shell command validation
Hi all,
As you may know, some shell commands need a validation from user, mainly by
hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple file
CommandString=CommandString+"
<"+chr(34)+f.NativePath+chr(34) '
f is a folderitem on a simple file with only a CR character
Is there another way, maybe using directly a CR character in the command
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
JPD
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

X
Jean-Luc Arnaud
2016-12-16 16:30:18 UTC
Permalink
Thanks Roland.

Unfortunately, \n does not work.

Jean-Luc Arnaud
Post by Roland Brouwers
Normally in linux a newline is \n
Roland Brouwers
Post by Jean-Luc Arnaud
Seems a good idea.
Unfortunately, this does not work.
Thanks
Jean-Luc Arnaud
Post by Jean-Pierre DOUCET
CommandString = CommandString + " \r"
or echo \r
Post by Jean-Luc Arnaud
Thanks for replying.
Yes, I tested chr(10), chr(10)+chr(13).
In addition, I tested " echo." and " echo "+chr(13).
All unsuccessfully.
Jean-Luc Arnaud
Post by Moi
Hello,
Just a guess, but have you tried with chr(10)? That is the Unix end of line.
Besides that, I'm not sure the shell let you enter that additional character
as is.
-----Message d'origine-----
part de Jean-Luc Arnaud
Envoyé : 16 December 2016 12:55
Objet : Shell command validation
Hi all,
As you may know, some shell commands need a validation from user, mainly by
hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple file
CommandString=CommandString+"
<"+chr(34)+f.NativePath+chr(34) '
f is a folderitem on a simple file with only a CR character
Is there another way, maybe using directly a CR character in the command
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
JPD
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum
Tim Jones
2016-12-16 15:21:03 UTC
Permalink
It may be that it requires a "Y" answer instead of just a physical ENTER. Try using the "yes" command:

CommandString="yes | " + CommandString

Tim
Post by Jean-Luc Arnaud
Hi all,
As you may know, some shell commands need a validation from user, mainly by hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34) ' f is a folderitem on a simple file with only a CR character
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not possible?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jean-Luc Arnaud
2016-12-16 16:34:33 UTC
Permalink
Tried that but does not work.

I'm afraid there is a misunderstanding: I'm working under Win7, not Linux.
And "Yes" is not a recognized DOS command.

Thanks for your reply, Tim.

Jean-Luc Arnaud
Post by Tim Jones
CommandString="yes | " + CommandString
Tim
Post by Jean-Luc Arnaud
Hi all,
As you may know, some shell commands need a validation from user, mainly by hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34) ' f is a folderitem on a simple file with only a CR character
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not possible?
TIA for any help
--
Jean-Luc Arnaud
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jean-Luc Arnaud
2016-12-16 16:57:04 UTC
Permalink
_Windows Shell command validation : Summary_

It seems like only two possibilities exist:

- Using a file with a simple CR, and a redirection:
MyShell.Mode=1
MyShell Execute CommandString+" <"+chr(34)+f.NativePath+chr(34)

- Using Giulio's technic, with an interactive shell (mode 2) and a Write
Chr(13) command:
MyShell.Mode=2
MyShell.Execute CommandString
DelayMBS 1 ' One second delay
MyShell.Write Chr(13)

Of course, some commands may have an optional /Y or -Y parameter or
something like that. With such a command, no problem (i.e. format,
copy,...).
Nevertheless, keep in mind that old Win OS (like Windows 2000) do not
accept /Y parameter in some commands (specially in 'format' command).

Many thanks to all of you, special thanks to Giulio.

Jean-Luc Arnaud
Post by Jean-Luc Arnaud
Hi all,
As you may know, some shell commands need a validation from user,
mainly by hitting Enter or Return key.
For some of these commands, a /Y option matches the need.
But for the others, no /Y option. So I'm used to redirecting a simple
CommandString=CommandString+" <"+chr(34)+f.NativePath+chr(34)
' f is a folderitem on a simple file with only a CR character
Is there another way, maybe using directly a CR character in the
CommandString=CommandString+" "+Chr(13)
Of course, I tested this, unsuccessfully. Am I wrong or is this not
possible?
TIA for any help
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Continue reading on narkive:
Loading...