PDA

View Full Version : AMS 4 Documentation, lack of examples



Ray_Collins
08-16-2002, 11:29 PM
Hi,

I have just upgraded from version 3 to 4 and the new version has so much good stuff in it. The problem is I know the product can do what I want to do but I can't work out how.

There are few if any examples in the user guide/help file and not much stuff in the templates.

For example, becuase I use Visual Basic constantly I want to do lots of stuff in the macro language but I can't find a simple reference in the documenation on how to get at objects.

I want to read some text files then populate some list boxes that are in my project. Can I get at %SrcDrv% so I know were to look for my files ? Once I parse my text files can I refence the list boxes in my project to add items to them ?

Lorne
08-19-2002, 10:10 AM
Don't worry, we're still working on the documentation. In fact, a whole bunch of action examples should be going into the help file in the next few weeks.

As for the macro language, do you mean the built-in VBA macro support for the design environment? If so, there is a COM reference document in the AutoPlay Media Studio\Docs folder:

C:\Program Files\AutoPlay Media Studio 4.0\Docs\COM Automation Reference.doc

Or do you mean the actions that you can use on the Actions tabs, like "File - Execute" and such? (Like I mentioned above, we're still working to get more examples of action scripts into the help file.)

Sorry if I seem a bit confused; we don't call the action stuff "macros," and there is support for VBA macros in the design environment, but it's something else. /ubbthreads/images/icons/laugh.gif

Ray_Collins
08-19-2002, 04:55 PM
Hi Lorne,

Thanks for the reply, I meant using SaxBasic.
And just a little rant, like all great products it ain't a lot of use if you can't work out how to use the thing. I have seen very few companies that spent enough time on the help, examples and guides, they always seem to be just an after thought that gets minimal resources in the development life cycle.

And I do worry becuase I thought I purchased a completed product, this is not the Beta we are talking about :-(

Lorne
08-19-2002, 05:07 PM
I understand how you feel. The COM automation documentation could definitely use some work; I don't know when it's going to be updated, though. The sad fact is that the COM automation is a bit of a "fringe" feature in AMS 4.0...it's mainly there for people who would already know how to use it, hence the relatively slim documentation.

That said, if you have any questions, feel free to post them.

Derek
08-19-2002, 05:16 PM
That said, if you have any questions, feel free to post them

... um .. as posted already Lorne, how do yu use SAX? /ubbthreads/images/icons/smile.gif

I guess the question, really, is .. if i write code in SAX, how do i then tell 'an object'

"Right, now go use that bit of code"

A short example will work

unknown user
08-19-2002, 05:34 PM
Tenor or alto?

Derek
08-19-2002, 05:44 PM
lol ... I think i prefer Tenor .. easier to listen to

unknown user
08-19-2002, 06:37 PM
I believe then the Dexter Gordon module will do what you're looking for. /ubbthreads/images/icons/smile.gif

Ray_Collins
08-20-2002, 04:37 AM
I thought I did ask a question. But now I will ask some more and provide some background.

Are you saying that SaxBasic only works for the development environment ?

What I am trying to do:-
The cd will have a bunch of files on it each month that consists of text files that have specifically formatted information (I have no control over the format) and a corresponding set of mpeg files. I want to write the autoplay program once so that it can be included each month on the CD without change.

The program needs to read all the text files on the disk then display some information from them in a list box (listbox1), there will be a different number each month and they will have different names (but the extension is always the same).

When the user clicks on an entry in listbox1 it needs to open the corresponding file and get more information from that file and display it in another list box (listbox2).

When the user clicks on a button the mpeg corresponding to an item in listbox1 will be displayed. If the user selects a different item in listbox1 then the cycle is repeated.

We currently have a Visual Basic program that does this but it needs runtimes and stuff. If we do it with autoplay we know it will "just work" directly from the CD. The assumption is that we can take our VB Code and paste it into SAX Basic and with a some alterations we could get the new app working.

Was this a bad assumption ?
I don't mind rebuilding the whole thing in autoplay but the doco sucks. I know I can do this but some working examples would be so so helpful.

Lorne
08-20-2002, 10:11 AM
Are you saying that SaxBasic only works for the development environment ?



Yes. Including SaxBasic support at run time would increase the size of the executable and I believe it would make it impossible for the executable to run without an install (there are TONS of Registry changes needed to register the GUIDs for all the components).




What I am trying to do:-
The cd will have a bunch of files on it each month that consists of text files that have specifically formatted information (I have no control over the format) and a corresponding set of mpeg files. I want to write the autoplay program once so that it can be included each month on the CD without change.

The program needs to read all the text files on the disk then display some information from them in a list box (listbox1), there will be a different number each month and they will have different names (but the extension is always the same).

When the user clicks on an entry in listbox1 it needs to open the corresponding file and get more information from that file and display it in another list box (listbox2).

When the user clicks on a button the mpeg corresponding to an item in listbox1 will be displayed. If the user selects a different item in listbox1 then the cycle is repeated.




You're in luck! This should all be do-able with AutoPlay's actions. /ubbthreads/images/icons/laugh.gif




We currently have a Visual Basic program that does this but it needs runtimes and stuff. If we do it with autoplay we know it will "just work" directly from the CD. The assumption is that we can take our VB Code and paste it into SAX Basic and with a some alterations we could get the new app working.

Was this a bad assumption ?




Nope, just an incorrect one. The COM automation only applies to the design environment.

Your VB code would probably work if you copied and pasted it (it might need a little tweaking, since SaxBasic isn't 100% compatible with VBA...there are some exotic features that aren't supported). But this would only be at design time...it would have no effect on the autorun.exe at all.




I don't mind rebuilding the whole thing in autoplay but the doco sucks. I know I can do this but some working examples would be so so helpful.




Well, the actions to do this would be pretty straightforward. If you're familiar with VB code, you should find AutoPlay to be a piece of cake. It's much, much simpler.

Have you read chapters 8-10 in the User's Guide?

To do this project, you'll need a bunch of File Actions, String Actions, and Control Structures. You'll need a List Box Object and a Media Player Object. You could use an Image Object for the button...and use a Text Box Object to display the text from the second text file when the user selects an item.

How hard it is all depends on the format of those text files. Heck, if you describe the format (or paste a sample) I could probably whip up a quick example for you in a few minutes.

Ray_Collins
08-20-2002, 05:22 PM
Yes I read the user guide, that's why I know this can be done. I just can't work out how. I have all the GUI stuff done I am just stuck on

1. How to populate the list box when the app starts i.e how to return the list of files that are on the CD.

2. How to parse each file and return information to the list boxes.

The part contents of a file is listed below. The Raceday Code is displayed in a label. The meeting location and date is displayed in listbox1 ie ALBURY 17/03/02

The horses for each race are displayed in listbox2 when you select a meeting from listbox1 and click a button(s) to show the race number. In the VB app there is an up and down button that rolls thru the available race numbers.

The file always has the racecode as the first line and always ends with a CR. There are obviously different numbers of races for each meeting and the race numbers are not always sequential.

Thanks for your interest and advise.


Raceday Code:ALR17032

ALBURY 17/03/02

RACE 1 1175
==================
ARMAGUN
GEMAZZI
MISS AUDACITY
MY CHANTICLEER
REDSOCKS

RACE 2 1000
==================
BONNIE PRINCE
DISRUPTED
FOR GRANTED
GREENHOUSE EXPRESS
MIGHTY AMBER
MY BIGSTONE
NOBLE CHEYENNE

RACE 3 1000
==================
CHANOUR
EL VIXEN
ESCALADE
FINAL FORWARD
IMPOSING TOD
LADY FARMER
RAFFIN FAIR
RAIN GIFT
SUNDAY DRIVE
TALEANNI SPORTS
TARCOOLA STAR

Lorne
08-22-2002, 10:46 AM
Okay, this is pretty straightforward. To find out what files are on the CD, you need to use a "File - Search" action. Assuming these are all .txt files in a specific folder, it's a piece of cake. Just set *.txt as the filename you want to search for, disable the "Local fixed drives (hard drives)" option, select the "Specific folders/drives" option, and put %SrcDir%\foldername in the "Custom folders" path. (Replace "foldername" with the name of the folder that the text files are stored in on the CD.)

That will get you a variable called %Files% containing a double-semicolon delimited list list of all the text files in that folder.

There are a lot of different ways you can proceed from there. You could set up a WHILE loop to get each file path (using "String - Get Delimited String"), read the file's contents into a variable ("Text File - Read"), and then store all the different bits of information into a bunch of global lists; one for the filenames, one for the raceday codes, one that you would use to hold the list of horses for each race (clearing the list and rebuilding it each time a race was selected). You could use separate lists, or you could store lots of bits of information together in a Global List item by separating the information with some kind of delimiter (i.e. storing delimited lists in the Global List instead of single items).

Or, you could process the files "live" as the user selects the items. Or some combination of the two.

I'm not sure if you want to display the filenames in a list box, or just the raceday codes from the files. If you want to list the filenames, that's really easy to do by using a "List Box Object - Add Files" action, to add the delimited list of files in the %Files% variable to the list.

Then just add some actions to the On Selection Changed event for listbox1 to read in the text file ("Text File - Read") and search grab the first line ("Text File - Get Line"), grab the text after the "Raceday Code:" part ("String - Mid").

Then you need to grab the next line with text on it and store it as the race code in a variable. If the race code is ALWAYS on the third line in the text file, you can just use a simple "Text File - Get Line" action to grab it...otherwise, you'll need to do a short while loop to get the next line and test whether it's blank, stopping once you've found one that isn't devoid of text.

Then it's just a matter of parsing the file. This part is pretty simple, so I won't bother explaining how. (Just set up a loop, and get each line of text from the file, one at a time. Or grab the whole file, and then use some "String - Replace" actions to convert the lines into delimited lists.) I'd probably store everything as list box items, with the race number as the item text, and the list of horses as a delimited list in the item's data. Like so:

RACE 1 1175::ARMAGUN^GEMAZZI^MISS AUDACITY^MY CHANTICLEER^REDSOCKS;;RACE 2 1000::BONNIE PRINCE^DISRUPTED^FOR GRANTED^GREENHOUSE EXPRESS^MIGHTY AMBER^MY BIGSTONE^NOBLE CHEYENNE;;RACE 3 1000::CHANOUR^EL VIXEN^ESCALADE^
FINAL FORWARD^IMPOSING TOD^LADY FARMER^RAFFIN FAIR^RAIN GIFT^SUNDAY DRIVE^TALEANNI SPORTS^TARCOOLA STAR

...etc. (I picked "^" as a delimiter, but you could use whatever you want, so long as it doesn't appear in the text.)

This way, the list box would look like this:

RACE 1 1175
RACE 2 1000
RACE 3 1000

...and you could set the list box to be sorted at run time, so it wouldn't matter what order the information was in the text file.

When the user selects an item in that list box, you just use a "List Box Object - Get Selected" action to find out the index of the item they selected, and then use "List Box Object - Get Item Data" to get the item data (the part after the :: ) for the item they selected.

Then just pass that delimited list to your listbox2, and change the delimiter from ;; to ^ or whatever you used instead.

Lorne
08-22-2002, 12:14 PM
Ah, what the heck. /ubbthreads/images/icons/laugh.gif

I had an idea for an easy way to parse the file (more like massaging it instead of actually parsing it), so I decided to put it together as a sample project.

The attached project (http://www.indigorose.com/ubbthreads/uploads/10376-Raceday.zip) should be of some help, I would think.

Edit: updated link to point to the "fixed" attachment.

10370-Raceday.zip (http://www.indigorose.com/ubbthreads/uploads/10370-Raceday.zip)

Derek
08-22-2002, 01:42 PM
Lorne - yu obv tested this there but it's not working for me. It seems to be having a problem starting from:

replace #ASC_CR##ASC_LF#==================#ASC_CR##ASC_LF#

with ::

coz i'm getting:

Race 1 1175||==========

showing in the races LBO

Lorne
08-22-2002, 01:45 PM
Actually I did test it, but I developed it with an internal version of AMS 40 that messed up the build configurations a little as a result of some code changes. (Brett's working on speeding up undo/redo and reducing the memory footprint big time.) Go to the Build Configurations tab and delete the 3 empty instances of "Default Build".

Meanwhile, I'll upload a fixed version. /ubbthreads/images/icons/laugh.gif

Lorne
08-22-2002, 01:47 PM
Okay, this version (http://www.indigorose.com/ubbthreads/uploads/10376-Raceday.zip) should work right out of the box.


10376-Raceday.zip (http://www.indigorose.com/ubbthreads/uploads/10376-Raceday.zip)

Derek
08-22-2002, 01:53 PM
OK .. this one's good /ubbthreads/images/icons/smile.gif

(I wondered why there were blank Default Build's)

Ray_Collins
08-26-2002, 06:11 AM
See I told you it could do it :-).
Thanks heaps for all your help. For some reason when I pasted the sample text in a bunch of spaces between items were lost so the code doesn't work with the real files. But that's a good thing 'cuase it means I have to understand how it works to change it.

Thanks again.