Page 1 of 1 1
Topic Options
#129002 - 2004-11-04 03:16 PM MESSAGEBOX help
Anonymous
Unregistered


Hi, I'm still a bit n00by when it comes to Kix.

What I am trying to do is run a Messagebox which is time lapsed.......whilst this messagebox ("please wait...") is running, run a batch file which deletes some files, and once that is done, return to another Messagebox how many files have been deleted, or that simply knows the deletion has finished and displays a message (such as "Files deleted - Continuing with Logon")

anyone help me please. I cant seem to get the style without any boxes on. Haven't even got to the second messagebox.

Cheers Wiggz

Top
#129003 - 2004-11-04 03:31 PM Re: MESSAGEBOX help
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
You have a number of choices:
1) Create a "window" in the console, and use that.
2) Install KiXforms on all your clients and use that.
3) Use Internet Explorer.

The last is probably the easiest, so long as all your client machines have IE installed.

Top
#129004 - 2004-11-04 03:32 PM Re: MESSAGEBOX help
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Not possible I'm afraid ... You can't remove ALL the buttons from MessageBox, plus MessageBox is modal which means that it has to be dismissed by the user before you can carry-on with your script. There are "other" options like Kixforms or IE Windows but this would probably be over-kill for your stuff (ja?) ...


Top
#129005 - 2004-11-04 03:40 PM Re: MESSAGEBOX help
Anonymous
Unregistered


Yea sounds like Kixforms would be overkill.

And I cn make the Box Dissappear by itself without the user pressing ok though. So the user doesn't have to dismiss it!

In that case...say i give them Msgbox1 which says "Deleteing Files press OK".....they press ok.....and then another box comes up and says files deleted

1) how do I do that and,
2) could I add any event data to that second box such as how many files have been deleted

cheers

Wiggzz

Top
#129006 - 2004-11-04 03:42 PM Re: MESSAGEBOX help
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Use IE.

It's actually much simpler than trying to kludge around with MessageBox().

Top
#129007 - 2004-11-04 03:44 PM Re: MESSAGEBOX help
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
With something like this ...

break on

$answer = MessageBox("Deleteing Files press OK...", "", 0)

; delete your files here ...

$answer = MessageBox("files deleted, press OK ...", "", 0)

exit 0

-Shawn

Top
#129008 - 2004-11-04 04:01 PM Re: MESSAGEBOX help
Anonymous
Unregistered


See this is the problem, I dont understand anything you just did above )

Wiggz

Top
#129009 - 2004-11-04 04:04 PM Re: MESSAGEBOX help
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Guess then it is time to read the manual. If you are not ready for MessageBox() then IE COM will be way out of your league.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#129010 - 2004-11-04 04:09 PM Re: MESSAGEBOX help
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hmmm, this line here:

$answer = MessageBox("Deleteing Files press OK...", "", 0)

Displays a messagebox with specified text, and an OK button, and asks the user to press OK, when they do - control is returned back to your script, where you delete the files, at the end this:

$answer = MessageBox("files deleted. press OK...", "", 0)

displays another messagebox saying files deleted, the user has to press OK again, and the login script carrys on ...

The second parameter to Messagebox ("") is the title, i just used a null string for that, and the third param (0), specifies all the various flavors and options for Messagebox (buttons, icons, etc). I just used zero which means take all the defaults.

While your reading the manual, might want to look at the option to have timeouts on the MessageBox ... important stuff for login scripts maybe.

Top
#129011 - 2004-11-04 04:18 PM Re: MESSAGEBOX help
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
But beware the timout caveat. If the MessageBox() loses focus, the timer stops. IE (maybe with KiXpop) with embeded timer would be a better way to go. Search the board for funky splash.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#129012 - 2004-11-04 04:25 PM Re: MESSAGEBOX help
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Quote:

You have a number of choices:
1) Create a "window" in the console, and use that.
2) Install KiXforms on all your clients and use that.
3) Use Internet Explorer.

The last is probably the easiest, so long as all your client machines have IE installed.




If I were you I'd probably start with Option 1, the good old ugly but easy logon console.
Then if your skills improve you may replace that by an IE COM object, but first things first
Just never use something for simple tasks you don't fully understand!
Show us what you got so far and we may help you with whatever you decide to use

[this would be another case for a 'chambre separé' aka chat room]


Edited by Jochen (2004-11-04 04:28 PM)
_________________________



Top
#129013 - 2004-11-04 04:32 PM Re: MESSAGEBOX help
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Here is an example of a messagebox using IE:
Code:
$oIE=funMakeIE("Countdown timer demo",150,400)


For $i = 10 To 0 Step -1
Select
Case $i<3 $COLOUR="RED"
Case $i<6 $COLOUR="YELLOW"
Case "Default" $COLOUR="GREEN"
EndSelect
$oIE.document.body.innerHTML="<CENTER><FONT COLOR="+$COLOUR+" SIZE=7>Countdown: "+$i+"</FONT></CENTER>"
Sleep 0.5
Next
$oIE.document.body.innerHTML="<CENTER><FONT COLOR=RED SIZE=7><B>**BOOM**</B></FONT></CENTER>"
Sleep 3

$oIE.Quit
$oIE=0
Exit 0

; -------------------------------------------------------
; Ignore everything below here - this is black-box magic.
; -------------------------------------------------------



Function funMakeIE($sTitle,$iHeight,$iWidth)
$funMakeIE=CreateObject("InternetExplorer.Application")
If $funMakeIE
; Remove clutter
$funMakeIE.toolbar=0 $funMakeIE.menubar=0 $funMakeIE.addressbar=0 $funMakeIE.statusbar=0
; Load dummy
$funMakeIE.navigate("about:blank")
funWait($funMakeIE)
Else
funError("Cannot create IE object")
Exit 1406
EndIf

$funMakeIE.document.write("<HTML>
<HEAD>
<!--
Hand crafted script
Created R. Howarth March 2004
-->
<TITLE>"+$sTitle+"</TITLE>
<SCRIPT Language=JavaScript>
function funDispatcher(s){
frmMain.sStatus.value+=s+';';
}
function funGetScreenSize(){
frmMain.screenheight.value=screen.availHeight;
frmMain.screenwidth.value=screen.availWidth;
}
</SCRIPT>
</HEAD>
<BODY onLoad='funGetScreenSize();' BGCOLOR=LIGHTGREY>
<FORM Name=frmMain>
<INPUT Type=Hidden Name=screenheight Value=''>
<INPUT Type=Hidden Name=screenwidth Value=''>
</FORM>
</BODY>
</HTML>")

$funMakeIE.refresh()
funWait($funMakeIE)
$funMakeIE.height=$iHeight
$funMakeIE.width=$iWidth
$funMakeIE.left=(Cint($funMakeIE.document.frmMain.screenwidth.value)-$iWidth)/2
$funMakeIE.Top=(Cint($funMakeIE.document.frmMain.screenheight.value)-$iHeight)/2
$funMakeIE.visible=1
funWait($funMakeIE)
$=SetFocus($TITLE)
$funMakeIE.visible = 1

Exit 0
EndFunction

Function funWait($oIE)
While $oIE.busy AND $oIE.readystate <> 4 AND @error = 0 Loop
EndFunction



It may look a bit complicated, but you don't need to know how the functions work - just follow what is going on in the first dozen lines or so.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1376 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.066 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org