Page 1 of 2
Shell Execute primitive - What can it actually do?
Posted: Sun Sep 11, 2016 5:48 pm
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!
Re: Shell Execute primitive - What can it actually do?
Posted: Sun Sep 11, 2016 6:17 pm
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.
Re: Shell Execute primitive - What can it actually do?
Posted: Sun Sep 11, 2016 10:19 pm
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?
Re: Shell Execute primitive - What can it actually do?
Posted: Sun Sep 11, 2016 10:27 pm
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.
Re: Shell Execute primitive - What can it actually do?
Posted: Mon Sep 12, 2016 1:29 am
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?

Re: Shell Execute primitive - What can it actually do?
Posted: Mon Sep 12, 2016 2:19 am
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?

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")

Re: Shell Execute primitive - What can it actually do?
Posted: Mon Sep 12, 2016 9:47 am
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
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

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

Re: Shell Execute primitive - What can it actually do?
Posted: Mon Sep 12, 2016 10:29 am
by kortezzzz
Update:
I'm getting an error message from ruby:
Errno:(in method 'event')::EINVAL: Invalid argument
Any ideas?
Re: Shell Execute primitive - What can it actually do?
Posted: Mon Sep 12, 2016 7:42 pm
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

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
Re: Shell Execute primitive - What can it actually do?
Posted: Mon Sep 12, 2016 11:45 pm
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
