Re: [Factor-talk] Factor As Scripting Language

2016-10-26 Thread Björn Lindqvist
A Factor version of the C function Beached is posting would be a nice addition to the windows.privileges vocab. 2016-10-25 23:05 GMT+02:00 Doug Coleman : > Take a look at basis/windows/privileges/privileges.factor and > http://stackoverflow.com/questions/8046097/how-to-check-if-a-process-has-the-a

Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Alexander Ilin
25.10.2016, 23:49, "Onorio Catenacci" :This issue is that certain tasks require administrator privilege onWindows and it's much more friendly to check the current user'sprivileges and inform the user that he or she needs to elevate toadmin than simply fall over. :)Well, that would mean that the pro

Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Doug Coleman
Take a look at basis/windows/privileges/privileges.factor and http://stackoverflow.com/questions/8046097/how-to-check-if-a-process-has-the-administrative-rights On Tue, Oct 25, 2016 at 1:49 PM Onorio Catenacci wrote: > This issue is that certain tasks require administrator privilege on > Windows

Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Onorio Catenacci
This issue is that certain tasks require administrator privilege on Windows and it's much more friendly to check the current user's privileges and inform the user that he or she needs to elevate to admin than simply fall over. :) Sadly before Windows 7 most users are on their machine as admins by

Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Onorio Catenacci
Thanks Doug--that's sort of what I was hoping for. Like you my issue would be figuring out which API's to call. On Tue, Oct 25, 2016 at 4:13 PM, Doug Coleman wrote: > You should be able to call the Windows APIs directly (if you can figure out > which ones!) and avoid using a script to call a bi

Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Alexander Ilin
 25.10.2016, 23:13, "Doug Coleman" :You should be able to call the Windows APIs directly (if you can figure out which ones!) and avoid using a script to call a binary. That's true. I'm simply having fun with that little task. Parsing the output and such.If I needed to solve that problem in a proper

Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Doug Coleman
You should be able to call the Windows APIs directly (if you can figure out which ones!) and avoid using a script to call a binary. On Tue, Oct 25, 2016 at 1:02 PM Alexander Ilin wrote: > The same, but a bit more elaborate (and hopefully more readable): > > USING: documents.private io io.encodin

Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Alexander Ilin
The same, but a bit more elaborate (and hopefully more readable): USING: documents.private io io.encodings.utf8 io.launcher kernelmath sequences sets splitting ;IN: other ! Find the header line in the sequence and return it with its number.: find-header ( lines -- num/f line/f )    [ members "= " =

Re: [Factor-talk] Factor As Scripting Language

2016-10-24 Thread Alexander Ilin
Here's a small utility for you: USING: io.launcher io.encodings.utf8 sequences sets documents.private ;: user-groups ( -- seq/f )    "whoami /groups" utf8 [ contents ] with-process-reader split-lines    dup [ members "= " = ] find    [    [ 1 + tail ] dip    [ CHAR: space = ] find drop 

Re: [Factor-talk] Factor As Scripting Language

2016-10-24 Thread Onorio Catenacci
Ok, thanks for the clarification folks. I guess I should have assumed anything other than f would be true. :) I'm a member of IEEE--mainly for the articles. :) > Yeah, Factor is pretty cool, I agree. : ) > > I see you are with IEEE. That's cool, too : ) > -- Onorio Catenacci http://onor.

Re: [Factor-talk] Factor As Scripting Language

2016-10-24 Thread Alexander Ilin
24.10.2016, 19:08, "Onorio Catenacci" :Oh--ok. So I could tack on a "0 >" (minus the quotes of course) atthe end and that'd work out. In fact that's exactly what I want. :)Nope, `f 0 >` would throw an exception.You could use `>boolean` if you want strictly a `t` or `f` return value.`f >boolean` ->

Re: [Factor-talk] Factor As Scripting Language

2016-10-24 Thread John Benediktsson
You shouldn't need to "0 >" because 641 is considered a "non false" value. On Mon, Oct 24, 2016 at 9:07 AM, Onorio Catenacci wrote: > Oh--ok. So I could tack on a "0 >" (minus the quotes of course) at > the end and that'd work out. In fact that's exactly what I want. :) > > Yes, you can autom

Re: [Factor-talk] Factor As Scripting Language

2016-10-24 Thread Onorio Catenacci
Oh--ok. So I could tack on a "0 >" (minus the quotes of course) at the end and that'd work out. In fact that's exactly what I want. :) Yes, you can automate data entry into a website with Selenium. They've got bindings for C#, Java, Python and a few other languages. I was hoping that maybe someo

Re: [Factor-talk] Factor As Scripting Language

2016-10-24 Thread Alexander Ilin
Hi! 24.10.2016, 18:27, "Onorio Catenacci" :Thanks for the suggestion Александр! Oddly enough when I enter thatstring into the Repl on Windows 7 I get 641. I tried breaking up thecommand sequence over two lines (breaking at the ";") and the resultis the same.The entire output of "whoami /groups" (ta

Re: [Factor-talk] Factor As Scripting Language

2016-10-24 Thread Onorio Catenacci
Thanks for the suggestion Александр! Oddly enough when I enter that string into the Repl on Windows 7 I get 641. I tried breaking up the command sequence over two lines (breaking at the ";") and the result is the same. The version of the Repl is: Factor 0.98 x86.64 (1788, heads/master-e187d63d3c

Re: [Factor-talk] Factor As Scripting Language

2016-10-24 Thread Alexander Ilin
Hi! 24.10.2016, 16:38, "Onorio Catenacci" :I want to be able to verify that the currently logged-in user hasadmin permissions. Any pointers to blog postings or vocabularies Imay want to look at? This will tell you if the current user is a member of the Administrators group: USING: io.launcher io.en

[Factor-talk] Factor As Scripting Language

2016-10-24 Thread Onorio Catenacci
Hi all, Apologies for the broad questions but so far my Google-Fu has been less than effective. I want to use Factor as a scripting language for Windows. I want to be able to verify that the currently logged-in user has admin permissions. Any pointers to blog postings or vocabularies I may want