#136717 - 2005-04-11 09:44 PM
Re: Readline Question
|
Josh_R
Getting the hang of it
Registered: 2003-11-25
Posts: 54
|
Ok this works great but they through something at me! When its your bday they want to open a webpage named:
http://servername/emaileditor/happybday.jsp?name=Josh%20Raymer
Inside of the ini file it will be hard coded to look like:
[bsdays] 2005/03/29=joshraymer,Josh%20Raymer
How do I just pull the second part of that line out? I have researched arrays and the split function, but I haven't been able to get it to work correctly. I know the second part of the line will be a variable inside of the HTML page listed above. I just need to know how to browse through the file with several names listed. Thanks for your help guys!
|
|
Top
|
|
|
|
#136719 - 2005-04-11 11:12 PM
Re: Readline Question
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11628
Loc: CA
|
Not fully optimized code but here is an example.
Code:
Break On Dim $SO,$Pause $SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') $SO=SetOption('WrapAtEOL','On')
Dim $BDayFile, $List, $Array1, $Array2, $Item, $x $BDayFile = @ScriptDir +'\' +'bsdays.ini' $List = ReadProfileString ($BDayFile, 'bsdays', @DATE) If $List $Array1 = Split($List,'|') If UBound($Array1)>1 For Each $Item In $Array1 $Array2 = Split($Item,',') ? 'http://servername/emaileditor/happybday.jsp?name=' + $Array2[1] Next Else $Array2 = Split($List,',') ? 'http://servername/emaileditor/happybday.jsp?name=' + $Array2[1] Endif Endif Exit 0
Code:
[bsdays] 2005/04/11=joshraymer,Josh%20Raymer 2005/04/12=joshraymer,Josh%20Raymer|bdsmith,Brian%20Smith|acwilson,Alice%20Wilson
Changing the dates around for testing you should be able to come up with a single entry or with a mutliple entry.
Quote:
http://servername/emaileditor/happybday.jsp?name=Josh%20Raymer http://servername/emaileditor/happybday.jsp?name=Brian%20Smith http://servername/emaileditor/happybday.jsp?name=Alice%20Wilson
Edited by NTDOC (2005-04-11 11:43 PM)
|
|
Top
|
|
|
|
#136720 - 2005-04-12 03:43 PM
Re: Readline Question
|
Josh_R
Getting the hang of it
Registered: 2003-11-25
Posts: 54
|
Ok this works great, BUT I want it to recognize the person's that is running the script's USERID and then open that webpage and end. Basically it is going to say hey look it's Josh Raymer and it's his birthday let's run this script.
|
|
Top
|
|
|
|
#136721 - 2005-04-12 05:27 PM
Re: Readline Question
|
Josh_R
Getting the hang of it
Registered: 2003-11-25
Posts: 54
|
Ok here is where I stand now. I changed the ini file to look like this:
[bsdays] 2005/04/11=joshraymer,Josh%20Raymer 2005/04/12=joshraymer,Josh%20Raymer] 2005/04/12=jasonconder,Jason%20Conder 2005/04/12=acwilson,Alice%20Wilson
The script is now just seeing my name and running the file for me only. It is not going on and checking for USERID and DATE.
|
|
Top
|
|
|
|
#136723 - 2005-04-12 06:01 PM
Re: Readline Question
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
How about you try a different approach, structure your INI like this (with birthday sections):
Code:
[2005/04/12] joshraymer = Josh Raymer stassie = shawn tassie
[2005/09/07] jdoe = john doe
and run some code like this:
Code:
break on
$profile = ".\bsdays.ini"
for each $userid in split(readprofilestring($profile, @DATE, ""), CHR(10))
if $userid
$fullname = readprofilestring($profile, @DATE, $userid)
?"Happy Birthday " + $fullname + " !!!"
endif
next
exit 0
-Shawn
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 837 anonymous users online.
|
|
|