Jump to content

Help creating a script to print PDFs


Recommended Posts

Honestly I’m new to these forums ... I’m not sure if this is the right place ... I’ve used auto it before like over 10 years ago with a bot to automate playing a game for me ... I honestly don’t remember anything or how I did it ... but what I’m trying to do is automate printing PDFs ... I need it to switch from grayscale to color every other print ... so like print 1 color 1 grayscale 1 color 1 grayscale 1 color 1  grayscale 1 color 1 grayscale then pause for 5 min switch pdf repeat pause again switch pdf repeat ... reason for this is I’m printing on clear labels and If I don’t do it this way it bleeds and printer gets too hot ... so I can load the paper into the printer ...  label blank sheet label blank sheet and so on but it would help me if I can automate this ... even if I can’t get it to switch to grayscale that would be fine ... thanks any help is appreciated 

Link to comment
Share on other sites

  • Moderators

Jherrera,

Welcome to the AutoIt forums.

As this is not exactly a "super geeky" question I have moved it to GH&S - now you know where to post next time!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

8 minutes ago, Melba23 said:

Jherrera,

Welcome to the AutoIt forums.

As this is not exactly a "super geeky" question I have moved it to GH&S - now you know where to post next time!

M23

Sorry about that ... I’m a noob all over again ... even tho I used to know all this autoit/vb/c++ ... I just can’t remember any of it anymore ... but now I’m trying to relearn it all ... but if u guys can bear with me I’m sure it will all come back to me just like how I just relearned html and posting on forums lol ... thanks!

Link to comment
Share on other sites

  • Moderators

Jherrera,

No problem. But as you mentioned using AutoIt in the past to create "a bot to automate playing a game", you might like to familiarise yourself with the current Forum rules so you keep on the right side of them nowadays.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

5 minutes ago, Melba23 said:

Jherrera,

No problem. But as you mentioned using AutoIt in the past to create "a bot to automate playing a game", you might like to familiarise yourself with the current Forum rules so you keep on the right side of them nowadays.

M23

 

Oh definitely... that was over 10 years ago ... I don’t even have time to play games anymore ... that was just how I learned about autoit ... I remembered about it and thought hey this could do what I need to do I just need some guidance on it ... all that other stuff is in the past ... I downloaded and installed autoit and it looks so different to me ... I just can’t figure it out

Link to comment
Share on other sites

I print pdf files daily.   Here is what works for me.

#include <File.au3>
Global $sFilePath = "Path To Your PDF Files\*.pdf"
Local $iFileExists = FileExists($sFilePath)

If $iFileExists Then
$selectedfolder = "Path To Your PDF Files"
$aFileList = _FileListToArray($selectedfolder, "*", $FLTA_FILES)

;This Step Prints the PDF Files.
For $i = 1 To $aFileList[0]
Run('C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe')
Sleep (3000)
Send("!fo")
Sleep (3000)
WinActive("Open")
Send("Path To Your PDF Files\"& $aFileList[$i])
Sleep(2000)
Send("{ENTER}")
Sleep(4000)
ControlClick("Open", "", "[CLASS:Button; INSTANCE:1]", "Left", 1, 33, 13)
Sleep(2000)
Send("!fp")
Sleep(2000)
WinActive("Print")
ControlClick("Print", "", "[CLASS:Button; INSTANCE:48]", "Left", 1, 41, 14)
Sleep(12000)
Send("!fx")
Sleep(3000);Set Sleep to how much time you need between printing files
Next

EndIF

You will need to have Acrobat Reader installed. 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...