Page 1 of 1

Script that parses XML - Sample wanted

Posted: 2007-03-22 21:46:19
by THEMike
I'm looking for an example script that parses XML returned from a website.

I'm sick of the Amazon script not working, and the lack of a .co.uk variant and since I already have an Amazon WS developer key, I'm going to produce a global amazon, WS based, data retrieval script. But I'd like an example of handling XML to work off.

(I'm an ex-delphi programmer, use XML a lot, but never from Delphi and never with the lib that the script library has access to).

Posted: 2007-03-22 21:57:15
by antp
I think that the only script that handles XML is the "dvdfr" script.

Posted: 2007-03-22 21:59:16
by THEMike
Cheers, is there any documentation of the comment header?

Posted: 2007-03-23 11:37:35
by antp
That is at the top of all scripts? No, but you do not have to edit it manually: its content is modifiable throught the "Properties" window of the script editor (one of the buttons in the Editor window)

Posted: 2007-03-23 12:07:55
by THEMike
Yeah, that is what I meant. Ok Cheers.

I'm working in my favourite programmers editor instead of the script editor, so hadn't noticed.

I'd like to request an API to set the parameters, there is one to read them, and a way of setting persistent info. I'd like my script to be able to prompt the user to confirm/set their initial settings on first run.

My script supports all flavours of Amazon, so on first run I'd like them to select which one to work with rather than default to .co.uk. I also have a couple of other options which I'd like to highlight to the user and get a first cut of settings.

Cheers,

Mike

Posted: 2007-03-23 12:47:18
by antp
You can use GetStatic & SetStatic functions:

Code: Select all

procedure SetStatic(AName: string; AValue: string);
function GetStatic(AName: string): string;
The value is stored in Scripts.ini

Posted: 2007-03-23 13:44:04
by THEMike
I'm aware of the statics, but I'd like to do:

if GetStatic('SettingsMade') = '' then begin
// render a pick list for each of the three critical options.
// then call new SetOption() function to set those options.
SetStatic('SettingsMade') = '1';
end;

Then use GetOption() to retreive the settings, thus allowing the user to change the Options at any time without having to do an intrusive, do you want to change options? Dialog and abuse Get/SetStatic.

Posted: 2007-03-23 18:54:27
by antp
Well, currently you cannot really do that unfortunately.

Posted: 2007-03-23 18:58:58
by THEMike
Yes, I'm aware of that, I was requesting it as a future feature.

My amazon script has been posted as a [BETA] [REL], and I've just used it to replace the rubbish IMDB images in 300 odd films with nice UK DVD covers from amazon.co.uk