Share your advanced PureBasic knowledge/code with the community.
Rook Zimbabwe
Addict
Posts: 4322 Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:
Post
by Rook Zimbabwe » Sat Dec 27, 2008 3:30 am
But... but... my keyboard doesn't HAVE an ANY key!!!
Seriously nice idea Mistrel!
Kaeru Gaman
Addict
Posts: 4826 Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany
Post
by Kaeru Gaman » Sat Dec 27, 2008 3:50 am
doesn't work properly...
Code: Select all
OpenConsole()
PrintN("test")
RunProgram("cmd.exe","/k pause","")
PrintN("test")
Input()
1. the second print is executed before the wait
2. if you press enter, the console would not be closed but you will end up in the dos prompt
oh... and have a nice day.
Mistrel
Addict
Posts: 3415 Joined: Sat Jun 30, 2007 8:04 pm
Post
by Mistrel » Sat Dec 27, 2008 5:22 am
It's only useful to pause the console as it ends not while it's running.
graves
Enthusiast
Posts: 160 Joined: Wed Oct 03, 2007 2:38 pm
Location: To the deal with a pepper
Post
by graves » Sat Dec 27, 2008 8:18 am
Code: Select all
OpenConsole()
print("Press any key to continue...")
input()
printn("pressed...")
input() ; to avoid immediate close
CloseConsole()
Trond
Always Here
Posts: 7446 Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway
Post
by Trond » Sat Dec 27, 2008 12:59 pm
graves wrote: Code: Select all
OpenConsole()
print("Press any key to continue...")
input()
printn("pressed...")
input() ; to avoid immediate close
CloseConsole()
Try it with any key but enter.
This works properly.
Code: Select all
Procedure WaitAnyKey()
While Not Inkey()
Delay(10)
Wend
EndProcedure
OpenConsole()
PrintN("Press any key to continue...")
WaitAnyKey()
PrintN("ok")
Input()
CloseConsole()
hallodri
Enthusiast
Posts: 208 Joined: Tue Nov 08, 2005 7:59 am
Location: Germany
Contact:
Post
by hallodri » Sat Dec 27, 2008 2:12 pm
try this :
Code: Select all
ImportC "msvcrt.lib"
system(str.p-ascii)
EndImport
OpenConsole()
system("Pause")
Last edited by
hallodri on Sat Dec 27, 2008 2:47 pm, edited 1 time in total.
AND51
Addict
Posts: 1040 Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:
Post
by AND51 » Sat Dec 27, 2008 2:22 pm
Rook Zimbabwe wrote: But... but... my keyboard doesn't HAVE an ANY key!!! Mine
has this key...
@ hallodri:
cmd wrote: Der Befehl "P" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
(command not found)
hallodri
Enthusiast
Posts: 208 Joined: Tue Nov 08, 2005 7:59 am
Location: Germany
Contact:
Post
by hallodri » Sat Dec 27, 2008 2:50 pm
for Unicode try _wsystem(str.s)
AND51
Addict
Posts: 1040 Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:
Post
by AND51 » Sat Dec 27, 2008 3:39 pm
Sorry, I forgot that I've enabled Unicode by default.
In ASCII mode, it works.
Kaeru Gaman
Addict
Posts: 4826 Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany
Post
by Kaeru Gaman » Sat Dec 27, 2008 3:46 pm
Mistrel wrote: It's only useful to pause the console as it ends not while it's running.
lolz?
nonsense!
a pause is a pause is a pause.
@hallodri
thnx!
oh... and have a nice day.
SFSxOI
Addict
Posts: 2970 Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....
Post
by SFSxOI » Sat Dec 27, 2008 9:48 pm
Rook Zimbabwe wrote: But... but... my keyboard doesn't HAVE an ANY key!!!
Seriously nice idea Mistrel!
Thank You Mistrel
@ Rook Zimbabwe - I'm guessing you don't have unicode capability with your keyboard either do you?
Rook Zimbabwe
Addict
Posts: 4322 Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:
Post
by Rook Zimbabwe » Sat Dec 27, 2008 10:04 pm
I use the UTF-Texas standard... YeeHAH!!
Nope... I don't generally use unicode!
Mistrel
Addict
Posts: 3415 Joined: Sat Jun 30, 2007 8:04 pm
Post
by Mistrel » Sun Dec 28, 2008 6:09 am
hallodri wrote: try this :
Code: Select all
ImportC "msvcrt.lib"
system(str.p-ascii)
EndImport
OpenConsole()
system("Pause")
Thank you for this, hallodri. I was actually trying to use the same function "System" which is available in Dev-C++ for calling Pause but could not find something similar in PureBasic. This is it.
Rescator
Addict
Posts: 1769 Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway
Post
by Rescator » Sun Dec 28, 2008 9:07 am
Code: Select all
OpenConsole()
Print("Press enter/return to continue . . . ")
Input()
CloseConsole()