open process

Dar Scott Consulting dsc at swcp.com
Sat Sep 28 13:24:21 EDT 2019


This works for me, LC 9.5 Mac.

on mouseup
   set the cursor to watch
   put "netstat -i" into p
   put p -- flash
   open process p for read
   wait 1 seconds with messages
   read from process p until empty
   close process p
   put it
end mouseup


> On Sep 28, 2019, at 8:05 AM, JB via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> In a shell command I can execute a external program
> using the following code:
> 
> on mouseUp
>  set the defaultFolder to desktop
>   put “myPic.jpg" into tFILE1
>   put “myPic copy.jpg" into tFILE2
>   put shell( "./copy" && quote & tFILE1 & quote && quote & tFILE2 & quote) into pData
>   answer question pData  —will be success or failed
> end mouseUp
> 
> The code above will execute a program that has two arguments which are
> the source file and destination file.  It is a simple copy program.
> 
> I was reading about open process:
>   --open process appName [for [text|binary] {read | write | update | neither}]
> 
> I can open a process and execute the above mentioned external program
> but I am not able to supply the arguments.
> 
> Is it possible using open process to execute a program with arguments
> and if it is would it be better to use the shell command or open process?
> 
> I know if you use a shell command it takes control until it is done and
> open process might run in the background which I do not really need
> that I know of in this instance.
> 
> JB
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 




More information about the use-livecode mailing list