Guest User

Untitled

a guest
Jan 11th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. !include nsDialogs.nsh
  2. !include LogicLib.nsh
  3. !include MUI2.nsh
  4.  
  5. Name nsDialogs
  6. OutFile nsDialogs.exe
  7. RequestExecutionLevel user
  8. ShowInstDetails show
  9.  
  10. Var Dialog
  11. Var TextUser
  12. Var TextPass
  13. Var TextDbName
  14. Var TextPgDir
  15.  
  16. Page custom pgPageCreate pgPageLeave
  17. !insertmacro MUI_PAGE_INSTFILES
  18.  
  19. !insertmacro MUI_LANGUAGE "English"
  20.  
  21. Function pgPageCreate
  22. !insertmacro MUI_HEADER_TEXT "Database Settings" "Provide PostgreSQL config and install directory."
  23.  
  24. nsDialogs::Create 1018
  25. Pop $Dialog
  26.  
  27. ${If} $Dialog == error
  28. Abort
  29. ${EndIf}
  30.  
  31. ${NSD_CreateGroupBox} 10% 10u 80% 62u "PostgreSQL Database Settings"
  32. Pop $0
  33.  
  34. ${NSD_CreateLabel} 20% 26u 20% 10u "Username:"
  35. Pop $0
  36.  
  37. ${NSD_CreateText} 40% 24u 40% 12u "postgres"
  38. Pop $TextUser
  39.  
  40. ${NSD_CreateLabel} 20% 40u 20% 10u "Password:"
  41. Pop $0
  42.  
  43. ${NSD_CreatePassword} 40% 38u 40% 12u ""
  44. Pop $TextPass
  45.  
  46. ${NSD_CreateLabel} 20% 54u 20% 10u "New Database:"
  47. Pop $0
  48.  
  49. ${NSD_CreateText} 40% 52u 40% 12u "mydb"
  50. Pop $TextDbName
  51.  
  52. ${NSD_CreateGroupBox} 5% 86u 90% 34u "PostgreSQL Install Path"
  53. Pop $0
  54.  
  55. ${NSD_CreateDirRequest} 15% 100u 49% 12u "$PROGRAMFILES64\PostgreSQL\10"
  56. Pop $TextPgDir
  57.  
  58. ${NSD_CreateBrowseButton} 65% 100u 20% 12u "Browse..."
  59. Pop $0
  60. ${NSD_OnClick} $0 OnDirBrowse
  61.  
  62. nsDialogs::Show
  63. FunctionEnd
  64.  
  65. Function OnDirBrowse
  66. ${NSD_GetText} $TextPgDir $0
  67. nsDialogs::SelectFolderDialog "Select Postgres Directory" "$0"
  68. Pop $0
  69. ${If} $0 != error
  70. ${NSD_SetText} $TextPgDir "$0"
  71. ${EndIf}
  72. FunctionEnd
  73.  
  74. Function PgPageLeave
  75. ${NSD_GetText} $TextUser $0
  76. ${NSD_GetText} $TextPass $1
  77. ${NSD_GetText} $TextDbName $2
  78. ${NSD_GetText} $TextPgDir $3
  79. MessageBox MB_OK "User: $0, Pass: $1, Db: $2, PgDir: $3"
  80. FunctionEnd
  81.  
  82. Section
  83. DetailPrint "Hello, World!"
  84. SectionEnd
Add Comment
Please, Sign In to add comment