Page 1 of 2 12>
Topic Options
#136697 - 2005-03-29 08:07 PM Readline Question
Josh_R Offline
Getting the hang of it

Registered: 2003-11-25
Posts: 54
The marketing dept has come up with this great idea (sarcastic font) that they want something to pop up telling the reps "Happy Birthday". I am trying to figure out some way to say something like If @userid = one of the names in a text file then run the birtday.exe. I know this is vague, but I am slow (it is actually warm here so I am in a work slow down). I have also spent all morning looking through the site to find something to do this. Thank you all for your help
Top
#136698 - 2005-03-29 08:11 PM Re: Readline Question
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Try doing a search on birthday here on the board and I'm sure you'll come up with some code examples to do it. If not let us know and we can provide it again.
Top
#136699 - 2005-03-29 08:15 PM Re: Readline Question
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I think ini might even be better for this task.
say, each day has it's names:
[bsdays]
2/12/2005=john,ken,larissa,booboo,

and then you could just fire it with:
Code:

$todays=readprofilestring(@scriptdir+"\specialday.ini","bsdays",@date)
if instr($todays,@userid+",")
"hello babe"
endif

_________________________
!

download KiXnet

Top
#136700 - 2005-03-29 08:20 PM Re: Readline Question
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
nice !
Top
#136701 - 2005-03-29 08:26 PM Re: Readline Question
Josh_R Offline
Getting the hang of it

Registered: 2003-11-25
Posts: 54
What does the format of the INI need to be?

I put that code in and it doesn't do anything.

Top
#136702 - 2005-03-29 08:29 PM Re: Readline Question
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ini has header key and value.

[header1]
key1=valueofit
key2=valueOfThat
[header2]
key1=here_we_have_something too
key2= and here.


basically, keynames are unique inside a section.
and sections need to have unique names.

but as showed above, you only need the one section and just add the keys for each day needed.
_________________________
!

download KiXnet

Top
#136703 - 2005-03-29 08:32 PM Re: Readline Question
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and what the ini should look like...
well, lookie above in the post where I explain it.
_________________________
!

download KiXnet

Top
#136704 - 2005-03-29 08:33 PM Re: Readline Question
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
And make sure you name the file specialday.ini and put it in the same folder as your script.
Top
#136705 - 2005-03-29 08:34 PM Re: Readline Question
Josh_R Offline
Getting the hang of it

Registered: 2003-11-25
Posts: 54
Ok here is my ini:

[bsdays]
2/12/2005=joshraymer

Here is my code:

$todays=ReadProfileString(@scriptdir+"\specialday.ini","bsdays",@date)
If InStr($todays,@userid+",")
"hello babe"
EndIf

Nothing happens

Top
#136706 - 2005-03-29 08:38 PM Re: Readline Question
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
You saying nobody is having a birthday today ?
Top
#136707 - 2005-03-29 08:38 PM Re: Readline Question
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
2/12/2005 denotes in my example the date. birtday.
that is, it will happen only on that date. right?
as in the readprofilestring line we have set it to fire for @date.

if you want to test it, just put today in there.
_________________________
!

download KiXnet

Top
#136708 - 2005-03-29 08:39 PM Re: Readline Question
Josh_R Offline
Getting the hang of it

Registered: 2003-11-25
Posts: 54
Correct that is why I changed my ini to reflect todays date. Shouldn't I see a pop up on my screen or something if this is working?
Top
#136709 - 2005-03-29 08:55 PM Re: Readline Question
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
The DATE format of the .INI is incorrect.

Change it to 2005/03/29

Top
#136710 - 2005-03-29 09:04 PM Re: Readline Question
Josh_R Offline
Getting the hang of it

Registered: 2003-11-25
Posts: 54
Yeah I tried that too.
Top
#136711 - 2005-03-29 09:06 PM Re: Readline Question
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
1) What do you get when you display the date, like this:

? "DATE=" @DATE

2) This script doesn't popup a messagebox, it just displays a message to the DOS console window.

-Shawn

Top
#136712 - 2005-03-29 09:26 PM Re: Readline Question
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hey, one thing.
in my code there is instr and it checks for userID+","
that means that after each user name there must be comma.
why? so usernames that are partial matches can't happen.
like, without the comma check, user "mama" and "mamamia" would get mixed up.

add the comma to your value and report back.
_________________________
!

download KiXnet

Top
#136713 - 2005-03-29 09:47 PM Re: Readline Question
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Doh! yeah I saw that too about the comma put forgot to say anything.

Well, trying to cover all bases... maybe add

GET $Pause to the end of the script if he is using WKIX32 and it is flying by to quick for him to see.

Top
#136714 - 2005-03-29 09:48 PM Re: Readline Question
Josh_R Offline
Getting the hang of it

Registered: 2003-11-25
Posts: 54
I am slow. We had some guy quit so I was logged in as him doing some testing against his account. So I had my name in the ini file but was logged in as his name!!!! Thanks for the help and PLEASE don't hold this against me in future postings!
Top
#136715 - 2005-03-29 09:55 PM Re: Readline Question
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
cool.
so you running it now?
if you go ahead and indeed do something more complex or go to production with it... could you post your results?
like, it's partly our baby or at least relative or something now
_________________________
!

download KiXnet

Top
#136716 - 2005-03-29 10:37 PM Re: Readline Question
Josh_R Offline
Getting the hang of it

Registered: 2003-11-25
Posts: 54
Yeah as soon it gets finalized I'll put it out here. Thanks again!
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
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.169 seconds in which 0.121 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