Re: open process
Okay, thank you! JB > On Sep 28, 2019, at 11:25 AM, Dar Scott Consulting via use-livecode > wrote: > > I'm glad that was helpful. For me, when using open process as a background > shell is knowing when things are done. In my example, I can wait for > non-empty read results and then wait for a few empty read results. There is > probably a better way. > >> On Sep 28, 2019, at 11:57 AM, JB via use-livecode >> wrote: >> >> It works for me too, Thanks >> >> Name Mtu Network AddressIpkts IerrsOpkts Oerrs Coll >> lo0 16384 82239 082239 0 0 >> lo0 16384 localhost ::1 82239 -82239 - - >> lo0 16384 127 localhost 82239 -82239 - - >> lo0 16384 localhost fe80:1::182239 -82239 - - >> gif0* 1280 0 00 0 0 >> stf0* 1280 0 00 0 0 >> en0 1500 34:15:9e:26:fa:60 1633080 0 1207358 0 0 >> en0 1500 jb.localfe80:4::3615:9eff 1633080 - 1207358 - - >> en0 1500 192.168.0 192.168.0.2 1633080 - 1207358 - - >> en1 1500 7c:6d:62:a4:64:ab0 00 0 0 >> fw0 4078 34:15:9e:ff:fe:26:fa:600 00 >> 0 0 >> >> >> JB >> >>> On Sep 28, 2019, at 10:24 AM, Dar Scott Consulting via use-livecode >>> wrote: >>> >>> 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 >>>> 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@lists.runrev.com >>>> Please visit this url to subscribe, unsubscribe and manage your >>>> subscription preferences: >>>> http://lists.runrev.com/mailman/listinfo/use-livecode >>>> >>> >>> ___ >>> use-livecode mailing list >>> use-livecode@lists.runrev.com >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/mailman/listinfo/use-livecode >> >> ___ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode >> > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: open process
I'm glad that was helpful. For me, when using open process as a background shell is knowing when things are done. In my example, I can wait for non-empty read results and then wait for a few empty read results. There is probably a better way. > On Sep 28, 2019, at 11:57 AM, JB via use-livecode > wrote: > > It works for me too, Thanks > > Name Mtu Network AddressIpkts IerrsOpkts Oerrs Coll > lo0 16384 82239 082239 0 0 > lo0 16384 localhost ::1 82239 -82239 - - > lo0 16384 127 localhost 82239 -82239 - - > lo0 16384 localhost fe80:1::182239 -82239 - - > gif0* 1280 0 00 0 0 > stf0* 1280 0 00 0 0 > en0 1500 34:15:9e:26:fa:60 1633080 0 1207358 0 0 > en0 1500 jb.localfe80:4::3615:9eff 1633080 - 1207358 - - > en0 1500 192.168.0 192.168.0.2 1633080 - 1207358 - - > en1 1500 7c:6d:62:a4:64:ab0 00 0 0 > fw0 4078 34:15:9e:ff:fe:26:fa:600 00 0 > 0 > > > JB > >> On Sep 28, 2019, at 10:24 AM, Dar Scott Consulting via use-livecode >> wrote: >> >> 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 >>> 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@lists.runrev.com >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/mailman/listinfo/use-livecode >>> >> >> ___ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: open process
It works for me too, Thanks Name Mtu Network AddressIpkts IerrsOpkts Oerrs Coll lo0 16384 82239 082239 0 0 lo0 16384 localhost ::1 82239 -82239 - - lo0 16384 127 localhost 82239 -82239 - - lo0 16384 localhost fe80:1::182239 -82239 - - gif0* 1280 0 00 0 0 stf0* 1280 0 00 0 0 en0 1500 34:15:9e:26:fa:60 1633080 0 1207358 0 0 en0 1500 jb.localfe80:4::3615:9eff 1633080 - 1207358 - - en0 1500 192.168.0 192.168.0.2 1633080 - 1207358 - - en1 1500 7c:6d:62:a4:64:ab0 00 0 0 fw0 4078 34:15:9e:ff:fe:26:fa:600 00 0 0 JB > On Sep 28, 2019, at 10:24 AM, Dar Scott Consulting via use-livecode > wrote: > > 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 >> 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@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode >> > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: open process
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 > 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@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: open process
Thank you very much! That is what I suspected but I wanted to have someone clarify it for me. thanks again, JB > On Sep 28, 2019, at 7:46 AM, Paul Dupuis via use-livecode > wrote: > > passing information (arguments, commands, etc.) to another program using > "open process" requires that the other program has a mechanism to listen to > interprocess messages. Most programs designed to accept a set of command-line > parameters do not have listeners for inter process communication (IPC), so > the general answer to your question is you probably can not provide arguments > via open process to the copy command. > > > On 9/28/2019 10:05 AM, JB via use-livecode 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@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: open process
passing information (arguments, commands, etc.) to another program using "open process" requires that the other program has a mechanism to listen to interprocess messages. Most programs designed to accept a set of command-line parameters do not have listeners for inter process communication (IPC), so the general answer to your question is you probably can not provide arguments via open process to the copy command. On 9/28/2019 10:05 AM, JB via use-livecode 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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: open process
I provided the wrong path in the code by setting the default folder to desktop but the code has the correct path and do not set defaultFolder using desktop. The question is still the same about supplying the arguments to the executable. JB > On Sep 28, 2019, at 7:05 AM, JB via use-livecode > 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@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
open process
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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: how to write control-c to an open process?
I just found a different way to accomplish the same outcome. Instead of writing some special form of control-c to the process, I can get the ID of the process and issue a 'kill' shell command for that ID using the 'kill' format option that sends the same signal as the one sent by typing control-c. The outcome is identical to control-c but no control chars are required. So this works: kill -s INT Where is the numeric ID of the process I want to end. *whew* Thanks - Phil On 1/30/19 12:58 AM, Phil Davis via use-livecode wrote: In a LC script I need to write control-c to an open process so the app being run as a process will end. (At least that's how I can end it in Terminal). Has anyone had success doing this? Please share what you have learned about it. Thanks - -- Phil Davis ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
how to write control-c to an open process?
In a LC script I need to write control-c to an open process so the app being run as a process will end. (At least that's how I can end it in Terminal). Has anyone had success doing this? Please share what you have learned about it. Thanks - -- Phil Davis ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Using open process instead of shell
had one more thought to make it easier. go back to your original idea of using a shell script but make the script have the format.. #!/bin/sh [your command here] echo "Command Complete" That way, its easy to see when an individual command finishes. In addition, if you use 3 separate files, 1 for each of your 3 commands, named logically, you can easily grok which what to do with each. Finally, for the [your command here] part.. If you want to be able to run more than 1 at once, if you pass in your arguments as parameters, you don't have to rewrite the file each time, you just pass in your changeables and go. IIRC $0 will contain the name of the shell script any further parameters will continue in that vein.. For a very simple example, if your shell script named test.sh were to contain #!/bin/sh ls $1 echo find . |grep $2 echo "Command Complete" you can run it with-- ./test.sh /var barncard the output would be a listing of the files in folder /var a space and a listing of files and folders from the current directory downward that contain the string barncard. Should make it easy enough to fire off jobs, multiple if you wish as long as your parameters differ (so that the open process string is unique) This should make it easy to queue up your commands.. Depending on hardware it might be possible to have 2 or 3 sets (or more? no clue what hardware you have) at once. It would depend on cpu threads and how much load you wanted to put on things. Sorry for all the blabbing, had a good day so my thinker is kinda working. Everyone have a Merry one! ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Using open process instead of shell
> > > great ideas from Mark Wieder, Mike Bonner, Warren Samples > > And Glen Bojsza ! Thanks guys! ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Using open process instead of shell
Thank you very much, great ideas from Mark Wieder, Mike Bonner, Warren Samples I will be working with these suggestions for the next couple of days and report back to you guys. sqb -- Stephen Barncard - Sebastopol Ca. USA - mixstream.org On Sun, Dec 24, 2017 at 9:10 PM, Warren Samples via use-livecode < use-livecode@lists.runrev.com> wrote: > On 12/24/2017 04:05 PM, Stephen Barncard via use-livecode wrote: > >> All of the commands work great by using the shell command in LC, except >> for >> the fact that my app waits until some of the commands have finished. >> > > > If your concern is bypassing the blocking nature of shell(), then you > should be aware that there are methods which detach a process from the > shell after opening it and these can be used in LiveCode shell() to make it > non-blocking. > > For example: > > get shell ("nohup mycommand --some-params 'can use single quotes to escape > if necessary' &") > > here the command is prefaced with the 'nohup' and a space and is closed > with a space and & > > > There are several variations for redirecting to /dev/null which also work > to make the shell() non-blocking. Here's an example: > > get shell ("mycommand --some-params 'can use single quotes to escape if > necessary' /dev/null &") > > > This doesn't respond to your direct question about "open process" but it > *may* be a straightforward way to resolve the issue that has caused you to > inquire. > > Good Luck, > > Warren > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Using open process instead of shell
On 12/24/2017 04:05 PM, Stephen Barncard via use-livecode wrote: All of the commands work great by using the shell command in LC, except for the fact that my app waits until some of the commands have finished. If your concern is bypassing the blocking nature of shell(), then you should be aware that there are methods which detach a process from the shell after opening it and these can be used in LiveCode shell() to make it non-blocking. For example: get shell ("nohup mycommand --some-params 'can use single quotes to escape if necessary' &") here the command is prefaced with the 'nohup' and a space and is closed with a space and & There are several variations for redirecting to /dev/null which also work to make the shell() non-blocking. Here's an example: get shell ("mycommand --some-params 'can use single quotes to escape if necessary' /dev/null &") This doesn't respond to your direct question about "open process" but it *may* be a straightforward way to resolve the issue that has caused you to inquire. Good Luck, Warren ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Using open process instead of shell
IGnore the "with message" part, had a brain freeze. It would be -- open process pdata for text read And then do the -- send "monitorslave pData' to me in 50 millisec -- to start the loop. Just tested on linux. I can start a find process, grab the output of dmesg and cat a file and direct output to different fields. But the processes don't auto close on completion, so you'd have to have a way to recognize when each finishes based on their output, and close the process. (or if you don't care about the output, you can open process tProcess for neither Which should start a disconnected process that will exit when complete (assuming its a command that exits on completion) Another possible method that should make it easy to see when such a process ends (if you DO want to read the output) would be to open a shell process for text update. Then write your command to that shell, and read the output. When it returns to a prompt, its done. Example code (not using a shell) follows: local tstarttime on mouseup put empty into field 1 put empty into field 2 put empty into field 3 put the seconds into tstarttime -- start 3 processes put "dmesg" into tProcess1 put "find /" into tProcess2 put "cat /etc/fstab" into tProcess3 open process tProcess1 for text read monitorslave tProcess1 open process tProcess2 for text read monitorslave tProcess2 open process tProcess3 for text read monitorslave tProcess3 end mouseup command monitorSlave pProcess switch case pProcess contains "dmesg" read from process pProcess until empty put it after field 1 break case pProcess contains "find" read from process pProcess until empty put it after field 2 break case pProcess contains "cat" read from process pProcess until empty put it after field 3 break end switch if pProcess is not among the lines of openprocesses() then exit "monitorslave" else send "monitorslave pProcess" to me in 100 millisec end if -- quick and dirty method of stopping the processes after a minute -- since this is only testing if the seconds - tstarttime > 60 then closeProcesses end monitorSlave command closeprocesses repeat for each line tline in openprocesses() close process tLine end repeat end closeprocesses On Sun, Dec 24, 2017 at 5:56 PM, Mike Bonner <bonnm...@gmail.com> wrote: > Off the top of my head, untested (no mac available) > > on executeProcess pData > put whereAmI() into a; set the defaultFolder to a > -- I'd bipass this > --get "file:xprocess.bat" > --put pData into URL it > > > open process "file:xprocess.bat" for text write > -- this part, if you want to use a shell file (bat?) you a) have to make > sure its set to executable > -- b) You'd want to prepend #!/bin/sh so that it knows what shell to use > on execution (or use sh xprocess.bat as your command) > -- c ) Don't think it will work using the URL form It should be -- open > process "xprocess.bat" for text read > -- text read because you want to read the output (or update if you need to > send additional commands interactive) > > --Since you want to be able to check progress you'll need to start a read > loop too.. > -- if it were me, i'd just call openprocess with your known working > command line > open process pData for text read with message > > -- start read loop > send "monitorslave pdata" to me in 50 millisec > > close executeProcess > > > command monitorslave pProcess > -- read loop.. DO what you need to check progress here.. > read from process pProcess until empty > > -- Somewhere in here you'll need to determine if the process is done, > close it, and exit without looping again > -- or update status and loop again > > send monitorslave pProcess to me in 50 millisec -- loop again if not > done > end monitorslave > > > if you want to use the same slave loop for multiple processes, you'll of > course have to parse the url to know how to handle the output > (Or just make a custom slave loop for each of your 3 executables) > I also don't know if you will actually need to close the process, or if it > will self close when done. As mark pointed out, you can look at > openprocesses() to see whats currently running. > > > > On Sun, Dec 24, 2017 at 4:30 PM, Mark Wieder via use-livecode < > use-livecode@lists.runrev.com> wrote: > >> On 12/24/2017 02:05 PM, Stephen Barncard via use-livecode wrote: >> >> Does someone out there have a clear example of what I am looking for, >>> using a UNIX executable through *open process *? >>> >>> 1.call the function with parameters &g
Re: Using open process instead of shell
Off the top of my head, untested (no mac available) on executeProcess pData put whereAmI() into a; set the defaultFolder to a -- I'd bipass this --get "file:xprocess.bat" --put pData into URL it open process "file:xprocess.bat" for text write -- this part, if you want to use a shell file (bat?) you a) have to make sure its set to executable -- b) You'd want to prepend #!/bin/sh so that it knows what shell to use on execution (or use sh xprocess.bat as your command) -- c ) Don't think it will work using the URL form It should be -- open process "xprocess.bat" for text read -- text read because you want to read the output (or update if you need to send additional commands interactive) --Since you want to be able to check progress you'll need to start a read loop too.. -- if it were me, i'd just call openprocess with your known working command line open process pData for text read with message -- start read loop send "monitorslave pdata" to me in 50 millisec close executeProcess command monitorslave pProcess -- read loop.. DO what you need to check progress here.. read from process pProcess until empty -- Somewhere in here you'll need to determine if the process is done, close it, and exit without looping again -- or update status and loop again send monitorslave pProcess to me in 50 millisec -- loop again if not done end monitorslave if you want to use the same slave loop for multiple processes, you'll of course have to parse the url to know how to handle the output (Or just make a custom slave loop for each of your 3 executables) I also don't know if you will actually need to close the process, or if it will self close when done. As mark pointed out, you can look at openprocesses() to see whats currently running. On Sun, Dec 24, 2017 at 4:30 PM, Mark Wieder via use-livecode < use-livecode@lists.runrev.com> wrote: > On 12/24/2017 02:05 PM, Stephen Barncard via use-livecode wrote: > > Does someone out there have a clear example of what I am looking for, >> using a UNIX executable through *open process *? >> >> 1.call the function with parameters >> 2. allow livecode scripts to continue >> 3. continuously monitor and display data returned by that function >> >> >> thank you all so much for any and all information, >> > > check out the openProcesses function to see what's still in play > here's an example from the 'close process' doc: > > close process myProcess > wait until myProcess is not among the lines of the openProcesses > open process myProcess > > > -- > Mark Wieder > ahsoftw...@gmail.com > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Using open process instead of shell
On 12/24/2017 02:05 PM, Stephen Barncard via use-livecode wrote: Does someone out there have a clear example of what I am looking for, using a UNIX executable through *open process *? 1.call the function with parameters 2. allow livecode scripts to continue 3. continuously monitor and display data returned by that function thank you all so much for any and all information, check out the openProcesses function to see what's still in play here's an example from the 'close process' doc: close process myProcess wait until myProcess is not among the lines of the openProcesses open process myProcess -- Mark Wieder ahsoftw...@gmail.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Using open process instead of shell
Hi gang, I need a little help here. I am creating a Macintosh app on the desktop for my own use. I am making an archive of all the "Spirit of K JAZ" shows by the late Jerry Dean.After the terrestrial radio station went off the air, he and fellow air mate Stan Dunn started streaming the shows on the net for most of the 2000 decade. There are over 800 1-hour shows in this collection. After archiving the first 200 shows, I quickly tired of using individual apps to do the separate steps of photographing the cover, putting in folder, and transferring the data, while keeping the same file name for all of them. So I created a stack which controls several command line executables I have three executable binaries that I call from this app. imagesnap ffmpeg SOX All of the commands work great by using the shell command in LC, except for the fact that my app waits until some of the commands have finished. In the case of one of them for example, it is importing a audio file from a CD, and turning it into a wave file using *ffmpeg*. ./ffmpeg -i '/Volumes/Audio CD/1 Audio Track.aiff' '/Users/stephenbarncard/Desktop/img/20171113_LIVE_ON_MARz.wav' [ above command on one line ] This takes up to 10 minutes to copy for a 60 minute CD. The ./ at the beginning is the only difference between what I was saying in my shell call from LC and what works in Terminal. The executables live directly adjacent to the live code stack, to simplify addressing. I got about this far with my coding, reading stuff from forums and the dictionary, but I just can't seem to put the right words together. pData is the command that works from the shell. on executeProcess pData put whereAmI() into a; set the defaultFolder to a get "file:xprocess.bat" put pData into URL it open process "file:xprocess.bat" for text write etc.. close executeProcess Does someone out there have a clear example of what I am looking for, using a UNIX executable through *open process *? 1.call the function with parameters 2. allow livecode scripts to continue 3. continuously monitor and display data returned by that function thank you all so much for any and all information, And a happy non-sectarian Christmas to everyone! *Stephen Barncard - Sebastopol Ca. USA - * *mixstream.org* <http://mixstream.org> ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Open Process, Interactive Shell on OS X
Each 'shell' opens it's own "terminal" session. You have to do your own housekeeping (stdin, stdout). Why don't you use (secure) sockets? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Open Process, Interactive Shell on OS X
Has anyone run an interactive shell session of any kind on Mac OS X? If so can you share some code? in the dictionary it says you cannot use the open process command on OS X to run a unix process. but you should use "shell" instead. OK that works... but once you get the result back from shell, how do you continue to interact with that process if it was not opened by "open process" You can do this: put " sftp someUser:somepassw...@somedomain.com" into tCmd put shell(tCmd) after fld "SFTPsession" and you get back "Connected to myDomain.com" But how would continue to interact? If we do this: put " sftp devhap:v1oletr8z4s...@dev.himalayanacademy.com" into tCmd put shell(tCmd) after fld "SFTPsession" wait 2 seconds put "ls" into tCmd put cr & cr (tCmd) after fld "SFTPsession" put the result we get a listing for the current defaultfolder that is the last default folder set by the LC stack we are working in which is a local folder and not a remote listing. BR ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
open process for neither
Hi Can anyone clarify the docs for me on a point: Use the neither form to run the process without reading data from it or sending data to it. (Using this form is equivalent to using the launch command to start up a program.) Processes opened with the neither form will quit automatically when finished running. When you quit the application, processes opened with the read, write, or update forms are quit automatically. The second sentence doesn't mention the for neither form so what I'm hoping is that those processes are independent of the application allowing them to finish whatever they are doing even if the parent app quits. Cheers -- M E R Goulding Software development services Bespoke application development for vertical markets mergExt - There's an external for that! ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode