|
Answer» Dear Users
I have lot of pdf books. How can I make a library in my system like add pdf books some kind of home page appears and when I click any book it opensI took a more low level approach and used batch as the coding language. Ugly but serviceable. Python, Rexx (Classic or Object), Javascript, VBScript, and others could also be used with the same approach. Powershell (Windows or Core but not v6.x) or even a HTA (using Vbscript or JScript or both) could be used if you wanted a GUI.
CODE: [Select]@echo off :: ------------------------------------------------------------- :: Script: Library :: Author: Sidewinder :: Date: 07/06/2020 :: Comment: PDF Catalog SELECTOR :: Update: :: ------------------------------------------------------------- setlocal enabledelayedexpansion pushd g:\COM\Documents set x=0
for /f "delims=" %%i in ('dir /b *.pdf') do ( call set /a x+=1 call set item.%%x%%=%%~dpnxi call echo !x!. %%~ni )
echo. set /p sel=Enter Selection: if %sel% EQU 0 goto terminate if %sel% GTR !x! goto error if %sel% LSS 0 goto error
!item.%sel%! goto terminate
:error echo Selection Out Of Range :terminate popd
Change the name of the folder on line 10 and you should be good to go. Script uses a single folder for the pdf files, but if they live in multiple folders, the code can be tweaked to handle it.
Good luck. Hope this gives you some ideas Will it show the pdf books like catalog?? with book cover page images and which language is best to support itHi,
Code: [Select]Will it show the pdf books like catalog?? with book cover page images
Did you run the script? All it does is print an on-screen menu of the pdf files it found. Each book is numbered so all the user needs to do is select one. There are no thumbnails. When a selection is made the book is opened the same as if the user used Windows Explorer and double clicked the file.
Code: [Select]which language is best to support it
Not sure what this means. The script is WRITTEN in batch language. Save the script on your disk with any name and a .bat or .cmd extension. Open a command prompt, navigate to the folder where the file is saved and run it.
A few notes: If user selects 0 then no selection is made and the script ends QUIETLY. If the selection made is greater than the number of books or less than zero, an error is thrown and then script ends quietly.
The pdf file is opened with the program associated with the pdf extension. If there is no association, you may have to add a path and program name to: !item.%sel%!
Happy Motoring
|