Re: Using open process instead of shell

2017-12-24 Thread Warren Samples via use-livecode

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: Android package installer hangs (Oreo)

2017-12-24 Thread Sannyasin Brahmanathaswami via use-livecode
I tried building for Android on 9.0 dp 11 yesterday and got some weird font 
mapping issues.

Pixel arrived (wow! iOS, seems a bit primitive now…) used, unlocked, (looks 
brand new) no sim… I got wi-fi. immediate prompted me to upgrade to 8.1, which 
I did.

in LC 8.1.9 I can't see it in the test menu, no matter what I do, reboot, 
restart LC, with phone plugged, unplugged.

But I got a neat droid transfer app for Mac… go to connected devices, switch 
USB to transfers (I guess you do that already with Drop Box..) So I can turn 
the phone into a "volume" that appears inside the app like a finder window…  
and copy the apk from my LC builds folder into Downloads on the phone and then 
install.  

So, that's working… 

Sadly the rendering fixes in 8.1.9 are not resolving all issues we had before… 
sure, we can now leave the app via Home or App switcher, and come back without 
the app stopping, but switching between stacks which require accelerated 
rendering is still full of bugs…all works perfectly on iOS (sigh) so back to 
debugging-android challenges.

iMac high Sierra:  

On 12/23/17, 2:29 PM, "use-livecode on behalf of J. Landman Gay via 
use-livecode"  wrote:

Is anyone else here running Android 8.1/Oreo? My test app is hanging the 
package installer right near the end of the process. This happens both 
when running Test in the IDE (requiring a force-quit) and also if I 
build a standalone and move it via Dropbox. Installing from Dropbox, the 
progress bar goes about 9/10 of the way, and everything freezes. Only 
the Home button gets me out. The app is not shown in the app drawer.

If I try to install again, I'm asked if I want to update the current app 
(which didn't really install) and the install completes. I can open and 
run the app. When I go back to Dropbox, the frozen installer window from 
the first try is still there. I have to go to settings and force quit 
the package installer to get rid of it.

I can't tell if there is something about the LC build itself or a bug in 
Oreo. The same apk installs fine on my Samsung running 6.0.1. Play Store 
apps install okay too.

Nothing on Google about it.

LC 9.0 dp 11, Java 1.8, Mac OS X Sierra

___
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: Remote Debugging on iOS

2017-12-24 Thread Sannyasin Brahmanathaswami via use-livecode
jacque wrote:

Remote debugging doesn't work with script-only stacks (I had to ask here
on the list myself a while back.) The breakpoint has to be saved with the
standalone, and script-only stacks don't have properties so breakpoints
can't be saved.

Hmm OK, so that means we have to drop one at a trigger point in the stack like 
"on mouseup"  but now, some of my stacks/cards are "pure views" with *narry* a 
drop of code in them… So I suppose a "hack" could be to add, in the 
button,card, stackscript

on mouseup
breakpoint
pass mouseup
end mousup

At least, once we start stepping through then at least we are looking lines in 
the script only libs/behaviors.

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

Re: Using open process instead of shell

2017-12-24 Thread Mike Bonner via use-livecode
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  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
>>> 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 

Re: Using open process instead of shell

2017-12-24 Thread Mike Bonner via use-livecode
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

2017-12-24 Thread Mark Wieder via use-livecode

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

2017-12-24 Thread Stephen Barncard via use-livecode
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* 
___
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

Merry Christmas and Happy Blockchain Year

2017-12-24 Thread Dev via use-livecode
Merry Christmas List,

Wish you all Happy Holidays and all the nice stuff.
2018 is the year when we finally break free… of the tyranny.

Cheers,
Debdoot

PS. If anyone is working on or interested in working on the blockchain, please 
feel free to email me.

___
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