Skip to main content
Question

Document Management file size for word and mp4 document


WSHAH
Do Gooder (Customer)
Forum|alt.badge.img+8
  • Do Gooder (Customer)
  • 42 replies

Dear All,

I am working on same kind of requirement to restrict a word document 1 MB, before Check-in in document management and I need your help on it.

I also find this Macro on community but not working might be some configuration issue.

Public Sub SizeCheck ()

  Const maxFileSize = 1024

  strFile = ClientScriptValues.Item('WORD').Value

  Set objFSO = CreateObject("Scripting.FileSystemObject")

  Set objFile = objFSO.GetFile(strFile)

  If objFile.Size > maxFileSize Then

    Err.Raise 1000, "File size check", "File is larger (" & objFile.Size & ") than the maximum specified file size (" & maxFileSize & "). Try again and select a smaller file."

  End If

End Sub

 

 

Regards

This topic has been closed for comments

20 replies

Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2824 replies
  • June 26, 2021

ClientScriptValues.Item('WORD').Value looks strange. Did you read the documentation on macros and what client script values are available?


WSHAH
Do Gooder (Customer)
Forum|alt.badge.img+8
  • Author
  • Do Gooder (Customer)
  • 42 replies
  • June 28, 2021

Hi Mathias,

I have test but still unable to restrict document before check in

 

Public Sub SizeCheck ()

  Const maxFileSize = 100

    strFile = ClientScriptValues.Item("LOCAL_FILE_1").Value

  Set objFSO = CreateObject("Scripting.FileSystemObject")

  Set objFile = objFSO.GetFile(strFile)

  If objFile.Size > maxFileSize Then

    Err.Raise 100, "File size check", "File is larger (" & objFile.Size & ") than the maximum specified file size (" & maxFileSize & "). Try again and select a smaller file."

  End If

End Sub

 

 

Regards


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2824 replies
  • June 28, 2021

Have you made sure that the macro is running? Do you get any error?


WSHAH
Do Gooder (Customer)
Forum|alt.badge.img+8
  • Author
  • Do Gooder (Customer)
  • 42 replies
  • June 28, 2021

Hi Mathias,

 

That is the main issue there is no error promoting and i am unable to understand, Might be i am missing some steps, Can you share the steps so that i will follow accordingly

 

Regards


Forum|alt.badge.img+14

@WSHAH ,

First you have to make sure that your macro is running. Try this:

 

Public Sub SizeCheck ()

  Const maxFileSize = 100

    strFile = ClientScriptValues.Item("LOCAL_FILE_1").Value

  Set objFSO = CreateObject("Scripting.FileSystemObject")

  Set objFile = objFSO.GetFile(strFile)

 

    Err.Raise 100, "File size check", "File is larger (" & objFile.Size & ") than the maximum specified file size (" & maxFileSize & "). Try again and select a smaller file."

 

End Sub

 

It will force an error. If you do not get any, the macro is not running.


WSHAH
Do Gooder (Customer)
Forum|alt.badge.img+8
  • Author
  • Do Gooder (Customer)
  • 42 replies
  • June 28, 2021

Hi Hans,

No error prompt after modifying Macro, I have import a word file with size 1.2 MB , Macro is unable to stop it. Seems that Macro is not working.

Regards

 


Forum|alt.badge.img+14

How does this look at your end?:

 


WSHAH
Do Gooder (Customer)
Forum|alt.badge.img+8
  • Author
  • Do Gooder (Customer)
  • 42 replies
  • June 28, 2021

Hi Hans,

This is my Document Macro

 

Regards


Forum|alt.badge.img+14

This looks ok, except you do not have a ‘Timeout’. 

The Filetype also have to refer to a doc or docx extention.


Forum|alt.badge.img+14

ohh, you have SizeCheck as Action. That is wrong. Try with ‘SelectAndRun’ or look up in the documentation for alternatives.


WSHAH
Do Gooder (Customer)
Forum|alt.badge.img+8
  • Author
  • Do Gooder (Customer)
  • 42 replies
  • June 28, 2021

Hi Hans,


File Type    File Extension    Description        Document Type
WORD        DOC            Word Document        ORIGINAL

 

Regards

 

 


WSHAH
Do Gooder (Customer)
Forum|alt.badge.img+8
  • Author
  • Do Gooder (Customer)
  • 42 replies
  • June 28, 2021

Hi Hans,

 

I have modified but still no action


Document Macros

File Type= WORD
Script Language=VBScript
Process=CHECKIN
Action=SelectAndRun
Main-Function=SizeCheck
Description=Checkin Word Doc
Blockname=SizeCheck

Document Macro Blocks
Blockname=SizeCheck
Script=

Public Sub SizeCheck ()
  Const maxFileSize = 100
    strFile = ClientScriptValues.Item("LOCAL_FILE_1").Value
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFile = objFSO.GetFile(strFile)
    Err.Raise 100, "File size check", "File is larger (" & objFile.Size & ") than the maximum specified file size (" & maxFileSize & "). Try again and select a smaller file."
End Sub

 

Regards


Forum|alt.badge.img+14

Is the word document youare checking in a .docx instead of .doc?


WSHAH
Do Gooder (Customer)
Forum|alt.badge.img+8
  • Author
  • Do Gooder (Customer)
  • 42 replies
  • June 28, 2021

Hi,

 

Regards


Forum|alt.badge.img+14

This is getting strange now. The macro is working here, with a doc extension. 

The only other option I can think of, is that you checkin more than 1 file. That will prevent the macro from running.  

Maybe, @Mathias Dahl has some ideas?


WSHAH
Do Gooder (Customer)
Forum|alt.badge.img+8
  • Author
  • Do Gooder (Customer)
  • 42 replies
  • June 28, 2021

Hi @Mathias Dahl ,

 

Need you input in this issue

 

Regards


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2824 replies
  • June 28, 2021
Hans Andersen wrote:

ohh, you have SizeCheck as Action. That is wrong. Try with ‘SelectAndRun’ or look up in the documentation for alternatives.

FYI, the Action field has no functional effect on macros. It is just needed to make multiple macros for the same file type and process unique. You are mixing this up with the Select And Run option in the Document Class Process Action configuration.


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2824 replies
  • June 28, 2021

Have you read the documentation on how macros work? It contains a lot of details on how to get macros to run, the process of configuring them, etc.

I recommend you just try this simple macro (a similar one can be found in the documentation):

Public Sub SizeCheck ()

  MsgBox "This is a macro"

End Sub

to make sure it runs at all. Even the simple “error macro” suggested by Hans can fail.

My guess is that macros does not run, for some reason. The documentation should have all clues about that.

 


WSHAH
Do Gooder (Customer)
Forum|alt.badge.img+8
  • Author
  • Do Gooder (Customer)
  • 42 replies
  • June 29, 2021

Hi,

 

Yes Simple Macro is also not running, for some reason but unable to find issue in document kindly suggest the document or dtep to check why Macro is not running or how we can run a Macro.

Example of a Macro

This is an example of a macro that causes a message box to open when the connected process is performed.

Macro block MESSAGEBOXTEST:

Public Sub MessageBoxTest()

MsgBox "This is a very simple macro."

End Sub

 

https://docs.ifs.com/ifsclouddocs/default.htm?openpage=https://docs.ifs.com/ifsclouddocs/CreateAndMaintainDocument/ActivityDefineObjectAttributesForMacros.htm

I have followed the document but all in vain right now.

 

Regards


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2824 replies
  • June 29, 2021

That document is related to Docman macros, but more of advanced topic. 

You should read this document from the start to the end. Carefully and several times :-)

https://docs.ifs.com/ifsclouddocs/CreateAndMaintainDocument/AboutDocumentMacro.htm?StandAlone=true

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings