OnRun() PrintFile('c:\PASO\Microsoft Dynamics NAV 2009 R2.docx');
PrintFile(Fichero : Text[1024]) IF NOT EXISTS(Fichero) THEN EXIT; CREATE(ObjShell, TRUE); SplitName(FullFileName, Path, _FileName); ObjFolder := ObjShell.NameSpace(Path); ObjFolderItems := ObjFolder.Items; ObjFolderItem := ObjFolderItems.Item(_FileName); ObjVerbs := ObjFolderItem.Verbs; i := -1; total := ObjVerbs.Count; REPEAT i += 1; IF i < total THEN BEGIN ObjVerb := ObjVerbs.Item(i); Nombre := ObjVerb.Name; END; UNTIL (STRPOS(UPPERCASE(ObjVerb.Name), 'PRINT') > 0) OR (i > total); IF i <= total THEN BEGIN ObjVerb.DoIt; END ELSE ERROR('The file %1, can't be printed', _FileName);
// This is the SplitName function SplitName(Fichero : Text[1024];VAR Path : Text[1024];VAR Nombre : Text[1024]) Fichero1 := Fichero; Pos := STRPOS(Fichero1, '\'); Donde := Pos; WHILE Pos <> 0 DO BEGIN Fichero1 := COPYSTR(Fichero1, Pos+1); Pos := STRPOS(Fichero1, '\'); Donde := Donde + Pos; END; Path := COPYSTR(Fichero, 1, Donde); Nombre := COPYSTR(Fichero, Donde+1);
// Automation Vars the rest are Text or Integer ObjShell Automation 'Microsoft Shell Controls And Automation'.Shell ObjFolder Automation 'Microsoft Shell Controls And Automation'.Folder ObjFolderItems Automation 'Microsoft Shell Controls And Automation'.FolderItems ObjFolderItem Automation 'Microsoft Shell Controls And Automation'.FolderItem ObjVerbs Automation 'Microsoft Shell Controls And Automation'.FolderItemVerbs ObjVerb Automation 'Microsoft Shell Controls And Automation'.FolderItemVerb
Answers
Must be like this
https://juhl.blog/2017/04/15/first-blog-post/
Call a pdf reader that has print silent parameters.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I get a C/AL Error on execution of the code with this line: The error say "No Instance created for the Automation".
Any idea why?
Could you post all the code before that line ??
Regards.