Batchjob not working with WinApi::findFirstFile?

burdee64burdee64 Member Posts: 20
edited 2006-06-13 in Dynamics AX
Hello,

I've written an XML import function. It is working fine if the program is initiated interactively from the menu.
However when I start the same program as a batch it doesnt work.

What's the program do:

private int ScanForFile(FilePath _directory)
{
str filename = "*.xml";
container con;
int handle = 0;
int ret = 0;
str naam;
boolean created;

;

con = WinApi::findFirstFile(_directory + filename);

if (con)
{
handle = conPeek(con, 1);

// first filename:
naam = conPeek(con, 2);

while (naam)
{
if (naam != "." && naam != "..")
{
// process this file
created = this.ConvertXML2SalesOrder(_directory + naam);
}
.........

So it scan for XML-files in a directory, using WinApi::findFirstFile

What did I test:
1) Setting up some XML-files in c:\temp\.
Running the program on my PC interactively.
Directory = C:\temp\
result: running correctly
2) Setting up the same files in the same directory.
Starting batch-operation on that same Axapta session on my PC.
Starting the program as a batch on another PC.
Program does run as batch on my PC, but fails to find the files.
3) Same procedure as 2) but do a debug on my PC as well...
(Debugging the batch-run of this program)
All variables are correctly filled (ie. _directory and filename) but the container con is filled with empty data. => handle = -1 and naam = "" (empty).

Why???

Can somebody help me out?

Axapta 3.0 SP3
Bert van Dijk
Rotor BV

Answers

Sign In or Register to comment.