Page 1 of 1

Text

Posted: Fri Jul 25, 2008 6:42 pm
by dannyboy99
I have a text input, but I only want to have text (not numbers) entered.

Is there a way of telling betwwen the two please.

Posted: Fri Jul 25, 2008 7:13 pm
by Rook Zimbabwe
OK ugly code... but it should work... not at my compiler for an hour...

Code: Select all

temp$ = INPUT$
ROFL = len(temp$)
OK = 0

for X = 0 to ROFL
   lookat = Asc(Mid(temp$,rofl,1))
        if lookat > 65
            OK = 1
        endif
next

if OK = 1
   ; input good!
else
    ; BAD INPUT
endif
:D

Posted: Sat Jul 26, 2008 3:36 am
by pdwyer
Any numbers at all or just a number instead of text?

Is "I'm 10 years old" a no no? There may be a shortcut with val()

Rooks code will be heaps faster with pointers :P whenever I see Asc(Mid()) alarms go off in my head :D

I vaguely recall that there is some subclassing method to apply filters or something too but I suck at that so I can't post any code :?

Posted: Sat Jul 26, 2008 4:53 am
by Rook Zimbabwe
I absolutely cannot do pointers in my head... need working compiler to test my insanity! :wink:

Posted: Sat Jul 26, 2008 5:27 am
by pdwyer
I can relate to that, I certainly wouldn't post pointer code without testing..

you win :P

Posted: Sat Jul 26, 2008 8:52 am
by Derek
You are assuming of course that he want's an input checked after it has been input, what he might be asking for is stopping numbers being input into a stringgadget() on the fly.

Maybe we need some more info before we start coding up examples.

Thanks

Posted: Sun Jul 27, 2008 4:01 pm
by dannyboy99
Thanks for your work on this one

As the last poster says, I was using several textgadget to input data, but of only 4 numbers. and one box could only contain text.

While I am here, does anyone know how to use setfiledate

I have a load of files that I wanted to alter the creation dates so my mp3 player will play them in the order I want - its for amateur drama.

does anyone have an example of how to do this.


Thanks

Re: Thanks

Posted: Sun Jul 27, 2008 4:30 pm
by Demivec
dannyboy99 wrote:Thanks for your work on this one

As the last poster says, I was using several textgadget to input data, but of only 4 numbers. and one box could only contain text.

While I am here, does anyone know how to use setfiledate

I have a load of files that I wanted to alter the creation dates so my mp3 player will play them in the order I want - its for amateur drama.

does anyone have an example of how to do this.


Thanks
Here's an example that loops through files listed in an array and sets the date by adding sequential day values to an arbitrary start date:

Code: Select all

startDate.l = ParseDate("%yy/%mm/%dd", "02/12/01") ;pick your start date

numberOfSongs.l = 30 
For sequenceNumber = 1 to numberOfSongs
  songFile.s = songFilenameArray.s(sequenceNumber) ;a sample entry in the songFilenameArray would look like "C:\Song.mp3"
  SetFileDate(songFile, #PB_Date_Created ,AddDate(startDate, #PB_Date_Day, sequenceNumber.l))
Next 

Problem

Posted: Sun Jul 27, 2008 7:42 pm
by dannyboy99
I tried this, but I get an error message saying

song.s() is not a function (or not available in demo mode)

And should songs.s be the directory where all the sound effects are stored.

Knowing me, I have done something wrong, but I an not sure what.

Thanks

Dan

Re: Problem

Posted: Mon Jul 28, 2008 12:18 am
by Demivec
dannyboy99 wrote:I tried this, but I get an error message saying

song.s() is not a function (or not available in demo mode)

And should songs.s be the directory where all the sound effects are stored.

Knowing me, I have done something wrong, but I an not sure what.

Thanks

Dan
I didn't supply a complete code example, I had thought that you only lacked an understandng on the use of SetFileDate(). You can add this on to the beginning of the code sample I gave previously. You'll still need to tailor the code with information regarding your songs.

Code: Select all

#numberOfSongs = 30

DataSection
songList:
  Data.s "C:\Song.mp3","C:\Song2.mp3" ;add each song, 30 total
EndDataSection

Dim songFilenameArray.s(#numberOfSongs)

Restore songList
For i.l = 1 To #numberOfSongs
  Read songFilenameArray(i)
Next

Thanks

Posted: Thu Aug 21, 2008 6:58 pm
by dannyboy99
Thanks very much for those who helped me here especially Demivec

I have finsihed the programs, which seem to working well.

Thanks again

Danny

ps One thing I found was that i could alter the dates of the files, great, but when i copied them it used todays date as creation date.

Is this something the PB does