Page 1 of 1 1
Topic Options
#125839 - 2004-08-30 11:13 AM code for playing wav file continuously while not keyboard hit
adio Offline
Fresh Scripter
*

Registered: 2004-08-25
Posts: 28
hi, please help me build a code that plays wav file continuously while not keyboard hit and that wav file plays only if it is a users birthday.. thanks a lot. please post for reply...
Top
#125840 - 2004-08-30 11:30 AM Re: code for playing wav file continuously while not keyboard hit
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Ok, first question would be where have you stored the birthdays of your users?

If you haven't yet I'd suggest the following format...

bdays.ini

Quote:


[username1]
BDay=YYYY/MM/DD
[username2]
BDay=YYYY/MM/DD

etc...




You can then easily read/compare the birthday for the current user in your logon script
_________________________



Top
#125841 - 2004-08-30 11:35 AM Re: code for playing wav file continuously while not keyboard hit
adio Offline
Fresh Scripter
*

Registered: 2004-08-25
Posts: 28
I PUT THE USERS BDAY AT DESCRIPTION, WOULD THAT BE OKAY?
AN HERES MY SCRIPT, PLEASE CHECK THE ERROR, THANKS

if @description = ($a=RIGHT(@DATE,5))
while NOT get$x
play file "happybday.wav"
loop
end if

EXIT 1

Top
#125842 - 2004-08-30 11:46 AM Re: code for playing wav file continuously while not keyboard hit
Jochen Administrator Offline
KiX Supporter
*****

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

that'd be @comment for description ...

Please give me an example of the contents of one of your users description field

thanx
_________________________



Top
#125843 - 2004-08-30 11:49 AM Re: code for playing wav file continuously while not keyboard hit
adio Offline
Fresh Scripter
*

Registered: 2004-08-25
Posts: 28
Here's the content of my description field, 1979/02/08
Top
#125844 - 2004-08-30 12:15 PM Re: code for playing wav file continuously while not keyboard hit
Jochen Administrator Offline
KiX Supporter
*****

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

this should work then (kind of!)

Code:
if right(@date,5) = right(@comment,5)
flushkb
while not kbhit()
play "happybday.wav"
loop
endif



Caution:

It will either finish playing the file after keyboard was hit (assuming that play waits for the file to be played) or it will start bazillions of instances of the wav file (assuming play command doesn't wait for execution)

I am too afraid to test this for ya, so please handle with care

[Maybe a sleep 5 somewhere in the loop is a good idea]
_________________________



Top
#125845 - 2004-08-30 12:28 PM Re: code for playing wav file continuously while not keyboard hit
adio Offline
Fresh Scripter
*

Registered: 2004-08-25
Posts: 28
ok, thanks for the help. by the way, sleep5 will last for how many seconds? and is my script in correct syntax?
Top
#125846 - 2004-08-30 01:07 PM Re: code for playing wav file continuously while not keyboard hit
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
5 seconds

not quite:
- end if shall be endif
- while NOT get$x would hold script execution until a key was hit
- if @description = ($a=RIGHT(@DATE,5)) @description is in fact @comment and the assignment of right to a variable is not neccessary
_________________________



Top
#125847 - 2004-08-30 07:14 PM Re: code for playing wav file continuously while not keyboard hit
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
You don't list where you're from, but as an FYI listing users birthdays in a comment field where others can easily see it might be treading into illegal boundaries in the U.S.

Might want to check/confirm with your legal department that you're not getting yourself into any trouble.

Top
Page 1 of 1 1


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

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.064 seconds in which 0.031 seconds were spent on a total of 12 queries. Zlib compression enabled.

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