Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: message box
;============================================================================== ;Raymond Chevalier, March 2005 ;============================================================================== ;#include "udf_messagebox.wbt" ;syntax : ;======== ;MessageBoxCreate() ;opens the box ;MessageBoxTitle(Title_string) ;sets or change the box title ;MessageBox(text_string) ;displays a string in the main box ;MessageBoxTmp(text_string) ;displays a string in the temp box ;MessageBoxTime() ;displays current time + execution time in the box ;MessageBoxBar(position, max_range) ;displays a progress bar ;MessageBoxBar(0, max_range) ;deletes the progress bar ;MessageBoxPause(button_text) ;pauses execution and displays "button_text" #DefineSubroutine MessageBox(text_string) if !isdefined(messagebox_window) save_string = text_string MessageBoxCreate() text_string = save_string endif if !isdefined(messagebox_text) messagebox_text = strreplace(text_string, @crlf, @tab) else messagebox_text = strcat(messagebox_text, @tab, strreplace(text_string, @crlf, @tab)) while itemcount(messagebox_text, @tab) > 11 if !isdefined(messagebox_log) then messageBox_Log = itemextract(1, messagebox_text, @tab) else messageBox_Log = strcat(messageBox_Log, @tab, itemextract(1, messagebox_text, @tab)) messagebox_text = itemremove(1, messagebox_text, @tab) endwhile endif BoxdataClear(1, "EMPTY") BoxTextColor(1,"255,255,255") BoxColor(1,"42,204,191",0) BoxTextFont(1, "", 55, 30, 34) BoxDrawText(1, "10,160,999,900", strreplace(messagebox_text, @tab, @crlf), @TRUE, 0) RETURN #EndSubroutine #DefineSubroutine MessageBoxCreate() if !isdefined(messagebox_window) BoxesUp("200,10,800,360",@NORMAL) BoxColor(1,"42,204,191",0) BoxDrawRect(1,"0,0,1000,1000",2) BoxColor(1,"197,241,238",0) BoxDrawRect(1,"0,0,1000,150",2) messagebox_window = @true Boxdatatag(1, "EMPTY") MessageBoxStartTime = TimeYmdHms() MessageBox(strcat("Started at: ", strsub(MessageBoxStartTime, 12, -1))) messagebox_log = "" endif RETURN #EndSubroutine #DefineSubroutine MessageBoxTitle(Title_string) if !isdefined(messagebox_window) then MessageBoxCreate() BoxCaption(1,title_string) RETURN #EndSubroutine #DefineSubroutine MessageBoxTmp(text_string) if !isdefined(messagebox_window) save_string = text_string MessageBoxCreate() text_string = save_string endif BoxdataClear(1, "EMPTY") BoxTextColor(1,"139,139,139") BoxColor(1,"197,241,238",0) BoxTextFont(1, "", 55, 30, 34) BoxDrawText(1, "10,10,999,100", text_string, @TRUE, 0) RETURN #EndSubroutine #DefineSubroutine MessageBoxBar(MessageBox_n, MessageBox_total) if !isdefined(messagebox_window) then MessageBoxCreate() BoxdataClear(1, "EMPTY") if MessageBox_n == 0 BoxColor(1,"197,241,238",0) BoxDrawRect(1,"0,100,1000,150",2) return endif MessageBox_bar_length = itemextract(1, (((MessageBox_n * 1.000)/ MessageBox_total)*1000), ".") BoxColor(1,"255,255,255",0) BoxDrawRect(1,strcat(`0,105,`, MessageBox_bar_length, `,145`),2) if MessageBox_bar_length < 500 then BoxColor(1,"197,241,238",0) BoxTextColor(1,"20,2,125") BoxTextFont(1, "", 40, 70, 34) BoxDrawText(1, "475,105,525,145", strcat(MessageBox_bar_length/10, "%%"), @true, 5) RETURN #EndSubroutine #DefineSubroutine MessageBoxPause(button_text) if !isdefined(messagebox_window) then MessageBoxCreate() MessageBoxTime() Boxdatatag(1, "BOUTON") BoxButtonDraw(1, 1, button_text, "010,900,600,990") BoxButtonDraw(1, 2, "LOG", "650,900,990,990") beep while 1 BoxButtonWait() if BoxButtonStat(1,2) tempfile = strlower(FileCreateTemp("mbx")) filedelete(tempfile) tempfile = strreplace(tempfile, ".tmp", ".txt") fileput(tempfile, strreplace(strcat(messagebox_log, @tab, messagebox_text), @tab, @crlf)) run(tempfile, "") filedelete(tempfile) drop(tempfile) endif if BoxButtonStat(1,1) then break endwhile BoxdataClear(1, "BOUTON") RETURN #EndSubroutine #DefineSubroutine MessageBoxTime() if !isdefined(messagebox_window) then MessageBoxCreate() MessageBoxPauseTime = TimeYmdHms() MessageBoxDuration = TimeDiffSecs(MessageBoxPauseTime, MessageBoxStartTime) MessageBoxMin = MessageBoxDuration / 60 MessageBoxSec = strfixleft(MessageBoxDuration mod 60, "0", 2) MessageBox(strcat(@crlf, strsub(MessageBoxPauseTime, 12, -1), " (", MessageBoxMin, ":", MessageBoxSec, ")", @crlf)) RETURN #EndSubroutine #DefineSubroutine MessageBoxClose() drop(messagebox_window, MessageBoxStartTime, messagebox_text, messagebox_log) boxdestroy(1) RETURN #EndSubroutine
#include "udf_messagebox.wbt" MessageBox("Phase 1") timedelay(1) messageBoxTmp("Doing some processing...") timedelay(1) messageBoxTmp("Continuing processing...") timedelay(1) messageBoxTmp("Almost completed...") timedelay(1) messageBoxTmp("") timedelay(1) MessageBox("Phase 2") timedelay(1) MessageBox("Phase 3") timedelay(1) MessageBox("Starting Phase 4") for n=1 to 10 timedelay(1) messageBoxBar(n, 10) next timedelay(1) messageBoxBar(0, 10) timedelay(1) MessageBox("Phase 5") timedelay(1) messageBoxPause("Completed !") exit
Article ID: W17233
File Created: 2007:07:03:14:28:54
Last Updated: 2007:07:03:14:28:54