|
I'm not new to scripting... but I am new to advanced scripting. I've been using KiXtart for a while now as a logon script processor for my domain controllers.
However, this is not work related. I've come to realize the potential for KiXtart. I'm in a gaming clan. Every match we need to record demos and take screenshots. We then upload those demos and screenshots to an FTP server.
Now... I've decided to try and help our clan out. Most of our members are not very computer savvy. They have no idea how to zip files up and how to transfer them via FTP... even though I've posted very detailed steps on how to do so. Therefore, I've decided to make a simple to use utility for them (using KiXtart) that will do the following:
1. convert screenshots from BMP format to JPG format using external utility - using pvw32con.exe 2. zip up their demos and screenshots (making an external call to WinZip Command line add-on) 3. save zip files to a "que" for later transfer (make a simple ini file for this) 4. transfer "que'd" files when user ready by using external ncftpput.exe (part of the ncftp package)
I have a good start on my script. However, this script is becoming much more complex than what I'm used to. Where I'm having difficulty is here...
All demos and screenshots are stored in a certain folder on the hard drive (this folder varies on each computer). I'm doing a check on a registry key to find the folder location to help minimize user input.
The problem - the users don't necessarily clean out the contents of their game folder. Therefore I can't take a blanket wildcard statement to grab *.bmp and convert them to *.jpg and then add *.jpg to the zip file I'm creating.
What I need to do is this... Use the DIR() function to find all BMP files... then display all found BMP files on screen and let the user select which of the BMP files need to be zipped up.
I'm sure this can be done... but I've become lost trying to figure out how.
On a second question.... I have an option for the users to delete all demo files and screenshots from their game folder. I tried to use the built in function DEL() but am unable to due to long file name problems from the command line. Instad I had to use the SHELL statment to use native oS delete...
:RemoveDemos CLS $removedemos = MessageBox("This will erase ALL DEMOS AND SCREENSHOTS from your $dodfolder folder. Do you wish to continue?", "FILE ERASE WARNING", 308) If $removedemos = 6 Shell 'CMD.EXE /C DEL "' + $dodfolder_nqbae + '\*.dem"' Shell 'CMD.EXE /C DEL "' + $dodfolder_nqbae + '\*.bmp"' Shell 'CMD.EXE /C DEL "' + $dodfolder_nqbae + '\*.jpg"' $rc = MessageBox("All demos and screenshots in your $dodfolder folder have been deleted!", "Demos and screenshots deleted", 48) EndIf If $removedemos = 7 Goto "MainProgramMenu" EndIf
$dodfolder is found by examining for a particular key in the Registry. This location will be different on every computer.
The default location is usually...
C:\Program Files\Steam\SteamApps\\day of defeat\dod
However, I've seen three different variations of the Steam installation that installs the files into different folders...
C:\Valve\Steam\.... C:\Program Files\Valve\Steam\....
Then there's the obvious alternate location - intentionally installing to a different folder or a different hard drive.
The location is stored in the registry, so it's easy enough to locate. However, if I try to use any of the KiXtart functions for DIR(), DEL(), etc... I cannot due to long file name operations.
In a DOS environment through Windows... any file operations pertaining to long file names either must have quotes around the entire object... or use shortened 8.3 convention of accessing the objects. Due to the necessity of encasing my filenames within quotes... the KiXtart processor fails when working with long file names (yet the SHELL command works for some reason). I've tried the single quote character and I've tried the CHR(34) reference, all to no avail.
DEL '"' + $dodfolder_nqbae + '\*.dem"'
Is the command I would expect to work but it doesn't. Does anybody have any ideas how to get around this?
Thanks in advance,
ChadOx
|