[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Michael Hansen

10/12/2005 8:43:00 AM

Hi,

First of all I'll say that Axapta programming is very new to me. So I
hope that I can have a little help in here.

I need to make a little Axapta job that can look through some HTML code
and then delete all picture-files in a given directory that is not
represented in the html code

I'm sure that there is a simple way of doing it, but I hope you can
give me a hint or even better, some code.

--
Regards
Michael Hansen
Denmark
4 Answers

Daniel Biesiada

10/12/2005 1:40:00 PM

0

Michael Hansen wrote:
> Hi,
>
> First of all I''ll say that Axapta programming is very new to me. So I
> hope that I can have a little help in here.
>
> I need to make a little Axapta job that can look through some HTML code
> and then delete all picture-files in a given directory that is not
> represented in the html code
>
> I''m sure that there is a simple way of doing it, but I hope you can
> give me a hint or even better, some code.
>

If you''re looking for some HTML parsing API within axapta you might
start looking from XML related classes, as far as I noticed there is
full DOM support for XML. You could try to treat your HTML file as XML
document and parse for specific tags to figure out if there is your
image file or not according to your processing.

To give you some start point see AOT->Classes->XmlDocument

best regards,
Daniel Biesiada

Joris de Gruyter

10/13/2005 12:24:00 PM

0

However, the chance that html files (unless you make them yourself and can
assure that they are) are actually well-formed is highly unlikely, making it
impossible to read with any XML parser...

J.



"Daniel Biesiada" <dupa@dot.com> wrote in message
news:ehdKnJzzFHA.1624@TK2MSFTNGP10.phx.gbl...
> Michael Hansen wrote:
>> Hi, First of all I''ll say that Axapta programming is very new to me. So I
>> hope that I can have a little help in here. I need to make a little
>> Axapta job that can look through some HTML code and then delete all
>> picture-files in a given directory that is not represented in the html
>> code I''m sure that there is a simple way of doing it, but I hope you can
>> give me a hint or even better, some code.
>
> If you''re looking for some HTML parsing API within axapta you might start
> looking from XML related classes, as far as I noticed there is full DOM
> support for XML. You could try to treat your HTML file as XML document and
> parse for specific tags to figure out if there is your image file or not
> according to your processing.
>
> To give you some start point see AOT->Classes->XmlDocument
>
> best regards,
> Daniel Biesiada


Daniel Biesiada

10/13/2005 2:02:00 PM

0

Joris de Gruyter wrote:
> However, the chance that html files (unless you make them yourself and can
> assure that they are) are actually well-formed is highly unlikely, making it
> impossible to read with any XML parser...
>

Well if we can assume this validation it''s (imho) the best option to
check it half-automated way.

If not well.. do you see better concept for it? ;)

rgrds,
Daniel

Micha³ Kupczyk

10/13/2005 2:32:00 PM

0

"Michael Hansen"
> I need to make a little Axapta job that can look through some HTML code
> and then delete all picture-files in a given directory that is not
> represented in the html code

If this is one-time job:

1) Write down your time.
2) Open your html(s) in IE, to see all pictures.
3) Use
dir /tA > filesList.txt

in your directory, which will tell you when the files were last accessed.
4) process filesList.txt (in excel?) to get names of all unused files.


OR
write same in X++ ;-)

2) ... WinAPI::shellExecute(htmlFile)

3+4) ... WinAPI::getFileAccessedDate(file)<startDate
&& WinAPI::getFileAccessedTime(file)<startTime

Michal