everyday logon and print

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

everyday logon and print

Post by timle » Tue Oct 01, 2019 10:23 pm

Hello,
I would like to at certain time of day open the same document and print. I can do that with script but It doesn't run if the computer is logoff

Thank you

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1380
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: everyday logon and print

Post by Dorian (MJT support) » Wed Oct 02, 2019 1:42 pm

Hi,

I think this article might answer your question : https://help.mjtnet.com/article/14-why- ... logged-out
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: everyday logon and print

Post by JRL » Wed Oct 02, 2019 7:20 pm

Hi timle,
Though its true that UI events can't be performed while your screen is locked, non-UI events can. If you can find a way to print your documents from a command line they can be printed while the screen is locked. To demonstrate, the following script will lock your screen and print a test document to your default printer while the screen is locked using WordPad. Wordpad can also print .doc and .docx files. Also note there is a difference between "logged off" and "locked screen". If you are logged off, your user session is not running so none of your applications, including Macro Scheduler, are not running. Command line printing will only work if you are "logged in" but your screen is locked like in the case of pressing WinKey + L.

Code: Select all

//Will lock workstation.  Same as pressing WinKey+L
RunProgram>cmd /c rundll32.exe user32.dll, LockWorkStation
//
//Wait for screen to be locked.
Wait>10
//
DeleteFile>%desktop_dir%\test.rtf
//
//Save TEST.RTF file to desktop
LabelToVar>Testing,vdata
WriteLn>%desktop_dir%\test.rtf,wres,vData
Wait>1
//
//Print the file from command line using WordPad
//Wordpad will also print .DOC and .DOCX files
RunProgram>C:\Program Files\Windows NT\Accessories\Wordpad.exe %desktop_dir%\test.rtf /p
//
//
/*
Testing:
{\rtf1\ansi\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Riched20 10.0.18362}\viewkind4\uc1 
\pard\sa200\sl276\slmult1\f0\fs22\lang9 This is a test\par
\par
}
*/

timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

Re: everyday logon and print

Post by timle » Wed Oct 02, 2019 7:42 pm

thank you

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts