Get "My Documents" folder path: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(SF: Lobo Lunar -> Joel.)
(FF: Made code be smaller in width.)
Line 14: Line 14:


Function "GetMyDocs"
Function "GetMyDocs"
ReadRegStr $0 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" Personal
  ReadRegStr $0 HKCU \
            "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" \
            Personal
FunctionEnd
FunctionEnd


Function .onInit
Function .onInit
Call "GetMyDocs"
  Call "GetMyDocs"
MessageBox MB_OK|MB_ICONINFORMATION $0
  MessageBox MB_OK|MB_ICONINFORMATION $0
Quit
  Quit
FunctionEnd
FunctionEnd


Section -Ghost
Section -Ghost
; Nothing here, :p
  ; Nothing here, :p
Sectionend
Sectionend
</highlight-nsis>
</highlight-nsis>


Page author: [[User:Joelito|Joelito]]
Page author: [[User:Joelito|Joelito]]

Revision as of 15:52, 27 April 2005

Description

Superseded by: NSIS RC1 - $DOCUMENTS variable.

This script detects the user's "My Documents" folder path.

The Script

; This Function will display "My Documents" Folder path.
; Now it suppose to work with multiple users.
; Created by Joel
 
Name "Get My Documents Path"
OutFile "GetMyDocPath.exe"
 
Function "GetMyDocs"
  ReadRegStr $0 HKCU \
             "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" \
             Personal
FunctionEnd
 
Function .onInit
  Call "GetMyDocs"
  MessageBox MB_OK|MB_ICONINFORMATION $0
  Quit
FunctionEnd
 
Section -Ghost
  ; Nothing here, :p
Sectionend

Page author: Joelito