Jump to content
Ketarin forum

Function examples


MadDog
 Share

Recommended Posts

[h]Syntax for functions[/h]

 

{variable:function:argument1:argument2}

 

 

[h]Replace[/h]

 

version = 9.1.15

{version:replace:.:} = 9115

{version:replace:.:-} = 9-1-15

 

 

[h]Trim[/h]

version = " 9.1.15."

{version:trim} = 9.1.15.

{version:trim:.} = " 9.1.15"

{version:trim: .} = 9.1.15

 

 

[h]Trimend/Trimstart[/h]

version = 9.1.15.

{version:trimend:.} = 9.1.15

{version:trimstart:9.} = 1.15.

 

 

[h]ToUpper/ToLower[/h]

download = http:\\TEST

{download:toupper} = HTTP:\\TEST

{download:tolower} = http:\\test

 

 

[h]Split[/h]

 

version = 9.1.15

{version:split:.:0} = 9

{version:split:.:1} = 1

{version:split:.:2} = 15

{version:split:.:0}-{version:split:.:1} = 9-1

 

 

[h]Example #1[/h]

 

version = 9.0

 

hxxp://ardownload.adobe.com/pub/adobe/reader/win/{version:split:.:0}.x/{version}/deu/AdbeRdr{version:replace:.:}_de_DE.exe

 

results in

 

hxxp://ardownload.adobe.com/pub/adobe/reader/win/9.x/9.0/deu/AdbeRdr90_de_DE.exe

 

 

[h]Example #2[/h]

 

version = 4.2.9

 

hxxp://download2.asap-utilities.com/ASAPUtilities_setup_{version:replace:.:-}.exe

 

results in

 

hxxp://download2.asap-utilities.com/ASAPUtilities_setup_4-2-9.exe

 

 

[h]Example #3[/h]

 

version = 9.1.15 build 963

 

c:\MyFiles\Applicationname_{version:split: :0}b{version:split: :2}.exe

or

c:\MyFiles\Applicationname_{version:replace: build :b}.exe

 

results in

 

c:\MyFiles\Applicationname_9.1.15b963.exe

Edited by MadDog
Link to comment
Share on other sites

Thanks MadDog for your effort... you will forever be known as the author of the 1st user-contributed tips/tutorial post in the Ketarin Tips and Tutorials forum. ;) You will live forever in our hearts! :D I feel we should have offered a prize or something! I hope you will be content with just being famous! ;)

Link to comment
Share on other sites

  • 1 year later...

thank you very much!

 

i've got a question...precisely regarding adobe reader, actually

 

Example #1

version = 9.0

 

hxxp://ardownload.adobe.com/pub/adobe/reader/win/{version:split:.:0}.x/{version}/deu/AdbeRdr{version:replace:.:}_de_DE.exe

 

results in

 

hxxp://ardownload.adobe.com/pub/adobe/reader/win/9.x/9.0/deu/AdbeRdr90_de_DE.exe

 

this is fine for 9.0, but now with 9.3, the filename/url becomes hxxp://ardownload.adobe.com/pub/adobe/reader/win/9.x/9.3/deu/AdbeRdr930_de_DE.exe, but the version is reported as 9.3...so how can i get the extra 0 in the filename?

 

thanks a lot!

Link to comment
Share on other sites

hi, not german actually....i just copied what was in the first post :P

 

i'm actually looking to download the traditional chinese and simplified chinese versions, as they come in handy sometimes...

 

that said, i didn't know adobe reader has multi-language support these days. so presumably i can get traditional and simplified chinese as well that way?

 

thanks a lot!

Link to comment
Share on other sites

  • 2 months later...

The problem here can be resolved by being more selective with what data you use to feed the URL in the filename.

 

For Adobe Reader, use the FileHippo tech page:

http://www.filehippo.com/download_adobe_reader/tech/

 

Use a regexp parse for {version} with:

Adobe\sReader\s([\d\.]+)\<\/td\>

 

Use a regexp parse for {filepre} with:

<td>(AdbeRdr\d+)_

 

Then use the following pattern matching for the installer:

hxxp://ardownload.adobe.com/pub/adobe/reader/win/{version:split:.:0}.x/{version}/enu/{filepre}_en_US.exe

 

Replace "enu", "en" and "US" with your language code 3-char, language code 2-char and country code if you don't want the English/US version.

Link to comment
Share on other sites

  • 3 weeks later...

I can't figure out how to use the functions :(

 

I am trying to get the BitDefender Rescue CD from http://download.bitdefender.com/rescue_cd/

 

I have the version set to href="BitDefenderRescueCD_v.2.0.0_5_10_2010.iso

 

now I want to trim the

 

href="

 

part from the beginning so that I end up with:

 

BitDefenderRescueCD_v.2.0.0_5_10_2010.iso

 

everything I have tried has failed :(

 

can anyone please help me? also if you could explain how to do it with other means that would be great too

Link to comment
Share on other sites

  • 1 year later...
Guest bilou_gateux
The problem here can be resolved by being more selective with what data you use to feed the URL in the filename. For Adobe Reader, use the FileHippo tech page: http://www.filehippo...be_reader/tech/ Use a regexp parse for {version} with: Adobe\sReader\s([\d\.]+)\<\/td\> Use a regexp parse for {filepre} with: (AdbeRdr\d+)_ Then use the following pattern matching for the installer: hxxp://ardownload.adobe.com/pub/adobe/reader/win/{version:split:.:0}.x/{version}/enu/{filepre}_en_US.exe Replace "enu", "en" and "US" with your language code 3-char, language code 2-char and country code if you don't want the English/US version.

Thanks shawn for the guidelines.

 

Latest release from the 9 series not listed on filehippo

 

For Adobe Reader 9, use the Adobe KB page:

http://kb2.adobe.com/cps/498/cpsid_49880.html

 

Use a regexp parse for {version} with:

Adobe\sReader\s([\d\.]+)\sis\sa\sfull\sinstaller.

 

Use a regexp parse for {filepre} with:

>(AdbeRdr9\d+)_

 

Then use the following pattern matching for the installer:

hxxp://ardownload.adobe.com/pub/adobe/reader/win/{version:split:.:0}.x/{version}/en_US/{filepre}_en_US.exe

 

Replace "en_US", with your langID code if you don't want the English/US version.

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.