Posted: Sat Mar 15, 2003 10:11 am
Restored from previous forum. Originally posted by Num3.
Here's an interesting problem i came across & discussed a bit with Fred...
Seems that i'm unable to PACK jpg files together!
The pack returns an error, cause it can compact them anymore...
Here's the code:
Declare PackerProgress(SourcePosition, DestinationPosition)
If OpenWindow(0, 100, 200, 300, 40, #PB_Window_SystemMenu, "Packer - Progress Window")
CreateGadgetList(WindowID())
ProgressBarGadget(0, 10, 10, 280, 20, 0, 100)
If CreatePack("c:\test.bulk")
FileName$ = OpenFileRequester("Please select file to pack", "*.jpg", "*.jpg", 0, #PB_Requester_MultiSelection)
If FileName$
Repeat
If OpenFile(0, FileName$)
FileLength = Lof()
CloseFile(0)
EndIf
FileName$ = NextSelectedFileName()
If FileName$
Debug "Adding:" + FileName$
If AddPackFile(filename$, 0):PackerCallback(@PackerProgress()) : EndIf
EndIf
Until FileName$ = ""
EndIf
ClosePack()
EndIf
EndIf
End
Procedure PackerProgress(SourcePosition, DestinationPosition)
Shared FileLength
Result.f = (SourcePosition / FileLength)*100
SetGadgetState(0, Round(Result, 0))
While (WindowEvent()) : Wend ; Process all the window event befor quit
ProcedureReturn 1
EndProcedure
;-END OF CODE
Btw: I know the parto of getting the file size is pretty lamma...
I know i can use the PB command to do this, but I only found it a few days ago.....
--
Kind Regards
Rui Carvalho
Old programmers never die... They branch into a subroutine...
Here's an interesting problem i came across & discussed a bit with Fred...
Seems that i'm unable to PACK jpg files together!
The pack returns an error, cause it can compact them anymore...
Here's the code:
Declare PackerProgress(SourcePosition, DestinationPosition)
If OpenWindow(0, 100, 200, 300, 40, #PB_Window_SystemMenu, "Packer - Progress Window")
CreateGadgetList(WindowID())
ProgressBarGadget(0, 10, 10, 280, 20, 0, 100)
If CreatePack("c:\test.bulk")
FileName$ = OpenFileRequester("Please select file to pack", "*.jpg", "*.jpg", 0, #PB_Requester_MultiSelection)
If FileName$
Repeat
If OpenFile(0, FileName$)
FileLength = Lof()
CloseFile(0)
EndIf
FileName$ = NextSelectedFileName()
If FileName$
Debug "Adding:" + FileName$
If AddPackFile(filename$, 0):PackerCallback(@PackerProgress()) : EndIf
EndIf
Until FileName$ = ""
EndIf
ClosePack()
EndIf
EndIf
End
Procedure PackerProgress(SourcePosition, DestinationPosition)
Shared FileLength
Result.f = (SourcePosition / FileLength)*100
SetGadgetState(0, Round(Result, 0))
While (WindowEvent()) : Wend ; Process all the window event befor quit
ProcedureReturn 1
EndProcedure
;-END OF CODE
Btw: I know the parto of getting the file size is pretty lamma...
I know i can use the PB command to do this, but I only found it a few days ago.....
--
Kind Regards
Rui Carvalho
Old programmers never die... They branch into a subroutine...