Page 1 of 2 12>
Topic Options
#41728 - 2003-06-18 04:27 PM Request
Kixtart_Newbie Offline
Fresh Scripter

Registered: 2003-06-18
Posts: 10
Loc: Florida
I am new to creating scripts using Kixtart. Can anyone help me along with a simple example for display an alert box (OK/Cancel) to a user logging in?
Top
#41729 - 2003-06-18 04:34 PM Re: Request
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
code:
Break on
$msg='You have two choices.'
$rc=MessageBox($msg,'Pick one',1)

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#41730 - 2003-06-18 04:36 PM Re: Request
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Here just an OK button:

$message = "An error occurred while running the logon script. " +
"Forward the text of the 'logon.log' to your support team."
$x =MessageBox($message,"Script Error",4160, 30)


Here is the OK/Cancel:


$message = "An error occurred while running the logon script. " +
"Forward the text of the 'logon.log' to your support team."
$x =MessageBox($message,"Script Error",4161, 30)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#41731 - 2003-06-18 04:41 PM Re: Request
Jochen Administrator Offline
KiX Supporter
*****

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

Sure thing :


break on

$rc = messagebox("Message here","Title",4096+48+1) ; or even 5045:4096=System Modal 48=! 1=OK/Cancel

select
case $rc = 1
"User clicked OK" ?
case $rc = 2
"User clicked Cancel" ?
case 42 ; or "default" or even 1 if you prefer
"User did something unexpected" ?
endselect

get $_ ;pause script


There are also a few undocumented super modal etc. states (IIRC the super modal was 2^16 = 65536)

[ 18. June 2003, 16:42: Message edited by: Jochen ]
_________________________



Top
#41732 - 2003-06-18 04:43 PM Re: Request
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Errg ... beaten by 7 minutes [Embarrassed]

[ 18. June 2003, 16:45: Message edited by: Jochen ]
_________________________



Top
#41733 - 2003-06-18 04:46 PM Re: Request
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
ARG!!! getting one-upped by the masters... [Mad]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#41734 - 2003-06-18 04:53 PM Re: Request
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
I have to wonder, though, why the example in the KiXtart Manual is not sufficient for this. [Confused]
_________________________
There are two types of vessels, submarines and targets.

Top
#41735 - 2003-06-18 06:12 PM Re: Request
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Easier to post?

quote:
When all else fails, read the manual
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#41736 - 2003-06-18 07:18 PM Re: Request
Kixtart_Newbie Offline
Fresh Scripter

Registered: 2003-06-18
Posts: 10
Loc: Florida
Wow! You are all good! I have never received such a response on any forum ever before.

After learning a few different languages from documentation, books, etc., I have learned to only trust those who use the language everyday. I rarely take examples from a book or documentation without first consulting a forum such as this. Although, comparing the KiXtart manual with your responses, I find KiXtart's reference to be better than most. [Smile]

I have one more question though. I have not been able to find the answer in several searches so far. How would I include a line break and a hyperlink within a message box?

Top
#41737 - 2003-06-18 07:37 PM Re: Request
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
You can include a line break by adding the macro @CRLF to your message. Such as...

$msg = "Your machine is broken."+@CRLF+@CRLF+"It will now shutdown."

The hyperlink you can't do in a messagebox. You could create a custom KiXforms form to accomplish this, however.

Top
#41738 - 2003-06-18 07:40 PM Re: Request
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You could also build an HTML page and use COM to launch it. That way you would not have to register the kixforms DLL.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#41739 - 2003-06-18 07:47 PM Re: Request
Kixtart_Newbie Offline
Fresh Scripter

Registered: 2003-06-18
Posts: 10
Loc: Florida
You know, all these Windows programming languages have so much in common. It is just always a bumpy ride for me to learn the other ones though. [Frown]

Why would this throw an error when a user clicks "NO"?
code:
$message = "This is the message body question?"

$title = "This is the title text"

$Selection = MessageBox($message,$title,4096+4+48+256,300)

If $Selection = 7
Run @LDRIVE + "Logoff.exe /n"
EndIf

If $Selection = -1
Run @LDRIVE + "Logoff.exe /n"
EndIf

I get the following error message if the "No" button is clicked:

ERROR : unknown command [END]!
Script: (script path)
Line : 24

Top
#41740 - 2003-06-18 07:57 PM Re: Request
Kixtart_Newbie Offline
Fresh Scripter

Registered: 2003-06-18
Posts: 10
Loc: Florida
Sorry, the line the error is referencing is the final ENDIF.
Top
#41741 - 2003-06-18 07:58 PM Re: Request
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Because there's an error in line 24 of your script. You did not post the complete script. KiXtart has a build-in LOGOFF function, use it! In case of a simple YEs/NO you only need to test for one condition, thus an IF-ELSE-ENDIF is sufficient. Why do you log them off in either case, anyway?
_________________________
There are two types of vessels, submarines and targets.

Top
#41742 - 2003-06-18 08:34 PM Re: Request
Kixtart_Newbie Offline
Fresh Scripter

Registered: 2003-06-18
Posts: 10
Loc: Florida
It is one of those corporate "emergencies" and the higher powers that be are "requesting" that there be a pop-up only allowing users to log in to the network if they agree to the e-mail and internet policy. I am sure you know what I mean.

Thanks for the posts!

Top
#41743 - 2003-06-18 08:52 PM Re: Request
Kixtart_Newbie Offline
Fresh Scripter

Registered: 2003-06-18
Posts: 10
Loc: Florida
All that logoff function did was close a couple windows and disable the active desktop.
code:
logoff(1)


Top
#41744 - 2003-06-18 09:12 PM Re: Request
Kixtart_Newbie Offline
Fresh Scripter

Registered: 2003-06-18
Posts: 10
Loc: Florida
Here is all the script as it is now. What do I need to do to get it to work right? I know this is probably annoying some of you. I am sorry...
code:
$message = "Internet and e-mail policy text" + @CRLF + @CRLF +
"Do you accept the Internet and E-Mail Policy?"

$title = "Window Title"

$Selection = MessageBox($message,$title,4096+4+48+256,300)

If $Selection = 7
Logoff(1)
EndIf

If $Selection = -1
Logoff(1)
EndIf

Also, on Win9x, the Network Sign-On disappears if you click "NO". In order to try logging on again, you are forced to reboot.

Top
#41745 - 2003-06-18 09:24 PM Re: Request
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
code:
$message = "Internet and e-mail policy text" + @CRLF + @CRLF +
"Do you accept the Internet and E-Mail Policy?"
$title = "Window Title"
$Selection = MessageBox($message,$title,4096+4+48+256,300)
If $Selection = 7
; log user off
RC = LogOff(1)
endif



[ 18. June 2003, 22:06: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#41746 - 2003-06-18 10:05 PM Re: Request
Kixtart_Newbie Offline
Fresh Scripter

Registered: 2003-06-18
Posts: 10
Loc: Florida
Argh... Does the Logoff() function just not work in Win9x?

The script still does the same thing. If you click "No", the login script windows simply close. The login dialog box doesn't reappear, and no other errors occur. In order to login after that, you need to reboot the system. We have the necessary DLL's and EXE's mapped in the login script, but I also have them loaded into the Win9x machine as well now but it didn't make any difference.

Does anyone know of any work-arounds or fixes?

Top
#41747 - 2003-06-18 10:08 PM Re: Request
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
It might be a problem with the calling batch file not being closed properly. Always have a EXIT 0 at the end of a batch file in Windows 9x.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 382 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.072 seconds in which 0.025 seconds were spent on a total of 13 queries. Zlib compression enabled.

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