Get URL segments for Joel's Internet plugin: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.)
m (Adding new author and category links.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{|align=right
{{PageAuthor|Afrow UK}}
|<small>Author: [[{{ns:2}}:Afrow UK|Afrow UK]] ([[{{ns:3}}:Afrow UK|talk]], [[{{ns:-1}}:Contributions/Afrow UK|contrib]])</small>
 
|}
<br style="clear:both;">
== Description ==
== Description ==
This function will slice up a URL for use with Joel's Internet.dll plugin.
This function will slice up a URL for use with Joel's Internet.dll plugin.
Line 60: Line 58:


-Stu
-Stu
[[Category:Internet Functions]]

Latest revision as of 12:20, 24 June 2005

Author: Afrow UK (talk, contrib)


Description

This function will slice up a URL for use with Joel's Internet.dll plugin.

Usage

Push "http://hmd.hostileintent.org/database/mapupdater.txt"
 Call ParseURL
Pop $R1
Pop $R0
 
# $R1 = database/mapupdater.txt
# $R0 = hmd.hostileintent.org
 
Internet::GetUrlCode $R0 $R1 $0
DetailPrint $0 # print URL code

The Function

Function ParseURL
 Exch $R0 ; url
 Push $R1
 Push $R2
 Push $R3
 
 StrCpy $R2 0
 Loop1:
  IntOp $R2 $R2 + 1
  StrCpy $R1 $R0 1 $R2
  StrCmp $R1 "" Done
  StrCmp $R1 "/" 0 Loop1
   IntOp $R2 $R2 + 2
   StrLen $R1 $R0
   IntOp $R2 $R1 - $R2
   StrCpy $R0 $R0 "" -$R2
 StrCpy $R2 0
 Loop2:
  IntOp $R2 $R2 + 1
  StrCpy $R1 $R0 1 $R2
  StrCmp $R1 "" Done
  StrCmp $R1 "/" 0 Loop2
   StrCpy $R1 $R0 $R2
   IntOp $R2 $R2 + 1
   StrLen $R3 $R0
   IntOp $R2 $R3 - $R2
   StrCpy $R0 $R0 "" -$R2
 Done:
 
 Pop $R3
 Pop $R2
 Exch $R1 ; address
 Exch
 Exch $R0 ; rest
FunctionEnd

-Stu