;Copyright (C) 2006 John T. Haller ;Website: http://portableapps.com/ ;This software is OSI Certified Open Source Software. ;OSI Certified is a certification mark of the Open Source Initiative. ;This program is free software; you can redistribute it and/or ;modify it under the terms of the GNU General Public License ;as published by the Free Software Foundation; either version 2 ;of the License, or (at your option) any later version. ;This program is distributed in the hope that it will be useful, ;but WITHOUT ANY WARRANTY; without even the implied warranty of ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;GNU General Public License for more details. ;You should have received a copy of the GNU General Public License ;along with this program; if not, write to the Free Software ;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. !define NAME "ProxyGet" !define VER "0.0.1.1" !define WEBSITE "portableapps.com" !include LogicLib.nsh ;=== Program Details Name "${NAME}" OutFile "${NAME}.exe" Caption "Proxy Get Utility | PortableApps.com" VIProductVersion "${VER}" VIAddVersionKey FileDescription "Proxy Get Utility" VIAddVersionKey LegalCopyright "GPL" VIAddVersionKey Comments "Gets IE's proxy info and shows it onscreen. For additional details, visit ${WEBSITE}" VIAddVersionKey CompanyName "by John T. Haller of PortableApps.com" VIAddVersionKey OriginalFilename "${NAME}.exe" VIAddVersionKey FileVersion "${VER}" ;=== Runtime Switches CRCCheck On WindowIcon Off SilentInstall Silent AutoCloseWindow True ;=== Program Icon Icon "${NAME}.ico" ;=== Variables !define StrRep "!insertmacro StrRep" !macro StrRep ResultVar String SubString RepString Push "${String}" Push "${SubString}" Push "${RepString}" Call StrRep Pop "${ResultVar}" !macroend Function StrRep /*After this point: ------------------------------------------ $R0 = RepString (input) $R1 = SubString (input) $R2 = String (input) $R3 = RepStrLen (temp) $R4 = SubStrLen (temp) $R5 = StrLen (temp) $R6 = StartCharPos (temp) $R7 = TempStrL (temp) $R8 = TempStrR (temp)*/ ;Get input from user Exch $R0 Exch Exch $R1 Exch Exch 2 Exch $R2 Push $R3 Push $R4 Push $R5 Push $R6 Push $R7 Push $R8 ;Return "String" if "SubString" is "" ${IfThen} $R1 == "" ${|} Goto Done ${|} ;Get "RepString", "String" and "SubString" length StrLen $R3 $R0 StrLen $R4 $R1 StrLen $R5 $R2 ;Start "StartCharPos" counter StrCpy $R6 0 ;Loop until "SubString" is found or "String" reaches its end ${Do} ;Remove everything before and after the searched part ("TempStrL") StrCpy $R7 $R2 $R4 $R6 ;Compare "TempStrL" with "SubString" ${If} $R7 == $R1 ;Split "String" to replace the string wanted StrCpy $R7 $R2 $R6 ;TempStrL ;Calc: "StartCharPos" + "SubStrLen" = EndCharPos IntOp $R8 $R6 + $R4 StrCpy $R8 $R2 "" $R8 ;TempStrR ;Insert the new string between the two separated parts of "String" StrCpy $R2 $R7$R0$R8 ;Now calculate the new "StrLen" and "StartCharPos" StrLen $R5 $R2 IntOp $R6 $R6 + $R3 ${Continue} ${EndIf} ;If not "SubString", this could be "String" end ${IfThen} $R6 >= $R5 ${|} ${ExitDo} ${|} ;If not, continue the loop IntOp $R6 $R6 + 1 ${Loop} Done: ;Return output to user StrCpy $R0 $R2 /*After this point: ------------------------------------------ $R0 = ResultVar (output)*/ Pop $R8 Pop $R7 Pop $R6 Pop $R5 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Exch $R0 FunctionEnd Section "Main" ;=== Check http registry ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings" "ProxyEnable" StrCmp $0 0 NoProxy ReadRegStr $1 HKCU "Software\Microsoft\Windows\CurrentVersion\Internet Settings" "ProxyServer" ${StrRep} $2 $1 ";" "$\n" ${StrRep} $3 $2 ":" " port " MessageBox MB_OK|MB_ICONINFORMATION `This computer's proxy settings:$\n$\n$3$\n$\nThis Proxy Get Utility is made available by the friendly folks at PortableApps.com` Goto TheEnd NoProxy: MessageBox MB_OK|MB_ICONINFORMATION `There is no proxy enabled on this computer.$\n$\nThis Proxy Get Utility is made available by the friendly folks at PortableApps.com` TheEnd: SectionEnd