[Windows Mobile] RoryB:
Referred to your thread from another thread.

I read your script and looked at how I would write it, so here is the script I would write to set up the folder and files for zipping.

MkDir( "root" )
MkDir( "root\windows" )
zcount = ReadLine( "initflashfiles.dat" )
While( IsEmpty( zcount ) = FALSE )
If( Find( zcount, ":" ) NE 0 )
If( Find( zcount, ";" ) EQ 0 )
If( SubStr( zcount, 1, 4 ) EQ "root" )
mkdir( "root" \ Part( SubStr( zcount, 18, 100 ), """)", 1 ) )
EndIf
EndIf
EndIf
zcount = ReadLine( "initflashfiles.dat" )
EndWhile
wcount = ReadLine( "initflashfiles.dat" )
While( IsEmpty( wcount ) = FALSE )
If( Find( wcount, ":" ) NE 0 )
If( Find( wcount, ";" ) EQ 0 )
If( SubStr( wcount, Find( wcount, ":" ), 5 ) EQ ":-Per" )
mkdir( "root" \ SubStr( wcount, 12, Find( wcount, ":" )-14 ) \ Part( SubStr( wcount, Find( wcount, ":" )+11, 100 ), """)", 1 ) )
EndIf
EndIf
EndIf
wcount = ReadLine( "initflashfiles.dat" )
EndWhile
xcount = ReadLine( "initflashfiles.dat" )
While( IsEmpty( xcount ) = FALSE )
If( Find( xcount, ":" ) NE 0 )
If( Find( xcount, ";" ) EQ 0 )
If( SubStr( xcount, Find( xcount, ":" ), 5 ) EQ ":-Dir" )
If( SubStr( xcount, 1, 4 ) NE "root" )
mkdir( "root" \ SubStr( xcount, 12, Find( xcount, ":" )-14 ) \ Part( SubStr( xcount, Find( xcount, ":" )+13, 100 ), """)", 1 ) )
EndIf
EndIf
EndIf
EndIf
xcount = ReadLine( "initflashfiles.dat" )
EndWhile
ycount = ReadLine( "initflashfiles.dat" )
While( IsEmpty( ycount ) = FALSE )
If( Find( ycount, ":" ) NE 0 )
If( Find( ycount, ";" ) EQ 0 )
If( SubStr( ycount, Find( ycount, ":" ), 6 ) EQ ":-File" )
rename( "temp\dump" \ Part( Substr( Part( SubStr( ycount, Find( ycount, ":" )+10, 100 ), """,", 2 ), 11, 100), """)", 1 ), "root" \ SubStr( ycount, 12, Find( ycount, ":" )-14 ) \ Part( SubStr( ycount, Find( ycount, ":" )+8, 100 ), """,", 1 ) )
EndIf
EndIf
EndIf
ycount = ReadLine( "initflashfiles.dat" )
EndWhile
ZipFiles( "root\*.*", "InitFlash.zip", TRUE)

This creates all the folders that initflashfiles.dat creates and moves the files to their respective folder so they will not be in the windows folder. I have noticed if the file does not exist, I did not get an error when MortScript tried to move it to the subfolder.

One problem is some programs may call the windows link instead of the new location.

The problem I had with MortScript zip is that if a folder has no files in it the folder is not created in the archive.

One thing I have noticed is that if the file does not exist in the windows folder initflashfiles.dat does not give an error, so we could leave it unchanged. Also, initflashfiles.dat will create the directories that do not get created by MortScript zipfile.

add2config.txt could be used to create an execute unzip command of one type or another. I use MortScript in my ROMs so I would use it, but one could with PocketRAR or even zipfiles.

I am still thinking about how to handle HEX names. First I have to figure out how to determine it is a HEX name. Most likely I will look at the link destination to see if it has "\" in it to decide it is a HEX name instead.

UPDATE on 06/28/2010: I can determine the filename has HEX characters. I have an ini file for converting HEX to ASCII, but I still need to write a subroutine to convert the HEX name to ASCII name. I also ran into a problem that some of the lines in initflashfiles.dat were too long. For testing I deleted the long lines. Not sure of the work araound for this.

OKAY: I have it working, but I still cannot figure out the line too long error. It is 225 characters long

Directory("\Windows\Start Menu\Programs"):-File("\x0052\x0065\x006D\x006F\x0074\x0065\x0020\x0044\x0065\x0073\x006B\x0074\x006F\x0070\x0020\x004D\x006F\x0062\x0069\x006C\x0065\x002E\x006C\x006E\x006B", "\Windows\wpctsc.lnk")

If I remove this line my script works.