Re: Python to LiveCode
I have converted from language to language and what I did initially was to comment what every section of code did and how it did it (algorithms and logic). The idea was that I should be able to delete the initial code and reproduce it using the comments. Then take the comments and write the code in the destination language. Yes you might organize it differently but my goal was to get it completely functional so that it could pass the existing unit tests on the original source. Once the code is functional, I refactored it to make it more in line with the way the destination code is typically structured. That’s what I did. Tedious but straightforward and successful. Kee Nethery > On Sep 28, 2019, at 11:35 AM, Patrick Roza via use-livecode > wrote: > > I would like to take the python code and convert it to LiveCode. I know > there is a cheat sheet but it is limited. > > 1. Has anybody attempted this and what worked and didn't work? > > 2. Can someone point out the problems moving from one programming language > to LiveCode? > > Everyone on the list has been great and thank all of you. > > Patrick, > ___ > 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
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
Python to LiveCode
I would like to take the python code and convert it to LiveCode. I know there is a cheat sheet but it is limited. 1. Has anybody attempted this and what worked and didn't work? 2. Can someone point out the problems moving from one programming language to LiveCode? Everyone on the list has been great and thank all of you. Patrick, ___ 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: Stacks and Sub Stacks
Is the handler in a script-only stack? Maybe the editor doesn't or can't scan those. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On September 27, 2019 10:31:22 PM Sannyasin Brahmanathaswami via use-livecode wrote: Thanks for answers of "how to get a list of all stacks?" put revLoadedStacks() put the mainstack stacksinuse all good! But, they return different resultsvery interesting... stackInUse does not include some stacks reported by "revLoaderStacks()" both lists have their use cases... but the mainstacks return all stacks, including those in use by the Rev/IDE... less useful with stacks more and more use as "views" in an MCV architecture. They do not appear in "stackInUse" but the DO appear in revLoaderStack(). That is a useful distinction. --- No one answers the other question, so I will ask it here, as it goes to Message Hierarchy "put gotSomeFruit() into tBanana" where " gotSomeFruit ()" is among the functions/handlers is found among "stackInUse". ie. You DO get an returned result from the function. But, sometimes, in the Script Editor, "Get Definition" is dimmed. Is this a known bug? 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 ___ 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: Stacks and Sub Stacks
On 9/27/2019 11:29 PM, Sannyasin Brahmanathaswami via use-livecode wrote: No one answers the other question, so I will ask it here, as it goes to Message Hierarchy "put gotSomeFruit() into tBanana" where " gotSomeFruit ()" is among the functions/handlers is found among "stackInUse". ie. You DO get an returned result from the function. But, sometimes, in the Script Editor, "Get Definition" is dimmed. Get Definition appears to work if and only if there is 2 or more instances of the message, function, etc. in the possible message paths. If there is only a single instance, such as their might be for a custom function like "gotSomeFruit()" then it is dimmed out. ___ 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