Combine PDF files with a context menu option

I needed a way to quickly combine two or more PDF files without having to run a program or click mutiple times. This solution basically allows you to right click and automatically combine your PDF files then delete them once it’s finished combining.

First download a program called pdftk, once installed head over to where you actually installed it, copy two files; “pdftk.exe” and “libiconv2.dll” to a new folder (preferably where you will not accidently delete it).

Create a new text file and rename it to “PDF Combine.cmd”, edit the batch file and copy paste the below code:

@echo off
setlocal enabledelayedexpansion

for /f “tokens=2 delims==+-” %%i in (‘WMIC OS Get LocalDateTime /value ^| findstr “=”‘) do (
set _Date=%%i
set YY=!_Date:~2,2!
set MM=!_Date:~4,2!
set DD=!_Date:~6,2!
set HH=!_Date:~8,2!
set MIN=!_Date:~10,2!
set SS=!_Date:~12,2!
)
set today=20%YY%-%MM%-%DD%-%HH%%MIN%%SS%

FOR %%A IN (%*) DO (set command=!command! %%A)
D:\pdftk\pdftk.exe %command% cat output “%~dp1CombinedScan_%today%.pdf”

del %command%

The output file names for mine is “CombinedScan_DATE&TIME.pdf”. Make relavent changes preffered to you and save.

Now we want to set up the context menu for it so you can right click on files.

  1. Right click on your “PDF Combine.cmd” file, create a shortcut.
  2. Press your Windows key + R to bring up your run dialog. Type “shell:sendto”, which should open up your Windows SendTo folder. Move your shortcut you just created to this folder and feel free to rename your shortcut to whatever you prefer, I personally named it “Combine PDF’s”.

Now go ahead and test your automated method out. I recommend you use some spare PDF’s that are backups just in case you did something wrong. If you prefer to just skip downloading and copying the files, I’ve done that already and made a zip folder for you below.

Download pdftk.

RMS syntax support for Notepad++ (UDL)

So I wrote a guide on Steam on syntax colouring for Random Map Scripting for Notepad++, the scripting language to write random maps on Age of Empires. Essentially Notepad++ supports language syntax support, allowing you to make syntax easier on the eye.

So you’re writing a random map script, using standard default Notepad (that comes with Windows), it would look like this:
notepad

With Notepad++ and syntax colouring (User Defined Language Files) enabled, it will look like this:
notepad++

So you get the drift, basically giving you a clearer visual on your code and possibly preventing errors in them as well.

You can see the guide here:
http://steamcommunity.com/sharedfiles/filedetails/?id=439948511

Batch file – How to simply get yesterdays date (or any date) from the current computer date

Batch files are a nice and simple way on Windows to create one click solutions for tasks that you do on a regular basis. In my case, I wanted to find a quick and simple way to create a file I create on a daily basis and add the current date on it when I create it at the same time, of course as quick as possible.

I have a master file I want to copy it from, so with that I do:

@ECHO OFF
COPY “C:\Users\Savas\Desktop\Testfolder\masterfile.txt” /y
ren “masterfile.txt” “File1 – %date:/=.%.txt”

There’s obviously many ways to do this above so you can choose your way suited for you.. The result will basically be creating a file in the same folder as the .BAT file I created, it will name the file “File1 – date.txt” Because my computer date is set to 27/04/2015 standard (you can find this out by simply doing “echo %date%” and the result should tell you your date format. Simple!

Now what about yesterdays date, as far as I can find, there doesn’t seem to be a simple one line way to just do yesterday date.. So we have to set some variables and have the batch file get the date in DD format then minus off one day and then join the date back together.

set yyyy=%date:~6,4%
set mm=%date:~3,2%
set dd=%date:~0,2%

@set b=1
@set /a c=%dd%-%b%

COPY “C:\Users\Savas\Desktop\Testfolder\testfile.txt” /y
ren “testfile.txt” “File 2 – %c%.%mm%.%yyyy%.txt”

The %dd% takes the date and then takes off all, but the DD format. So instead of having 27/04/2015, we end up with just 27. Then “@set /a c=%dd%%b%” line simply takes the number 27 and minuses the number in the “@set b=1” variable, and in this case it’s “1” so we end up with the result in %c% declaration. Put the month and year and we have the date for yesterday!

Of course if you’re using these batch files on separate systems and these systems have different date formats, you’re going to reach some minor issues and that means you’ll need to be more specific with your date formatting. In my case, 6,4% takes a sub string, starting at position 8, and keeping 4, which is 6,4.

27/04/2015

In my case, I don’t have this issue, I don’t need my batch file to be some complicated and long winded method to pull the date and when I create my file, I will see if the date is wrong immediately. I hope this helped.