Shell Execute primitive - What can it actually do?

For general discussion related FlowStone
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Shell Execute primitive - What can it actually do?

Post by kortezzzz »

Hi guys,
Seems like we all know that the "Exec" primitive can call windows features and commands (even under cmd), but where can we find the full list of commands and features that can be used with this primitive? Is there any known documents that specify them? If anyone knows, please shed some light. I really would like to learn this aspect in FS, and I believe that many other would too.

Cheers!
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Shell Execute primitive - What can it actually do?

Post by tulamide »

Sorry to disappoint you, but Shell Execute ("Exec") does nothing else than starting an external executable (=application). If that program understands command line arguments (for example the windows .exe tools) you can additionally pass them. And that's all.
"There lies the dog buried" (German saying translated literally)
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Shell Execute primitive - What can it actually do?

Post by kortezzzz »

Thanks for the answer, tulamide. But AFAIK, it can call the cmd command. For instance, if I would like to make my application rename files, I believe it should be possible with this primitive, doesn't it?

Here, take a look at the example I've uploaded:

It uses the cmd command to create new folder. Can it use the cmd to rename files? or delete them? or whatever cmd can do?
Attachments
(create folder).fsm
(580 Bytes) Downloaded 968 times
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Shell Execute primitive - What can it actually do?

Post by tulamide »

Everything that ends in .exe can be executed by the Prim. CMD.exe is no exception from the rule. So, yes, you can start cmd.exe and give it some arguments to work with.

But you don't need that to rename files. It's quicker and easier with Ruby.
"There lies the dog buried" (German saying translated literally)
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Shell Execute primitive - What can it actually do?

Post by kortezzzz »

But you don't need that to rename files. It's quicker and easier with Ruby.


Well, can't wait to see a little schematic as a authentication. Can we please have it? :D
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Shell Execute primitive - What can it actually do?

Post by tulamide »

kortezzzz wrote:
But you don't need that to rename files. It's quicker and easier with Ruby.


Well, can't wait to see a little schematic as a authentication. Can we please have it? :D

Why do you always question my abilities? Here you are. But in general, when I just point to an alternative way I don't see myself in the need of posting a schematic (imagine you'd talk about a reverb and I'd say "convolution is giving better results") ;)
Attachments
rename_r02.fsm
(428 Bytes) Downloaded 952 times
"There lies the dog buried" (German saying translated literally)
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Shell Execute primitive - What can it actually do?

Post by kortezzzz »

Why do you always question my abilities?


Sorry tulamide, It's kinda teasing humor that might work pretty well on some women as well 8-)
Besides, what's the point in telling someone that you know the answer without telling it? It's like someone asking somebody in the street "Excuse me, do you what time is it?" and get only "Yes" as an answer :lol:

Thanks a lot for your effort, buddy. Highly appreciated. That's very helpful tool and moving straight to my over-crowded toolbox. Hope others will find it helpful as well :D
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Shell Execute primitive - What can it actually do?

Post by kortezzzz »

Update:

I'm getting an error message from ruby:

Errno:(in method 'event')::EINVAL: Invalid argument

Any ideas?
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Shell Execute primitive - What can it actually do?

Post by tulamide »

kortezzzz wrote:It's like someone asking somebody in the street "Excuse me, do you what time is it?" and get only "Yes" as an answer :lol:

That's not the correct picture. This thread was about the exec prim, and I did my best to answer your questions -> I told you the time. But then I added that a watch would be the quicker way to tell the time, and that someone on the street says "Is it? So give me a watch then."

Regarding your issue. That's a system error, not a Ruby error, which means you messed up the path somehow. Make sure it contains only valid signs and also no hidden characters (like carriage return, line feed, tab etc.)
The first string is expected to be the full path to the file, including the file. The second string is expected to be just the new filename. Example:

C:\superfolder\interesting\a_file.txt
awesome_text.txt
"There lies the dog buried" (German saying translated literally)
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Shell Execute primitive - What can it actually do?

Post by kortezzzz »

.That's not the correct picture...


That's why I like you. You become tough on some conditions, but still tend to help, so you can have my watch any time you need it. Just let me know ;)

I've never messed up with my system, so the error must be caused by providing the full path's name+file name at the second string line. I'll test it again ASAP, once I'm home.

Thanks again, champ 8-)
Last edited by kortezzzz on Tue Sep 13, 2016 4:23 am, edited 1 time in total.
Post Reply