RegWrite Causing Errors? |
Author: |
Message: |
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: RegWrite Causing Errors?
no problem...
PS: do not use "Messenger.MyEmail" to store info in the registry, use "Messenger.MyUserId" instead... security reasons!
PS2: anyways quote: Originally posted by SpunkyLoveMuff
I'm reading a comma seperated list from the registry and reading it into an array and then placing it into a List View box thingy This needs to be done ASAP as the window is opened when the script starts... (it then gets hidden until it's needed)
Why don't you create the window and fill in the listview when it is actually needed for the first time? In that way you don't slow other things down...
Unless you constantly need to add to the listview also... but then again, you also could simply store everything in an array and only create the listview (from that array) when it actually needs to be shown to the user. This will be way faster...not only in loading but in general executing too (as updating a listview takes a lot of processing).
This post was edited on 09-15-2006 at 10:26 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
09-15-2006 10:20 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
O.P. RE: RegWrite Causing Errors?
I should go back and edit the Read/Write functions for that then as I used ones I found on the forums
I did see you mention that in another thread, but totally forgot about editing scripts I've made already...
<Eljay> "Problems encountered: shit blew up"
|
|
09-15-2006 10:22 PM |
|
|
phalanxii
Full Member
Posts: 146 Reputation: 5
32 / /
Joined: Aug 2006
Status: Away
|
RE: RE: RE: RegWrite Causing Errors?
quote: Originally posted by Mattike
4. You have imported the script while you are signed out:
OnEvent_Initialize is called.
MessengerStart is false, so !MessengerStart is true.
The if statement in OnEvent_Initialize is executed.
OnEvent_Signin is called.
Messenger.MyEmail is undefined (you are signed out).
TUUT! Error!
quote: Originally posted by CookieRevised
Open Messenger, before signing in, restart the script. You'll see that with your method (if(!MessengerStart)) your script will end in an error, while mine (if(Messenger.MyStatus > 0)) doesn't.
Yes, true, that theoretically the script is different if !MessengerStart is used, but practically, there is no difference. Why? Because you can only import/restart/enable a script when a) WLM is open and b) you are signed in. Therefore, Cookie's scenarios 2 and 5 (and Mattike's scenario 4) don't exist and there is no error.
Try it for yourself: open WLM (don't sign in) and try to import a script. For me, Messenger Plus! Live sends an error box saying: code: ---------------------------
Messenger Plus! Live
---------------------------
You must be signed in before you can import new scripts.
---------------------------
OK
---------------------------
As for enabling when you are signed out: open WLM (don't sign in) and try to access the MPL preferences. For me, I get this error: code: ---------------------------
Messenger Plus! Live
---------------------------
You must be signed-in to get access to your preferences.
---------------------------
OK
---------------------------
Please tell me if I'm wrong about this, because I'm one of those many people who use that method in their scripts.
|
|
09-15-2006 10:25 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
O.P. RE: RegWrite Causing Errors?
scripts can start before you are signed in from what I've noticed, it doesnt matter if you can't import them when not signed in...
<Eljay> "Problems encountered: shit blew up"
|
|
09-15-2006 10:28 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: RE: RE: RE: RegWrite Causing Errors?
quote: Originally posted by phalanxii
quote: Originally posted by CookieRevised
Open Messenger, before signing in, restart the script. You'll see that with your method (if(!MessengerStart)) your script will end in an error, while mine (if(Messenger.MyStatus > 0)) doesn't.
Yes, true, that theoretically the script is different if !MessengerStart is used, but practically, there is no difference. Why? Because you can only import/restart/enable a script when a) WLM is open and b) you are signed in. Therefore, Cookie's scenarios 2 and 5 (and Mattike's scenario 4) don't exist and there is no error.
(...)
Please tell me if I'm wrong about this, because I'm one of those many people who use that method in their scripts.
You're wrong ... They do exist in practice too... As I said, open messenger, sign in, sign back out and you can restart any script you want!
If it was like you said, then a script wouldn't continue to function either after the OnEvent_SignOut event... Or couldn't detect OnEvent Initialize(true) when Messenger is first started (as you aren't signed in yet), etc...
Forget about importing scripts, that doesn't matter as that is only a subset of cases which are possible (in particular you can only import a script when you are in case 3 in my list, and when the script is imported, case 4 will happen).
This post was edited on 09-15-2006 at 10:35 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
09-15-2006 10:29 PM |
|
|
phalanxii
Full Member
Posts: 146 Reputation: 5
32 / /
Joined: Aug 2006
Status: Away
|
RE: RegWrite Causing Errors?
Oh crap, that's devious...
I just figured it out:
1. Sign in.
2. Open your preferences.
3. Sign out.
4. Change your script preferences...
Is that a bug or what? I guess I'll need to fix all my scripts! (Sorry everybody, you were all right! )
EDIT: And what I meant by "you can only import/restart/enable a script when a) WLM is open and b) you are signed in" was that the script can only be MANUALLY started when you are signed in. The script automatically starts when WLM opens if it has already been manually enabled (by import/restart/enable) and continues to run until WLM closes (unless it is disabled). The thing that caught me was that I thought scripts could not be manually started when signed out...
This post was edited on 09-15-2006 at 10:37 PM by phalanxii.
|
|
09-15-2006 10:33 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
O.P. RE: RegWrite Causing Errors?
quote: Originally posted by CookieRevised
Why don't you create the window and fill in the listview when it is actually needed for the first time? In that way you don't slow other things down...
Unless you constantly need to add to the listview also... but then again, you also could simply store everything in an array and only create the listview (from that array) when it actually needs to be shown to the user. This will be way faster...not only in loading but in general executing too (as updating a listview takes a lot of processing).
Basically whats happening is, the array is loaded in the list box and then, when a certain function is called, a loop searches to see if a variable is equal to the current value in the 1st column... if it is, the variable is replaced by the current value in the second column and passed back...
it's basically replacing email addresses with a user defined nickname so that my script can show who the user is talking to, without giving away they're email address...
As the function that performs this is called quite frequently, it's not a very good idea to read from the registry at that point. So it's easier to read the registry at startup and then it updates as it goes along...
<Eljay> "Problems encountered: shit blew up"
|
|
09-15-2006 10:34 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: RegWrite Causing Errors?
quote: Originally posted by SpunkyLoveMuff
quote: Originally posted by CookieRevised
Why don't you create the window and fill in the listview when it is actually needed for the first time? In that way you don't slow other things down...
Unless you constantly need to add to the listview also... but then again, you also could simply store everything in an array and only create the listview (from that array) when it actually needs to be shown to the user. This will be way faster...not only in loading but in general executing too (as updating a listview takes a lot of processing).
Basically whats happening is, the array is loaded in the list box and then, when a certain function is called, a loop searches to see if a variable is equal to the current value in the 1st column... if it is, the variable is replaced by the current value in the second column and passed back...
it's basically replacing email addresses with a user defined nickname so that my script can show who the user is talking to, without giving away they're email address...
As the function that performs this is called quite frequently, it's not a very good idea to read from the registry at that point. So it's easier to read the registry at startup and then it updates as it goes along...
It is even a worse idea to use a listview for that. Reading from the registry would actually be faster than updating a listview....
A way faster method is reading the stuff you need from the registry, and from that point on using an array (or a multiple of arrays) to do what you need to do. Forget about the listview totally as that is not needed (except for maybe showing the user something; but certainly not for the updating/computing/replacing/etc)...
Reading from the registry is 1 api call, updating a listview is a multitude of api-calls from memory calculations to graphic updates and rendering and what not.
This post was edited on 09-15-2006 at 10:40 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
09-15-2006 10:37 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
O.P. RE: RegWrite Causing Errors?
The list view does serve a purpose and is not just there for my benefit... It allows the user to see the nicknames they've entered as well as remove entries and hopefully, soon I'll be able to put a "modify" button as well.
One thing that does concern me is about a character limit in the registry value... Will I need to eventually just switch to a text file?
<Eljay> "Problems encountered: shit blew up"
|
|
09-15-2006 10:40 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: RegWrite Causing Errors?
quote: Originally posted by SpunkyLoveMuff
The list view does serve a purpose and is not just there for my benefit... It allows the user to see the nicknames they've entered as well as remove entries and hopefully, soon I'll be able to put a "modify" button as well.
yep, but 'updating' the listview should be done only when the user asks for it, aka: when he opens the window which contains that listview and want to see the listview.
When he closes the window again, your internal arrays should update with the info taken from the listview and the script should continue to use those arrays until the next time the user opens the window. Only then you update the listview again, etc...
And when the user signs out, that's the time to write back all the stuff to the registry...
All the updates you do in the background while the window is hidden aren't needed and will slow things majorly down.
quote: Originally posted by SpunkyLoveMuff
One thing that does concern me is about a character limit in the registry value... Will I need to eventually just switch to a text file?
no worries I'd say... The character limit of a REG_SZ registry value is way bigger than what you'll ever need for a nickname or something though.
This post was edited on 09-15-2006 at 10:56 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
09-15-2006 10:43 PM |
|
|
Pages: (3):
« First
«
1
[ 2 ]
3
»
Last »
|
|