BigDaddyO Posted April 30, 2009 Posted April 30, 2009 OK, I'm getting frustrated because this should be so simple yet it's giving me problems. I'm using a 3rd party tool to create zip files for transfer to USB drives during data migrations. my issue is that I need to create a very simple array to tell the tool how big to make each section of the zip files (in bytes). $Free = DriveSpaceFree("E:") $isplitSize = Number(($Free - 10) * 1024 * 1024) Dim $aFileSizeArray[2] = [$isplitSize, 0] Really easy right? except it's not seeing the value in the array. During trouble shooting I did a clipput($isplitSize) and then manually pasted that as the first value in the array and it worked fine. So i can only assume the value of $isplitSize is not being created as a true integer. Any ideas? Thanks, Mike
calc0000 Posted April 30, 2009 Posted April 30, 2009 Why are you using the Number function? DriveSpaceFree returns a floating point number, and Number is used (from what I read) to convert string expressions into numbers.
oMBRa Posted April 30, 2009 Posted April 30, 2009 replace Number with Int: $isplitSize = Int(($Free - 10) * 1024 * 1024)
Yashied Posted April 30, 2009 Posted April 30, 2009 (edited) Number(), Int() or Round() anyway it works for me.??? Edited April 30, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
BigDaddyO Posted April 30, 2009 Author Posted April 30, 2009 (edited) i tried number and int. they return a value, that's not the problem. For some reason when I populate the first value in the array with what is returned, the 3rd party app doesn't see it. If i populate the first value in the array manually with say, 112056254 it works fine. Here is an example of how I verified it has something to do with how the variable is being created. I ran this and then pasted the output into the array manually. I then run the script with the script again, this time with the value manual entered and everything works fine $Free = DriveSpaceFree("E:") $isplitSize = Number(($Free - 10) * 1024 * 1024) ;~ Dim $aFileSizeArray[2] = [$isplitSize, 0] ClipPut($isplitSize) Dim $aFileSizeArray[2] = [112603136, 0] Edited April 30, 2009 by MikeOsdx
BigDaddyO Posted April 30, 2009 Author Posted April 30, 2009 ok, if i do this, it works fine $iVal = 112603136 Dim $aFileSizeArray[2] = [$iVal, 0] i'm so confused
Developers Jos Posted April 30, 2009 Developers Posted April 30, 2009 What do you do next that's failing? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Yashied Posted April 30, 2009 Posted April 30, 2009 You got it working? What do you see in the console? $Free = DriveSpaceFree("C:") $isplitSize = Number(($Free - 10) * 1024 * 1024) Dim $aFileSizeArray[2] = [$isplitSize, 0] ConsoleWrite($aFileSizeArray[0] & @CR) My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
BigDaddyO Posted April 30, 2009 Author Posted April 30, 2009 (edited) Here is the full script I'm using for testing. as it is right now, if i run it, i get one big zip file that is a little over 300mb, meaning that for some reason it's not seeing the size value in the array. if I un-remark the line: $isplitSize = 112654123 then I get two files that are 110mb and one that is 82mb ps. my E: is a 128mb usb drive i'm using for testing. I wanted it small so I didn't have to test with huge files my D: has mass quantity of free space. expandcollapse popup#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=Migration.exe #AutoIt3Wrapper_UseUpx=n #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** $Free = DriveSpaceFree("E:") $isplitSize = Number(($Free - 10) * 1024 * 1024) ;~ $isplitSize = 112654123 _ZipToDisk("D:\Downloads\SharePointDesigner.exe", $isplitSize) Func _ZipToDisk($ItemList, $SplitBytes) ;Specify the max size for the split file in bytes ;~ MsgBox(0, "Bytes", $SplitBytes) Dim $aFileSizeArray[2] = [$SplitBytes, 0] Const $ZIP_ADD = 4 Const $ZSO_MINORCANCEL = 2 Const $ZSO_EXTERNALPROG = 4 Const $ZSO_EXTPROGCANCEL = 8 Const $THREADING_TIMEOUT = 30 Fileinstall("dzactx.dll", @ScriptDir & "\") FileInstall("DZPROG32.exe", @ScriptDir & "\") $ObjZip = ObjCreate("dzactxctrl.dzactxctrl.1") if not IsObj($ObjZip) Then #RequireAdmin $dzReg = RunWait(@SystemDir & '\regsvr32.exe /s "' & @ScriptDir & '\dzactx.dll"', @SystemDir) if $dzReg = 0 Then $ObjZip = ObjCreate("dzactxctrl.dzactxctrl.1") if not IsObj($ObjZip) Then MsgBox(0, "Setup Completed", "Setup has been completed. Please restart the Migration Wizard.") Else MsgBox(0, "Setup Failed", "Unable to properly register files required by the Migration Wizard.") Exit EndIf EndIf ;avoid display of errors through GDI of Server $ObjZip.QuietFlag = True ;~;setup the password for the zip file. ;~ $ObjZip.EncryptFlag = True ;~ $ObjZip.EncryptCode = $icrpt ;Compression type $ObjZip.CompressionFactor = 19 ;set multivolume for multiple disks $MV_USEMULTI = 0x8000 $MV_TOHD = 0x4000 $ObjZip.MultiVolumeControl = $MV_USEMULTI + $MV_TOHD $ObjZip.FileSizeArray = $aFileSizeArray ;Display status through external App $ObjZip.ExtProgTitle = "Migration Copy status" $ObjZip.ZipSubOptions = $ZSO_MINORCANCEL + $ZSO_EXTERNALPROG + $ZSO_EXTPROGCANCEL ;Number of Seconds to wait on the prior thread if concurrent access is needed $ObjZip.WaitSeconds = $THREADING_TIMEOUT ;Name of ZIP File $ObjZip.ZIPFile = "D:\Temp\DynaZip\ZipSplit.zip" ;Name of Items that will appear in the ZIP File $ObjZip.ItemList = $ItemList ;Recurse through directories $ObjZip.RecurseFlag = True ;Don't include any directory items in the zip file ;~ $ObjZip.noDirectoryEntriesFlag = True ;Don't prefix the items with any path information ;~ $ObjZip.noDirectoryNamesFlag = True ;initiate the zip process $ObjZip.ActionDZ = $ZIP_ADD ;' Display Failure based on returned ErrorCode GUISetCursor(2,1);Change cursor back to an arrow Switch $ObjZip.ErrorCode Case 0 ;;; do nothing as this is successfull Return 1 Case 9 MsgBox(262208, "Migration Canceled", "The Migration process has been canceled.") Return Case Else MsgBox(262208, "Migration Failed", "The Migration process failed." & @CRLF & "Error Code: " & $ObjZip.ErrorCode) Return EndSwitch EndFunc Edited April 30, 2009 by MikeOsdx
Developers Jos Posted April 30, 2009 Developers Posted April 30, 2009 (edited) Strange issue. looks like your formula also returns an Int as the commented line does when filling in the number yourself. I don't have the DLL available so cannot do any other debugging. Edited April 30, 2009 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
BigDaddyO Posted April 30, 2009 Author Posted April 30, 2009 lets see if this works. Took a bit of searching but I found a shareware download and pulled the two needed files from that and it's got the same issues. The files should be attached to this post. Mikedzactx.dllDZPROG32.exe
Developers Jos Posted April 30, 2009 Developers Posted April 30, 2009 Must be something with the calculated value. This seems to work fine: $isplitSize = number(String(($Free - 10) * 1024 * 1024)) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
BigDaddyO Posted April 30, 2009 Author Posted April 30, 2009 Must be something with the calculated value. This seems to work fine: $isplitSize = number(String(($Free - 10) * 1024 * 1024)) Yep that works for me too... Weird, so I have to convert the variable to a string in order to convert into a number... Thanks for the work around Jos. Mike
Developers Jos Posted April 30, 2009 Developers Posted April 30, 2009 (edited) Yep that works for me too...Weird, so I have to convert the variable to a string in order to convert into a number...Thanks for the work around Jos.MikeIts not clear to me as yet why it works and Int() doesn't.Do you have any description of the Com object, specificly $ObjZip.FileSizeArray ?Jos Edited April 30, 2009 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
BigDaddyO Posted May 1, 2009 Author Posted May 1, 2009 Its not clear to me as yet why it works and Int() doesn't.Do you have any description of the Com object, specificly $ObjZip.FileSizeArray ?JosI'm fine with the work around but it still makes me wonder if there is some unseen character or something that is being created in the drivespacefree that is creating the issue.Below is all I got from the manual.MikeFileSizeArray Hidden PropertyThis property contains a VARIANT array representing a FileSize array of unsignedlong values. This FileSize array is used when creating a multi-volume zip file andwriting the individual split files to a hard drive. Each value in the array specifies themaximum size in bytes that a corresponding split file may occupy. This property isonly used when the MultiVolumeControl property is activated and itsMV_USEMULTI and MV_TOHD bits are set (see page 188).The first entry in the FileSize array (array element 0) specifies the default split filesize. The default will be used when there is no specific split file size entry in theFileSize array. The last FileSize array element must be set to 0, which serves as aterminator for the FileSize array. FileSize array elements 1 through n specify themaximum size for a corresponding split file 001 through n. It is most efficient tospecify the split file sizes as an integer multiple of 512. Setting sizes below 65536will result in file segment sizes of 65536 since the smallest compatible multi-volumefile segment allowed is 64K. Common media sizes are defined as follows:// Common media sizes#define FSA_FILESIZE360 362496L#define FSA_FILESIZE720 730112L#define FSA_FILESIZE1200 1213952L#define FSA_FILESIZE1440 1457664L#define FSA_FILESIZE2880 2931712LExample: The following FileSize array elements would be used to create split fileson the hard drive suitable for storage on 1.44 MB floppy diskettes while reserving 10KB (10240 bytes) on the first diskette.FileSize Array Elements:1457664 element 01447424 element 10 element 2If the file created by the zip operation yields 4 split files:¨ the first split file size would be 1447424 bytes (determined by element 1)¨ the second and third split file sizes would be 1457664 (the default size specified by element 0)¨ the fourth split file size would be less than or equal to 1457664 (the default size specified byelement 0)Used when ActionDZ is set to: ZIP_ADD
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now