Une petite application console a utiliser dans des fichiers batch (*.bat, *.cmd)
Syntaxe: pausewait <"Votre message"> [<Secondes>]
Exemple: pausewait "Veuillez patienter" 10
Les exécutables et les sources sont disponible ici
Code : Tout sélectionner
;************************************************************************
;Titre : pausewait.pb
;Auteur : (C) 2019 CAGE
;Date : 2019/03/14
;Version PB : PureBasic 5.70 LTS (Windows - x86)
;Version PB : PureBasic 5.70 LTS (Windows - x64)
;Compiler Options
;Compiler Options : Executable format: Console
;Compile/Run : Create temporary executable in the source directory
;
;Libairies: aucunes
;
;************************************************************************
;
EnableExplicit
OnErrorGoto(?ErrorHandler)
Define message$, myparam$
Define p, p$, seconds=0
Global rcode=#False
Procedure Help()
If OpenConsole()
PrintN(#Null$)
PrintN("Syntaxe: pausewait <"+Chr(34)+"Votre message"+Chr(34)+"> [<Secondes>]")
PrintN(#Null$)
CloseConsole()
EndIf
rcode=#False
End rcode
EndProcedure
Define count = CountProgramParameters() : Debug "count=" + count
If count=0 Or count>2
Help()
End #False
EndIf
NewMap myparam$()
If count
For p = 0 To count-1
p$ = Str(p)
myparam$(p$) = ProgramParameter(p) : Debug myparam$(p$)
Select myparam$(p$)
Case "/help", "/?"
Help()
End #False
EndSelect
Next
Select count
Case 1 : message$ = myparam$("0")
Case 2 : message$ = myparam$("0")
seconds = Val(myparam$("1"))
EndSelect
If OpenConsole()
PrintN(#Null$)
Select count
Case 2
For count = seconds To 1 Step -1
Print(message$+" "+count+"s"+Space(20)+#CR$)
Define key$ = Inkey()
If key$ <> ""
Break
EndIf
Delay(1000)
Next
Case 1
Print(message$+Space(20)+#CR$)
Repeat
Define key$ = Inkey()
If key$ <> ""
Break
EndIf
Delay(50)
ForEver
EndSelect
Print(Space(Len(message$)+20)+#CR$)
Print("Terminé."+#CR$)
PrintN(#Null$)
CloseConsole()
rcode=#True
EndIf
rcode=#True
Else
Help()
End #False
EndIf
ErrorHandler:
End rcode