I'm doing something that you would think would be blindingly simple, yet I'm tripping all over myself finding an answer. How can I pop up a window asking a user for a value and then capture that from STDOUT? This works on Linux and Mac but not Windows.
Code: Select all
OpenConsole()
If OpenWindow(0, 100,100,200, 200, "Best power ranger?")
StringGadget(1, 10, 10, 180, 140, "")
ButtonGadget(2, 10, 150, 180, 30, "Done")
EndIf
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
If EventGadget() = 2
PrintN( GetGadgetText(1) )
End
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
What I want to be able to do is make a simple little pop-up which asks for something from a scripting language. Like so:
It seems like it loses it's connection to the console when I run the program and I don't get the output. Also, I don't really need the console window so I'm hiding it with ShowWindow_() and GetConsoleWindow_(). I'm feeling pretty sad about the prospects of this working. Is it possible?
Many thanks in advance.