You are here: PSPad forum > English discussion forum > How to Advanced link generation.

How to Advanced link generation.

Goto Page: 1 2 3 Next

#1 How to Advanced link generation.

Posted by: maki | Date: 2020-01-10 19:23 | IP: IP Logged

How to Advanced link generation.

Example:
h--ps://example.com/2019/01/01/9999
h--ps://example.com/2019/01/02/9999
h--ps://example.com/2019/01/03/9999
h--ps://example.com/2019/12/01/9999

Generate all combinations according to the formula/template.
example.com/YEAR/MONTH/DAY/XXXX

XXXX -> 1 to 9999

Edited 1 time(s). Last edit at 2020-01-10 19:33 by maki.

Options: Reply | Quote | Up ^


#2 Re: How to Advanced link generation.

Posted by: pspad | Date: 2020-01-10 19:27 | IP: IP Logged

in this case I would use Excel, create list of dates and using formula I would create your links.
Each solution has own tool hich is for some purposes better than others

Options: Reply | Quote | Up ^


#3 Re: How to Advanced link generation.

Posted by: maki | Date: 2020-01-10 19:39 | IP: IP Logged

If it's possible and it's easy, generate for me from 2000 to the end of 2020 and send me a text file. smiling smiley

Options: Reply | Quote | Up ^


#4 Re: How to Advanced link generation.

Posted by: pspad | Date: 2020-01-10 20:06 | IP: IP Logged

Do you understand, that one year means 365 * 9999 = 3 649 635 lines?
And you want it for 20 year? Over 60 milions lines?

Options: Reply | Quote | Up ^


#5 Re: How to Advanced link generation.

Posted by: pspad | Date: 2020-01-10 20:14 | IP: IP Logged

Use PSPad 32b with scripting support
Save contend of code into file .\PSPad\Scripts\VBScript\Maki-yearlink.vbs

' it will generate list of links
const module_name = "Maki-yearlinks"
const module_ver = "1.0"

sub MakiYearLinks()
setWaitCursor(True)
set obj = newEditor()
obj.NewFile()
s = "https://example.com/"
txt = ""
d = CDate("2000-01-01")
dto = CDate("2020-12-31")
while d <= dto
ss = s & datePart("yyyy", d) & "/" & right("0" & datePart("m", d), 2) & "/" & right("0" & datePart("d", d), 2) & "/"
' this part generates 1 to 9 links for each day. If you will run it for 1 .. 9999, you will end reach memory limit
' for i = 1 to 9
' txt = txt & ss & i & Chr(13) & chr(10)
' next

' next line add link without number on the end. If you will use FOR, comment it
txt = txt & ss & Chr(13) & chr(10)
d = DateAdd("d", 1, d)
wend
obj.selText(txt)
setWaitCursor(False)
end sub

' name "Init" is required, its called automatically during initialization to create menu items
sub Init
addMenuItem "&Maki year links","", "MakiYearLinks"
end sub

Edited 2 time(s). Last edit at 2020-01-10 20:16 by pspad.

Options: Reply | Quote | Up ^


#6 Re: How to Advanced link generation.

Posted by: maki | Date: 2020-01-10 20:15 | IP: IP Logged

Ah, I understand. Reduce it since 2006-2020.
But you can split the file into 1 million lines.

Options: Reply | Quote | Up ^


#7 Re: How to Advanced link generation.

Posted by: pspad | Date: 2020-01-10 20:18 | IP: IP Logged

Script above will generate it for you
when you will run it as is, it will generate links without xxxx
if you will uncomment it, it will generate links include numbers
but I suggest you to generate part of the year by part of the year

d = CDate("2000-01-01") = start date
dto = CDate("2020-12-31") = enddate

for i = 1 to 9 replace with 1 to 9999

If you will run it month by month, it will generate files with over 300 000 lines each and it will take ages.

Edited 1 time(s). Last edit at 2020-01-10 20:21 by pspad.

Options: Reply | Quote | Up ^


#8 Re: How to Advanced link generation.

Posted by: maki | Date: 2020-01-10 20:25 | IP: IP Logged

I don't remember how to enable the Script command in PSPad.

I know it will take long time in PSPad, but maybe there are other programs with a more efficient algorithm.

Options: Reply | Quote | Up ^


#9 Re: How to Advanced link generation.

Posted by: pspad | Date: 2020-01-10 20:34 | IP: IP Logged

If course there is. You can write it in VC++ or Delphi or another native compilling program

PSPad scripting uses Windows scripting hosts. So it's speed is Microsoft bussines, not a PSPad bussines.

Edited 1 time(s). Last edit at 2020-01-10 20:50 by pspad.

Options: Reply | Quote | Up ^


#10 Re: How to Advanced link generation.

Posted by: pspad | Date: 2020-01-10 20:35 | IP: IP Logged

But I don't understand what for do you need 70 millions links

Options: Reply | Quote | Up ^


Goto Page: 1 2 3 Next





Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR