Alert(MsgBox in VB) Help? |
Author: |
Message: |
Hit
New Member
Posts: 10
Joined: Aug 2006
|
O.P. RE: Alert(MsgBox in VB) Help?
k
You may know an option it holds data so
If( Message == "!Sure Off"){
savedata("off")}
If(getdata("off")){
}
You know some option?
|
|
08-21-2006 07:06 PM |
|
|
KnRd_WC
Junior Member
Florian PAQUET
Posts: 74 Reputation: 1
35 / /
Joined: Aug 2006
|
RE: Alert(MsgBox in VB) Help?
quote: Originally posted by Hit
k
You may know an option it holds data so
If( Message == "!Sure Off"){
savedata("off")}
If(getdata("off")){
}
You know some option?
I would like to help you but I don't understand what you say...
Store data into a variable ?? Save data (on registry, for example...) ??
This post was edited on 08-21-2006 at 08:08 PM by KnRd_WC.
|
|
08-21-2006 08:08 PM |
|
|
Hit
New Member
Posts: 10
Joined: Aug 2006
|
O.P. RE: Alert(MsgBox in VB) Help?
I just want to place data some where
|
|
08-21-2006 08:15 PM |
|
|
KnRd_WC
Junior Member
Florian PAQUET
Posts: 74 Reputation: 1
35 / /
Joined: Aug 2006
|
RE: Alert(MsgBox in VB) Help?
Somewhere.... hummm....
code: // On a variable
Variable = "off"
code: // On registry
shell=new ActiveXObject("WScript.Shell");
// Store the value
shell.RegWrite(MsgPlus.ScriptRegPath+Messenger.MyUserId+'\\Off',"1");
// Key : HKEY_CURRENT_USER\Software\Patchou\Messenger Plus! Live\GlobalSettings\Scripts\<Script Name>\Settings\<UserID>\
// Name : Off
// Get the value
try {value=shell.RegRead(MsgPlus.ScriptRegPath+Messenger.MyUserId+'\\Off');}
catch(err) {value="0";} // If the key does not exist, value="0"
MsgPlus.DisplayToast("",value); // Verification
This post was edited on 08-21-2006 at 08:37 PM by KnRd_WC.
|
|
08-21-2006 08:20 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: RE: Alert(MsgBox in VB) Help?
quote: Originally posted by Mattike
quote: Originally posted by Hit
thx i finaly done my sure to send project
If i do return;
It still sends if i do return ""; message is gone it most stay there
Hmm, strange. I saw scripts just sending nothing with the return... But if that wouldn't work, I suggested you to use return "" anyway.
returning nothing and returning nothing are two different things ( )...
If a script wants to change the send text it should do:
return "change text";
If a script wants to send 'nothing' (mind the quotes; as you do send something: an empty string, that's not nothing). In other words cancel what has been send:
return "";
If a script wants to do nothing. Thus not cancelling the message, nor changing it:
return;
(and as such this can be left out in the function too, as a function will return anyways if it ends)
It always has been like this and every script does it like this...
This post was edited on 08-22-2006 at 08:02 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
08-22-2006 08:00 AM |
|
|
KnRd_WC
Junior Member
Florian PAQUET
Posts: 74 Reputation: 1
35 / /
Joined: Aug 2006
|
RE: Alert(MsgBox in VB) Help?
Hi Hit,
I tested your script, and I have a suggestion :
Your script :
code: function OnEvent_ChatWndSendMessage(ChatWnd,Message) {
var Val=Interop.Call("User32.dll", "MessageBoxW", 0,"Are you sure, you want to send:" + Message,"Sure?", 4|32);
if (Val==6) { // Yes
// ....
}
else if (Val==7) { // No
return "";
}
}
With your script, when the MsgBox appears, she's not linked to the chat window (I hope that's comprehensible...) So, the chat window is still enable.
You should use that :
code: function OnEvent_ChatWndSendMessage(ChatWnd,Message) {
var Val=Interop.Call("User32.dll", "MessageBoxW", ChatWnd.Handle,"Are you sure, you want to send:" + Message,"Sure?", 4|32);
if (Val==6) { // Yes
return; // Not compulsory, but for the understanding
}
else if (Val==7) { // No
return "";
}
}
This post was edited on 08-22-2006 at 10:05 AM by KnRd_WC.
|
|
08-22-2006 10:01 AM |
|
|
RaceProUK
Elite Member
Posts: 6073 Reputation: 57
39 / /
Joined: Oct 2003
|
RE: Alert(MsgBox in VB) Help?
* RaceProUK coughs
var result = confirm("Ask your question here");
* RaceProUK coughs
Edit: Hmm, seems I was looking at an HTML resource. Damn.
Edit 2: Since MsgBox is defined in VBScript, is there a way to get JScript to use it?
This post was edited on 08-22-2006 at 10:28 AM by RaceProUK.
|
|
08-22-2006 10:24 AM |
|
|
-dt-
Scripting Contest Winner
;o
Posts: 1819 Reputation: 74
36 / /
Joined: Mar 2004
|
RE: Alert(MsgBox in VB) Help?
quote: Originally posted by RaceProUK
* RaceProUK coughs
var result = confirm("Ask your question here");
* RaceProUK coughs
* -dt- coughs
Error: 'confirm' is undefined.
Line: 28. Code: -2146823279
* -dt- coughs
This post was edited on 08-22-2006 at 10:27 AM by -dt-.
Happy Birthday, WDZ
|
|
08-22-2006 10:26 AM |
|
|
Hit
New Member
Posts: 10
Joined: Aug 2006
|
O.P. RE: RE: RE: Alert(MsgBox in VB) Help?
quote: Originally posted by CookieRevised
quote: Originally posted by Mattike
quote: Originally posted by Hit
thx i finaly done my sure to send project
If i do return;
It still sends if i do return ""; message is gone it most stay there
Hmm, strange. I saw scripts just sending nothing with the return... But if that wouldn't work, I suggested you to use return "" anyway.
returning nothing and returning nothing are two different things ()...
If a script wants to change the send text it should do:
return "change text";
If a script wants to send 'nothing' (mind the quotes; as you do send something: an empty string, that's not nothing). In other words cancel what has been send:
return "";
If a script wants to do nothing. Thus not cancelling the message, nor changing it:
return;
(and as such this can be left out in the function too, as a function will return anyways if it ends)
It always has been like this and every script does it like this...
You'r right this is better ill update immidiatly
You can download new version @ the scriptDB now
Its same link
This post was edited on 08-22-2006 at 11:26 AM by Hit.
|
|
08-22-2006 11:21 AM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: Alert(MsgBox in VB) Help?
With all due respect (so don't get me wrong), but I'm not certain if such scripts should be accepted in the database.
Reason: poorly written. So why not including it:
1) People who know how to script will also know how to do this simple function for themselfs.
2) People who do not know how to script (and want to learn scripting by looking at such simple scripts) will not learn proper formatting their scripts or why something is done, etc...
code: function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
var Val=Interop.Call("User32.dll", "MessageBoxW", 0,"Are you sure, you want to send:" + Message,"Sure?", 4|32);
if (Val==6) { // Yes
// ....
}
else if (Val==7) { // No
return "";
}
}
Instead of submitting something like the above, submit something like: code: function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
If (Interop.Call("User32.dll", "MessageBoxW", ChatWnd.Handle, "Are you sure you want to send:\n" + Message, "Confirm", 36) === 7) return "";
}
Look at the above 1-line script and understand why this can be on one simple line. If you knew this you would have done something like this already and submitted that. If not, this proofs my point that scripts written like yours shouldn't be accepted as they don't teach much (if not teaching bad habits and what not).
---
Or, if you want to submit such a script and teach/help out other people who might want to learn something: code: function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
// Define constants to make up the message box
var MB_ICONQUESTION = 32;
var MB_YESNO = 4;
// Define constants which can be returned
var IDYES = 6;
var IDNO = 7;
// Show confirmation box
// Note: We attached the chat window handle (ChatWnd.Handle) to make this message box a child of the chat window.
// In that way, you can't use the chat window any further until the message box is answered.
// Note: We define a YES/NO message box (MB_YESNO) and show a question icon (MB_ICONQUESTION) by binary adding the constants with the OR function.
var Result = Interop.Call("User32.dll", "MessageBoxW", ChatWnd.Handle, "Are you sure you want to send:\n" + Message, "Confirm", MB_YESNO | MB_ICONQUESTION);
// Check the returned result
switch(Result) {
// User pressed 'yes', so simply return without doing anything
case IDYES: return;
// User pressed 'no', so return the new message being an empty string; nothing will be send
case IDNO: return "";
}
}
// More info in the MSDN Library:
//http://search.msdn.microsoft.com/search/Redirect.aspx?title=MessageBox+Function&url=http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/messagebox.asp
---
So, I hope you don't take anything of this post offensive. It is just that I sometimes question the stuff in the database (yours was just an example). Although I have no doubt what-so-ever about the good intentions of the creators, the quality is important too.
This post was edited on 08-22-2006 at 04:03 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
08-22-2006 04:01 PM |
|
|
Pages: (2):
« First
«
1
[ 2 ]
Last »
|
|