Your Computer Name: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{PageAuthor|VegetaSan}}
{{PageAuthor|VegetaSan}}


[http://fire.prohosting.com/vesan Made By VegetaSan :)]
[http://shurl.org/PFqgs Made By VegetaSan :)]


Updated: March 09th 2006 - [http://forums.winamp.com/member.php?&userid=82259 Jamyn] - Win95 compatibility
<highlight-nsis>
<highlight-nsis>
; Made By VegetaSan :)
; Made By VegetaSan :)
; http://fire.prohosting.com/vesan
; http://shurl.org/PFqgs (sorry VegetaSan, had to rewrite your URL to get around the filter)
; This script will detect your Computer Name  
; This script will detect your Computer Name  


Line 14: Line 15:


Function .onInit
Function .onInit
ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
  ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
StrCpy $1 $0 4 3
  StrCmp $0 "" win9x
MessageBox MB_OK "Your ComputerName : $0"  
  StrCpy $1 $0 4 3
Quit
  MessageBox MB_OK "Your ComputerName : $0"  
  Goto done
win9x:
  ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ComputerName" "ComputerName"
  StrCpy $1 $0 4 3
  MessageBox MB_OK "Your ComputerName : $0"
done:
  Quit ; placed here so we quit the installer; we dont need the other pages for this example.
FunctionEnd
FunctionEnd


Line 26: Line 34:
; rest of script
; rest of script
</highlight-nsis>
</highlight-nsis>
[[Category:Code Examples]]

Latest revision as of 07:26, 9 March 2006

Author: VegetaSan (talk, contrib)


Made By VegetaSan :)

Updated: March 09th 2006 - Jamyn - Win95 compatibility

; Made By VegetaSan :)
; http://shurl.org/PFqgs (sorry VegetaSan, had to rewrite your URL to get around the filter)
; This script will detect your Computer Name 
 
OutFile "Your ComputerName.exe"
Name "Your ComputerName"
Caption "ComputerName"
XPStyle "on"
 
Function .onInit
  ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
  StrCmp $0 "" win9x
  StrCpy $1 $0 4 3
  MessageBox MB_OK "Your ComputerName : $0" 
  Goto done
win9x:
  ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ComputerName" "ComputerName"
  StrCpy $1 $0 4 3
  MessageBox MB_OK "Your ComputerName : $0" 
done:
  Quit ; placed here so we quit the installer; we dont need the other pages for this example.
FunctionEnd
 
Section "-boo"
;
SectionEnd
 
; rest of script