r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Rebol School] Rebol School

Geomol
6-Oct-2011
[3962]
Pass! I'm not enough into your problem to point you into a direction. 
But go on and read some more of the docs, and you should be able 
to help yourself some more:

http://www.rebol.com/docs/core23/rebolcore.html
http://www.rebol.com/docs/dictionary.html
todun
6-Oct-2011
[3963]
@Geomel, thanks. Also, is it allowed for me to use REBOL/Core when 
doing stuff in REBOL/View?
Henrik
6-Oct-2011
[3964]
graphics related stuff is not possible in REBOL/Core.
GrahamC
6-Oct-2011
[3965]
R/View incorportes R/Core
todun
6-Oct-2011
[3966]
@Henrik, @GrahamC, thanks.
todun
8-Oct-2011
[3967x2]
Is there anyway to clear an info view after a button is pressed?
For example, if I press question button(displays the question in 
an info view), and then I press answer button(which displays the 
corresponding answer), when next I press question, I want the answer 
info view to go back to being blank. How can I do this? thanks.
Sunanda
8-Oct-2011
[3969x2]
The code in the next post demonstates most of the mechanics of what 
you are asking for:
question-database: [
    ["Doctor who?"  "Oops -- silence has fallen"]

    ["Is there a doctor in the house?" "Yes -- his name is Gregory"]
]



next-question: func [ ;; function to find and display the next question
   ][
   question-database: next question-database

   if tail? question-database [question-database: head question-database]
   question-field/text: first first question-database
     answer-field/text: ""
     show question-field
     show answer-field
    ]


   ;; code to define and run the panel
unview/all
view/new layout [
  across
  question-field: field ""
  answer-field: field ""
  return
  answer-button: button "show answer" [
               answer-field/text: second first question-database
               show answer-field
               ]
  next-button: button "Next question" [
                 next-question
                  ]
     ]

  ;; open code to start it running
next-question     
do-events
todun
8-Oct-2011
[3971]
@Sunanda, thanks. Let me play with it to see where the info view 
reseting takes place.
Henrik
8-Oct-2011
[3972x2]
try SET-FACE and CLEAR-FACE instead of setting and clearing face/text 
directly.
if you use:

source set-face

you can see what it does
todun
8-Oct-2011
[3974x2]
@Henrik, thanks. will do.
@Henrik, do you mean 'help set-face' ?
Henrik
8-Oct-2011
[3976]
yes, also that. I thought you would be interested in the source as 
well.
todun
8-Oct-2011
[3977]
@Henrik, thanks.
Sunanda
8-Oct-2011
[3978]
the resetting happens at the places where you see ...
    xxxx/text: ""     ;; (changes the value in the field)
    show xxx       ;; (redisplays the field on screen)
todun
8-Oct-2011
[3979]
@Sunanda, thanks again for pointing that out.
Singy
23-Nov-2011
[3980x2]
When I run this program via Crimson Editor it works perfectly:
ip: ["DC1" 10.75.48.14 "DC2" 10.75.48.11 ]

foreach [name address] ip [
	tmp: copy ""
	print join "Pinging " name

 print "***********************************************************"
	call/output reform ["ping " address " -n 2"] tmp
	print [head clear find/last tmp "Ping"]
]

When I run it via a shortcut (on Windows 7) it prints this:

Pinging DC1
*****************************************

and then it just hangs until I force it close.


Any ideas why running it via a shortcut would do this when running 
it via Crimson it works fine???
Pekr
23-Nov-2011
[3982]
What's your shortcut command?
Singy
23-Nov-2011
[3983]
C:\Users\Ken\Dropbox\Rebol\rebol.exe -s C:\Users\Ken\Dropbox\Rebol\ping-servers.r
Pekr
23-Nov-2011
[3984]
try using call/wait/output. Your above code should work though ...
Singy
23-Nov-2011
[3985x2]
When you use the /input, /output, /error, or /console refinements 
you automatically set the /wait refinement. -- according to the docs, 
but I will try it anyway :)
Tried it - it still hangs, bizarre!!
BrianH
23-Nov-2011
[3987]
What's the command in Crimson Editor for running a file of that type?
Singy
23-Nov-2011
[3988]
C:\Users\Ken\Dropbox\Rebol\rebol.exe  -s "$(FilePath)" 
The intial directory is: $(FileDir)

I'm using REBOL 2.7.8.3.1
Pekr
23-Nov-2011
[3989]
hmm, I tried call/output "start ping 10.10.10.10 -n 2" tmp: copy 
"", and R2 hangs too ....
BrianH
23-Nov-2011
[3990]
It works without start though, even if you do call/show. Maybe it's 
a bad interaction with start, Pekr.
Dockimbel
23-Nov-2011
[3991]
Works here on Windows 7 (using Singy's command-line). I'm using REBOL 
2.7.6 though, so it might be another issue with CALL native in 2.7.8.
Singy
23-Nov-2011
[3992]
Dock the shortcut target line, when run in a cmd console runs the 
program fine. The only time it does not run is when I try to run 
the same command from the shortcut!
Dockimbel
23-Nov-2011
[3993x3]
With Pekr's command-line, it hangs on once the ping finished.
Let me try with a shortcut on 2.7.6...
With a shorcut, it hangs too, but if you add a /SHOW refinement to 
CALL, it works.
Singy
23-Nov-2011
[3996]
Cool! Yes it does. Thanks Doc, but strange why it should need that 
- especially when the ugly blank console window now pops up.
Dockimbel
23-Nov-2011
[3997x3]
/SHOW is for showing the shell window, it's blank because the output 
is captured by REBOL.
It's probably a REBOL bug.
(the hanging, not the blank window).
Singy
23-Nov-2011
[4000]
Yes I think it is a bug, because the whole point of /output is to 
not use shell window but to capture the data that would be sent to 
it and use it instead in your program. Anyway - at least this is 
a workaround for now. Thanks for your input guys :))
Dockimbel
23-Nov-2011
[4001]
/SHOW is a late addition to CALL, we used to live with the DOS window 
for years.
Singy
23-Nov-2011
[4002x2]
Well - looks like I might be living with it for a few more yet - 
grins.
I have another question - probably a dumb one - can you use make 
routine! to tap into .Net or is this impossible because it is a managed 
language?
Dockimbel
23-Nov-2011
[4004]
make routine!

 only works on LOADable libraries, so you guessed right, you cannot 
 do that for managed code.
Singy
23-Nov-2011
[4005]
Thanks Doc. However, is there a way to tap into .Net from REBOL? 
As a network admin it would be useful at times. I know you can use 
call to draw upon powershell which in turn can use .Net but that 
seems a bit convoluted. Also I can use wmic via call as well. Any 
other thoughts on REBOL and .Net integration?
Dockimbel
23-Nov-2011
[4006x4]
Doing a quick search on this topic (as it's interesting also to me 
for Red), it seems that LOADing a .Net library is at least possible 
from C++: http://stackoverflow.com/questions/757298/loading-managed-c-dll-from-plain-c-program-via-loadlibrary
From REBOL, you could set up a TCP communication channel with a .Net 
app to pass commands and receive data. You can achieve that using 
plain REBOL code or using a messaging library like 0MQ.
Maybe you could just make a simple powershell script for making it 
work as slave for REBOL.
(using a TCP channel)
Singy
23-Nov-2011
[4010]
Using a powershell script definitely works because I have tried it 
- I just used: call "powershell scriptname.ps1" and it worked. But 
of course I need to know 3 languages to do this - REBOl, powershell 
and .Net.
Dockimbel
23-Nov-2011
[4011]
I meant using a powershell script for writing a server that would 
receive commands from a REBOL client through TCP. The REBOL client 
could then hide the powershell commands inside adequate REBOL functions, 
making it feel more natural.