ok, I have been waiting long enough... I am still working on the installer so it is not completely finished yet. It is very nearly finished. I am hoping I can finish it tonight, if I focus on it... Anyway, until I can finish and release the main script, I thought I would go ahead and release some of the subscripts I am using for my loader.
For those of you (probably most of you) who do not know what loader, I am talking about. I wrote a loader/autoinstaller (whatever you want to call it) similar to the Slayers awile back. It was much more advanced than slayers... I tried to get him to use my code in his release (as I can not offer the same level of support that he does) but he felt mine was just too complex (agreed... complexity is a tradeoff of flexibility, mine was MUCH More flexible and therefore was more complex) Anyway, I think he started using bits and pieces of my loader in his but that's really not important for now...
What is important is that I needed to make a new version... his is just not comprehensive enough to suit the needs of some people. Anyway, so I agreed to make a new version. I can't wait for the next release of MXM and I will never go back to using Evox for writing the installer, now that I have found out about MXM, so this loader/autoinstaller is based entirely on mxm 0.9n.6. I understand the next release will completely change everything but until then this is the best I could come up with in a short period of time...
The scripts I will be including below are based on work I have done on that loader. I still have to finish the main script and all that fun stuff... But these might prove useful for some, if for nothing else for code samples and ideas on how some things could be implemented... That said... enjoy... let me know if you have questions or comments about this code... would love to hear some feedback...
Thanks,
SumDumGuy
NotVal.xas
CODE |
;############################################################################### ### ;# ;# Title: NotVal ;# Author: SumDumGuy ;# Filename: NotVal.xas ;# Date: 08-27-2004 ;# Version: 1.0 ;# Purpose: This is basically a function in a script. It accepts two arguments the Value ;# to return the Not of and the file to return it in. It then returns the Not value of that ;# arg (0 = 1, 1 = 0, True = False, False = True). It's basically like a toggle switch ;# ;############################################################################### ###
If %1% == "0" GOTO Ret1 If %1% == "1" GOTO Ret0 If %1% == False GOTO RetTrue If %1% == True GOTO RetFalse GOTO End
:Ret1 Set RetVal 1 GOTO WriteNot
:Ret0 Set RetVal 0 GOTO WriteNot
:RetTrue Set RetVal True GOTO WriteNot
:RetFalse Set RetVal False GOTO WriteNot
:WriteNot OpenWrite WFileHndl %2% WriteFileLn WFileHndl %RetVal% CloseFile WFileHndl GOTO End
:End Quit
|
FreeOnDrv.xas
CODE |
;############################################################################### ### ;# ;# Title: Free On Drive ;# Author: SumDumGuy ;# Filename: FreeOnDrv.xas ;# Date: 09-26-2004 ;# Version: 1.0 ;# Purpose: This is basically a function in a script. It accepts two arguments the Drive ;# to check (in the form of G_Drive, F_Drive, E_Drive & C_Drive) and the file to return it in ;# It then returns the free space on that drive in MB with out any non-numerical characters. ;# ;############################################################################### ###
If %1% == "G_Drive" GOTO CheckG If %1% == "F_Drive" GOTO CheckF If %1% == "E_Drive" GOTO CheckE If %1% == "C_Drive" GOTO CheckC GOTO End
:CheckG Set FreeOnDrv $ShortDriveGFree$ GOTO CalcFree
:CheckF Set FreeOnDrv $ShortDriveFFree$ GOTO CalcFree
:CheckE Set FreeOnDrv $ShortDriveEFree$ GOTO CalcFree
:CheckC Set FreeOnDrv $ShortDriveCFree$ GOTO CalcFree
:CalcFree Setfunc FODLen LENGTH %FreeOnDrv% Sub FODLen 3 Setfunc FreeOnDrv RIGHT %FODLen% %FreeOnDrv% Setfunc FODLen LENGTH %FreeOnDrv% Sub FODLen 5 Setfunc FreeOnDrv LEFT %FODLen% %FreeOnDrv% Setfunc ByteType Right 2 %FreeOnDrv% Sub FODLen 2 Setfunc FreeOnDrv LEFT %FODLen% %FreeOnDrv% Setfunc FreeOnDrv REPLACE "," "" %FreeOnDrv% If %ByteType% == "KB" GOTO ConvertKB2MB GOTO Finished
:ConvertKB2MB DIV FreeOnDrv 1024 GOTO Finished
:Finished OpenWrite WFileHndl %2% WriteFileLn WFileHndl %FreeOnDrv% CloseFile WFileHndl GOTO End
:End Quit
|
TrayPrompt.xas
CODE |
;############################################################################### ### ;# # ;# Title: Tray Prompt and Reboot or Shutdown # ;# Author: SumDumGuy # ;# Filename: TrayPrompt.xas # ;# Date: 08-27-2004 # ;# Version: 1.0 # ;# Purpose: Asks if they want to eject the DVD Tray, Then Reboots or Shutsdown # ;# # ;############################################################################### ###
GOTO TrayPrompt
:TrayPrompt BeginDraw UseCurrent MessageBox "Before you %1%.$eol$Would you like to Eject the DVD Drive Tray?$eol$$eol$Press the \"A\" button to Eject and %1%.$eol$$eol$Press the \"B\" button to Continue %1%$eol$without Ejecting.$eol$$eol$" EndDraw Input If %_GP_B% == "1" GOTO PerfAction If %_GP_A% == "1" GOTO EjectFirst If %_GP_BACK% == "1" GOTO End GOTO TrayPrompt
:EjectFirst TrayOpen BeginDraw UseCurrent MessageBox "Remove the CD/DVD and then Press any button to continue with %1%...$eol$$eol$" EndDraw Input
:PerfAction If %1% == "Shutdown" GOTO ShutDownNow If %1% == "Reboot" GOTO RebootNow
:ShutDownNow Shutdown GOTO End
:RebootNow Reboot GOTO End
:End Quit
|
BigDrive.xas
CODE |
;############################################################################### ### ;# ;# Title: Biggest Drive ;# Author: SumDumGuy ;# Filename: BigDrive.xas ;# Date: 08-27-2004 ;# Version: 1.0 ;# Purpose: This is basically a function in a script. It accepts one argument, the ;# file to return the results in. It returns the letter of the drive with the most ;# most free space out of G, F, E & C. ;# ;############################################################################### ###
Set RetValFile Y:\RetVal.dat Set SelPartCMsg "Press \"Y\" for the C Partition with %FreeOnC% MB$eol$$eol$" Set SelPartEMsg "Press \"X\" for the E Partition with %FreeOnE% MB$eol$$eol$" Set SelPartFMsg "Press \"A\" for the F Partition with %FreeOnF% MB$eol$$eol$" Set SelPartGMsg "Press \"B\" for the G Partition with %FreeOnG% MB$eol$$eol$"
Copy %ScriptsPath%\RetVal.dat Y:\ CallFile %ScriptsPath%\FreeOnDrv.xas G_Drive %RetValFile% OPENREAD FileHndl %RetValFile% READFILELN FileHndl FreeOnG CLOSEFILE FileHndl Delete %RetValFile%
Copy %ScriptsPath%\RetVal.dat Y:\ CallFile %ScriptsPath%\FreeOnDrv.xas F_Drive %RetValFile% OPENREAD FileHndl %RetValFile% READFILELN FileHndl FreeOnF CLOSEFILE FileHndl Delete %RetValFile%
Copy %ScriptsPath%\RetVal.dat Y:\ CallFile %ScriptsPath%\FreeOnDrv.xas E_Drive %RetValFile% OPENREAD FileHndl %RetValFile% READFILELN FileHndl FreeOnE CLOSEFILE FileHndl Delete %RetValFile%
Copy %ScriptsPath%\RetVal.dat Y:\ CallFile %ScriptsPath%\FreeOnDrv.xas C_Drive %RetValFile% OPENREAD FileHndl %RetValFile% READFILELN FileHndl FreeOnC CLOSEFILE FileHndl Delete %RetValFile%
:CheckGFree If %FreeOnG% !#^ "free" GOTO CheckFFree Set FreeOnG 0 Set SelPartGMsg "" GOTO CheckFFree
:CheckFFree If %FreeOnF% !#^ "free" GOTO CheckEFree Set FreeOnF 0 Set SelPartFMsg "" GOTO CheckEFree
:CheckEFree If %FreeOnE% !#^ "free" GOTO CheckCFree Set SelPartEMsg "" GOTO ErrorPrompt
:CheckCFree If %FreeOnC% !#^ "free" GOTO TestGPart Set SelPartCMsg "" GOTO ErrorPrompt
:TestGPart If# %FreeOnG% < %FreeOnF% GOTO TestFPart If# %FreeOnG% < %FreeOnE% GOTO TestFPart If# %FreeOnG% < %FreeOnC% GOTO TestFPart Set BigDrive 4 Set BigDrvLetter G GOTO AcceptPrompt
:TestFPart If# %FreeOnF% < %FreeOnE% GOTO TestEPart If# %FreeOnF% < %FreeOnC% GOTO TestEPart Set BigDrive 3 Set BigDrvLetter F GOTO AcceptPrompt
:TestEPart If# %FreeOnE% < %FreeOnC% GOTO TestCPart Set BigDrive 2 Set BigDrvLetter E GOTO AcceptPrompt
:TestCPart Set BigDrive 1 Set BigDrvLetter C GOTO AcceptPrompt
:AcceptPrompt BeginDraw UseCurrent MessageBox "The C partition appears to have %FreeOnC% MB$eol$The E partition appears to have %FreeOnE% MB$eol$The F partition appears to have %FreeOnF% MB$eol$The G partition appears to have %FreeOnG% MB$eol$$eol$The %BigDrvLetter% drive appears to have the most free space$eol$on it. X-Loader will attempt to use the %BigDrvLetter% Drive.$eol$$eol$Press \"Start\" to change this selection$eol$$eol$Press any other button to accept this selection$eol$$eol$" EndDraw Input If %_GP_START% != "1" GOTO WriteDrive GOTO TargetDrvPrompt
:TargetDrvPrompt BeginDraw UseCurrent MessageBox "Select the partition to load apps/games/etc to...$eol$$eol$%SelPartCMsg%%SelPartEMsg%%SelPartFMsg%%SelPartGMsg%" EndDraw Input If %_GP_Y% == "1" GOTO SetCPart If %_GP_X% == "1" GOTO SetEPart If %_GP_A% == "1" GOTO SetFPart If %_GP_B% == "1" GOTO SetGPart GOTO TargetDrvPrompt
:SetCPart Set BigDrive 1 GOTO WriteDrive
:SetEPart Set BigDrive 2 GOTO WriteDrive
:SetFPart Set BigDrive 3 GOTO WriteDrive
:SetGPart Set BigDrive 4 GOTO WriteDrive
:WriteDrive OpenWrite WFileHndl %1% WriteFileLn WFileHndl %BigDrive% CloseFile WFileHndl GOTO End
:ErrorPrompt BeginDraw UseCurrent MessageBox "An Error was encountered. There does not appear$eol$to be any free space on the System partitions.$eol$$eol$Press any button to Reboot.$eol$$eol$" EndDraw Input Callfile %ScriptsPath%\TrayPrompt.xas Shutdown
:End Quit
|
Edit: I updated this post on 9/26/04 to reflect corrections to the FreeOnDrv Script. It incorrectly reported because when I first wrote it I did not know (and therefore take into account) that some values were returned as KB instead of MB. This has been fixed now.
thx, sdg
This post has been edited by SumDumGuy3: Sep 26 2004, 07:06 AM <