// Recently, the company uses ASP SQL development office automation OA, which requires the production of installations. This script is made with IS9.0 to share, and learn from all colleagues. #Define Bitmap_ID 1
#include "ifx.h" // cannot be moved
Prototype CreateWebsite (String, String); // Create an IIS Site Prototype Createvirtualdir (String); // Creating a Virtual Directory Prototype CreateDatabase (String, String, String); // Create SQL Database Prototype Checkiis (); // Example: Check System Whether to install IIS
STRING TMP_PRODUCT_NAME, TMP_PRODUCT_VERSION, TMP_COMPANY_NAME, TMP_PRODUCT_KEY, TMP_TITLE_CAPTIONBAR; STRING globalstr, destdir, destsvr, destsa, destpw; NUMBER nvFileHandle, nvFileHandlebak, asaline; BOOL iscreatedb; STRING nSetupType, szSQLsvr, szSQLusr, szSQLpwd, szSQLsvrDefault, szSQLusrDefault, szSQLpwdDefault; STRING szADsvr, Szadusr, szadpwd, szadusrdefault, szadpwddefault; string szaddomain, szadou, szaddomainDefault, szadoudefault, addc1; string svname, svcompany, svserial;
Function onfirstuibefore ()
NUMBER nResult, nOpt, svEdit1, svEdit2; STRING szTitle, szMsg, szBmpPath; STRING szLicenseFile, szQuestion; STRING szServerIP, szServerPort, szServerIPDefault, szServerPortDefault; STRING szFile, szTargetPath, szDir, szfolder; STRING szComponents, szTargetdir; STRING szField1, szField2; STRING szDefault, svResult; OBJECT piisObj; LIST list, listStartCopy; NUMBER nLevel, nvSize; begin TMP_PRODUCT_NAME = "XXX e-government platform"; TMP_PRODUCT_VERSION = "V2.0"; TMP_COMPANY_NAME = "XXX company"; TMP_PRODUCT_KEY = "88888888"; TMP_TITLE_CAPTIONBAR = "0";
szBmpPath = SUPPORTDIR ^ "left.bmp"; DialogSetInfo (DLG_INFO_ALTIMAGE, szBmpPath, FALSE); // set the image on the left // To Do: if you want to enable background, window title, and caption bar title SetTitle (@TITLE_MAIN, 24 , WHITE); SetTitle (@TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION); Enable (FULLWINDOWMODE); Enable (BACKGROUND); SetColor (BACKGROUND, RGB (0, 128, 128)); PlaceBitmap (szBmpPath, BITMAP_ID, 0, 0, FULLSCREEN) ; // Default Set Targetdir = "C:" ^ "inetpub" ^ @ folder_name; szdir = targetdir; shell_Object_folder = @folder_name; svname = ""; svcompany = "; svserial =" 88888888 "; if (Checkiis == 1) THEN // Example: Check if IIS // MessageBox ("I have installed IIS, installation!"; Goto dlg_start; Else MessageBox ("The system is not installed IIS, please install IIS first ! ", Warning); goto end_all_install; // End Installed Endif; DLG_START: / / Start dialog DLG_SDWELCOME: // Welcome dialog SZTITLE =" Welcome to install " TMP_PRODUCT_NAME " " TMP_PRODUCT_VERSION; SZMSG =" "; NResult = Sdwelcome (Sztitle, Szmsg); IF (NRE SULT = BACK) GOTO DLG_START; DLG_SDLICENSE: // Software License Agreement dialog SzlicenseFile = SupportDir ^ "license.txt"; sztitle = "End User License Agreement"; SZMSG = ""; Szquesion = ""; NRESULT = SDLICENSE (Sztitle , szMsg, szQuestion, szLicenseFile); if (nResult = BACK) goto Dlg_SdWelcome; Dlg_SdShowInfoList: // readme file dialog szFile = SUPPORTDIR ^ "infolist.txt"; list = ListCreate (STRINGLIST); ListReadFromFile (list, szFile); szTitle =
"System Information Overview"; SZMSG = "System Overview"; NRESULT = SDShowInfolist (Sztitle, SZMSG, List); ListDestroy (List); if (NRESULT = BACK) GOTO DLG_SDLICENSE; DLG_SDREGISTERUSEREX: // User Information dialog Szmsg = "" ; Sztitle = "User Information Registration"; svcompany = "xxx province"; svserial = "xxx unit"; NRESULT = SDREGISTERUSEREX (Sztitle, SZMSG, SVNAME, SVCCompany, svserial); if (NRESULT = BACK) GOTO DLG_SDSHOWINFOLIST; // Check Serial number // if (chk_serial (svcompany, svserial <0) THEN / / GOTO DLG_SDREGISTERUSEREX; / / ENDIF; // Check the serial number DLG_INPUTADMIN: // Set the IP and User name sztitle = "setting directory of the AD directory server ( AD) Server "; SZMSG =" Now sets the IP, administrator account and password of the directory (AD) server; szquestion = "Please enter the administrator account and password of the directory (AD) server, the installer will follow you The IP address, account, and password are configured. If you provide an account or password error, the system will not use it normally! "; Szadsvr =" IP address: "; szadusr =" account: "; szadpwd =" password: "; szADsvrDefault =" 192.168.8.8 "; szADusrDefault =" Administrator "; szADpwdDefault =" "; setDialogTitle (DLG_ASK_TEXT, szTitle); nResult = SdShowDlgEdit3 (szTitle, szQuestion, szADsvr, szADusr, szADpwd, szADsvrDefault, szADusrDefault, szADpwdDefault); if (NRESULT = BACK) GOTO DLG_SDREGISTERUSEREX; DLG_INPUTADDOMAIN: // Sets the domain and organization of the AD directory server SZTITLE = "Settings Directory (SZMSG =" Now sets the domain name and organizational unit of the directory (AD) server "; szquestion =" Please enter the directory (AD) The complete domain name and organizational unit of the server, the installer will configure according to the information you provide.
This system will not be used normally if the information you provide is wrong. "; SzADDomain =" Full Domain: "; szADOU =" organizational units: "; szADDomainDefault =" xx.xx.com "; szADOUDefault =" XXX domain "; SetDialogTitle (DLG_ASK_TEXT, szTitle); nResult = SdShowDlgEdit2 (szTitle, szQuestion, SzadDomain, szadou, szadDomainDefault, szadoudefault; // domain name converted to 3 DC IF ((STRSUB (AddC1, Szaddomain, 0, StrfIndex (Szaddomain, ".", 0) 1)) <0) Then // Take only The first, back fixed MessageBox ("You entered the domain name is incorrect, please re-enter!", Warning); goto dlg_inputaddomain; Endif; if (nresult = back) goto DLG_SDREGISTERUSEREX; DLG_SETUPTYPE: // Installation Type dialog NSetuPType = "Fully installed"; sztitle = "Installation Type"; SZMSG = "Please select which way you need to install"; NRESULT = SDSETUPTYPEEX (Sztitle, Szmsg, ", NSETUPTYPE, 0); if (nresult = back) THEN GOTO DLG_SDREGISTERUSEREX; ENDIF; if (NSetuPType = "only master program") THEN GOTO DLG_SDASKDESTPATH; ENDIF; DLG_ASKSQL: // Setting Database Server dialog SZTITLE = "Setting SQL Database"; szmsg = "Now set the Microsoft SQL Server database system"; SzQuestion = "Please enter the username and password of the SQL Server database server, and the installer creates and optimizes the database system according to the IP address you provide and the username and password below.
If your username and password are wrong, the installer will automatically skip the settings of the data! "; SzSQLsvr =" host name: "; szSQLusr =" User Name: "; szSQLpwd =" Password: "; szSQLsvrDefault =" 192.168.8.8 "; szSQLusrDefault =" sa "; szSQLpwdDefault =" "; SetDialogTitle (DLG_ASK_TEXT, szTitle ); nResult = SdShowDlgEdit3 (szTitle, szQuestion, szSQLsvr, szSQLusr, szSQLpwd, szSQLsvrDefault, szSQLusrDefault, szSQLpwdDefault); if (nResult = BACK) goto Dlg_SetupType; Dlg_SdStartCopy: // start copying files dialog box szTitle = "Verify that the database information"; szMsg = "click Next to continue"; listStartCopy = ListCreate (STRINGLIST); ListAddString (listStartCopy, "user name:" svName, AFTER); ListAddString (listStartCopy, "the company name:" svCompany, AFTER); ListAddString (listStartCopy, " host name: " szSQLsvrDefault, AFTER); ListAddString (listStartCopy," user name: " szSQLusrDefault, AFTER); ListAddString (listStartCopy," Password: " szSQLpwdDefault, AFTER); ListAddString (listStartCopy," ", AFTER); ListAddString (listStartCopy, "Please make sure you fill in the information, click Next to continue", AFTER); iscreatedb = tRUE; // database installation flag is true destsvr = szSQLsvrDefault; destsa = szSQLusrDefault; destpw = szSQLpwdDefault; nResult = SdStartCopy (szTitle, SZMSG, ListStartCopy; ListDestroy TartCopy; setStatusWindow (0, ""); enable (statusex); statusupdate; if (NsetuPType = "Database") THEN GOTO END_ALL_INSTALL; ENDIF; // Start Main program installation DLG_SDaskDestPath: // Installation Location Dialog Sztitle = "Main Machion Location"; SZMSG = ""; Nresult = SDASKDestPath (Sztitle, SZMSG, SZDIR, 0); Targetdir = Szdir; destdir = SZDIR; if (NResult =
BACK) GOTO DLG_SETUPTYPE; DLG_SELMODE1: // Set IIS Server Dialog Sztitle = "Set" TMP_PRODUCT_NAME "to run mode"; szmsg = "Please select the software running, it is recommended to use the independent site mode to run"; SZField1 = "independent Site mode runs (automatically creates new sites) "; SZFIELD2 =" virtual directory operation (automatically creates virtual directory) "; svedit1 = true; svedit2 = false; setDialogtitle (DLG_ASK_TEXT, SZTITLE); // DialogsetInfo (DLG_INFO_CHECKSETINFO (DLG_INFO_CHECKSELECTION,", 1); nOpt = EXCLUSIVE; nResult = AskOptions (nOpt, szMsg, szField1, svEdit1, szField2, svEdit2); if (nResult = BACK) goto Dlg_AskSQL; if (svEdit1 = FALSE) goto Dlg_AskText1; // select create a virtual directory Dlg_AskText: / / Set the IIS server, establish a site dialog sztitle = "Set the IIS information server"; szmsg = "Now set the IIS system"; szquestion = "Please enter the host name or IP address of this server, the installer will follow you Data setup IIS information service. If you are not filled out, the installer will automatically skip the creation of the site! "; Szserverip =" address: "; szserverport =" port: "; szserveripdefault =" 192.168.8.8 "; SZServerPortdefault =" 80 " ; setDialogTitle (DLG_ASK_TEXT, szTitle); nResult = SdShowDlgEdit2 (szTitle, szQuestion, szServerIP, szServerPort, szServerIPDefault, szServerPortDefault); if (nResult = BACK) goto Dlg_SelMode1; if (nResult = NEXT) goto Dlg_SdStartCopy1; Dlg_AskText1: // set I IS server, establish a virtual directory dialog SZTITLE = "Set IIS Information Server"; SZMSG = "Now set IIS system"; szquestion = "Please enter the host name or IP address of this server, the installer will set the information you provide. IIS information service.
If you are not filled out, the installer will automatically skip the creation of the site! "; SzServerIP =" Alias: "; szServerPort =" Directory: "; szServerIPDefault =" oa "; szServerPortDefault = szDir; SetDialogTitle (DLG_ASK_TEXT, szTitle); nResult = SdShowDlgEdit2 (szTitle, szQuestion, szServerIP, szServerPort, szServerIPDefault, szServerPortDefault); IF (NResult = BACK) GOTO DLG_ASKTEXT; DLG_SDSTARTCOPY1: // Start replication file dialog sztitle = "confirm IIS server information"; szmsg = "Click Next"; listStartCopy = listCreate (Stringlist); ListAddString (ListStartCopy, "User name : " svName, AFTER); ListAddString (listStartCopy," the company name: " svCompany, AFTER); ListAddString (listStartCopy," the destination directory: " szDir, AFTER); if (svEdit1 = TRUE) then ListAddString (listStartCopy," IP address: " szServerIPDefault, AFTER); ListAddString (listStartCopy," port number: " szServerPortDefault, AFTER); endif; if (svEdit2 = TRUE) then ListAddString (listStartCopy," alias: " szServerIPDefault, AFTER); ListAddString ( ListStartCopy, "Directory: SZSERVERPORTDEFAULT, AFTER); Endif; ListAddstring (ListStartCopy," ", After; ListAddstring (L istStartCopy, "Please make sure you fill in the information, click Next to continue", AFTER); nResult = SdStartCopy (szTitle, szMsg, listStartCopy); ListDestroy (listStartCopy); if (nResult = BACK) goto Dlg_AskText1; SetStatusWindow (0, "" ); Enable (STATUSEX); Enable (INDVFILESTATUS); StatusUpdate (ON, 100); if (svEdit1 = TRUE) then CreateWebSite (szServerIPDefault, szServerPortDefault); // start creating the IIS site endif; if (svEdit2 = TRUE) then CreateVirtualDir ( SZSERVERIPDEFAULT;
// Start creating an IIS site Endif; End_all_install: // End all installing returnography; end;
function OnFirstUIAfter () STRING szTitle, szMsg1, szMsg2, szOption1, szOption2, szCmdLine; NUMBER bOpt1, bOpt2; STRING szMsg; begin if ((nSetupType = "completely installed") || (nSetupType = "Database only")) then // Start Creating Database CreatedTabase (DestSVR, DESTSA, DESTPW); // Create and optimize database IF (NSetUPType = "full installation") THEN // Start setting Global.asa OpenFileMode (file_mode_normal); // Open File Method Read IF (OpenFile (NVFileHandlebak, Destdir, "Global.bak") <0) THEN MessageBox ("Open Profile Failed, please Manually Configure", Severe); Goto End_all_Install1; Endif; OpenFileMode (file_mode_append); // Open File Writing IF ( CreateFile (NVFileHandle, DestDir, "Global.asa") <0) Then MessageBox ("Create a global.asa file failed, manually configure", severe); goto end_all_install1; Else // Start Write file asaline = 1; While (Getline (NVFileHandlebak, GlobalStr) = 0) IF (asaline = 15) THEN / / This row needs to be modified, otherwise write files: Using the area where the unit is located globalstr = "/" uninname = " SVCompany " / ""; if (IF Writeline (nvfilehandle, globalstr) <0) THEN MessageBox ("Write the Global.asa file failed, please manually modify", Warning); goto end_install1; endif; endif; if (asaline = 17) THEN // This row needs to be modified, otherwise write file: unit name globalstr = " Application (/ "thissoftuser /") = uninname & / "" svserial "/" "; if (WriteLine (NVfileHandle, GlobalStr) <0) The MessageBox (" Write the global.asa file failed, please modify manually ", Warning ); Goto end_all_install1; endif; Endif;
IF (asaline = 18) THEN / / This row needs to be modified, otherwise write files: unit name globalstr = "Application (/" unitname / ") = uninname & /" svserial "/" "; if (WriteLine (NVFileHandle, GlobalStr) <0) Then MessageBox ("Write the global.asa file failed, please manually modify", warning); goto end_all_install1; endif; Endif; if (asaline = 30) THEN / / This row needs to be modified, otherwise the original Write file: SQL connection globalstr = "Application (/" SQLLINK / ") = /" provider = SQLOLEDB.1; Password = " destPW "; persist security info = true; user id = " destsa "; initial; initial Catalog = OA; Data Source = " Destsvr " / ""; if (WriteLine (NVfileHandle, GlobalStr) <0) The MessageBox ("Write the global.asa file failed, please manually modify", Warning); goto end_InStall1; Endif ; Endif; if (asaline = 32) THEN / / This row needs to be modified, otherwise write files: SQL connection globalstr = "Application (/" connectsql / ") = /" driver = SQL Server; Server = " Destsvr "; Database = OA; UID =" destsa "; Initial Catalog = OA; PWD =" DestPW "/"; if (WriteLine (NVFileHandle, GlobalStr) <0) The MessageBox ("Write Global. The ASA file failed, please manually modify ", Warning); goto end_all_install1; Endif; Endif; if (asaline = 37) THEN / / This row needs to be modified, otherwise write files: a
D Administrator Account GlobalStr = "Application (/" User_SDJSWOAVERSION / ") = /" " SzadusRDefault " @ " SzadDomainDefault " / ""; if (WriteLine (NVFileHandle, GlobalStr) <0) Then MessageBox ("Write Global .asa file failed, manually modified ", Warning); goto end_all_install1; Endif; Endif; if (asaline = 38) THEN // This row needs to be modified, otherwise write file: AD admin password globalstr =" Application (/ "Password_SDJSWOAVERSION /") = / "" Szadpwddefault "/" "; if (WriteLine (NVfileHandle, GlobalStr) <0) The MessageBox (" Write the global.asa file failed, please manually modify ", Warning); goto end_all_install1; Endif; Endif; if (asaline = 61) the // This row needs to be modified, otherwise write files: AdiP address and organizational unit globalstr = "Application (/" adspath_sdjswoaversion / ") = /" ldap: // " Szadsvrdefault ": 389 / ou =" szadoudefault ", DC =" addC1 ", DC = XXX, DC = COM /" "; if (WriteLin e (nvfilehandle, globalstr) <0) The MessageBox ("Write the global.asa file failed, please manually modify", Warning); goto end_all_install1; endif; Endif; if (asaline = 62) THEN // This row needs to be modified, otherwise Writing file: Connect Ad GlobalStr = "Application (/" Exchange Server_SDJSWOAVERSION / ") = /" "
SZADSVRDEFAULT ": 3268 //" "; if (NVfileHandle, GlobalStr) <0) The MessageBox (" Write the global.asa file failed, please manually modify ", Warning); goto end_all_install1; Endif; Endif; Asaline = Asaline 1; // Next line endwhile; endif; // Close file closefile (nvfilehandle); sztitle = "Create a configuration file"; szmsg = "Congratulations, automatically modify the configuration file!"; Sprintfbox (Information , szTitle, szMsg, "global.asa"); endif; endif; end_all_install1: Disable (STATUSEX); bOpt1 = FALSE; bOpt2 = FALSE; szMsg1 = SdLoadString (IFX_SDFINISH_MSG1); szMsg2 = ""; szOption1 = ""; szOption2 = ""; szTitle = TMP_PRODUCT_NAME "installed"; SdFinishEx (szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2); // szCmdLine = "http: // LocalHost"; // if (LaunchApp (PROGRAMFILES ^ "In Ternet Explorer "^" ipplore.exe ", szcmdline) <0) THEN // MessageBox (" You cannot open your browser. ", severe); // endif; dlg_rebootdialog: sztitle =" Welcome to install " TMP_PRODUCT_NAME " ; SZMSG = "The installation wizard has successfully installed the system. You must restart your computer before using the system. "; SDFINISHREBOOT (SZTITLE, SZMSG, SYS_BOOTMACHINE," ", 0); RETURN 0; END;
//// create and optimize database // function CreateDataBase (svSQLsvrf, svSQLusrf, svSQLpwdf) STRING szCmdLine, szWaitTxt, tmpstr; begin szWaitTxt = "being created" TMP_PRODUCT_NAME "database required ...."; SdShowMsg (szWaitTxt, TRUE ); Delay (3); szcmdline = "/ u" svsqlusrf "/ p" svsqlpwdf "/ s" svsqlsvrf "/ q /" restore database sdjswoa from disk = '" targetdir " // db // oa '/ ""; Launchappandwait ("Osql.exe", Szcmdline, Wait) <0) The Tmpstr = "Database Creation Failed! Please install Microsoft SQL Server 2000 and SP1!" In your system; Sprintfbox (Information , "Install Tips", TMPSTR, ""); Endif; SDShowmsg (Szwaittxt, false); szwaittxt = "Optimized" TMP_Product_name "System Database ...."; SDShowMSG (Szwaittxt, True); delay (3) Szcmdline = "/ u" svsqlusrf "/ p" svsqlpwdf "/ s" svsqlsvrf "/ q /" use sdjswoa; exec sp_updatestats / ""; if (Launchappandwait ("Osql.exe", Szcmdline, Wait < 0) THEN TMPSTR = "Database Optimization Failure! Please contact relevant personnel or manual installation!"; SprintfBox (Information, "Installation Tips", TMPSTR, ""); Endif; SDShowMSG (SzwaitTxt, False); Return 0;
//// create IIS site // function CreateWebSite (szServerIPDefault, szServerPortDefault) STRING szCmdLine, szWaitTxt; begin if ((szServerIPDefault = "") || (szServerPortDefault = "")) then MessageBox ( "you do not set" TMP_PRODUCT_NAME "Running server IP address or port !! IIS information service settings failed! / N Please create an IIS site yourself and set the home directory:" targetdir, severage; else szwaittxt = "is creating an IIS and setup sites .. .. "; SdShowMsg (szWaitTxt, TRUE); Delay (3); szCmdLine = SUPPORTDIR ^" mkw3site.vbs " " -r " TARGETDIR " -i " szServerIPDefault " -o " szServerPortDefault " -t " TMP_PRODUCT_NAME IF (LaunchappandWait ("WScript.exe", Szcmdline, Wait) <0) Then MessageBox ("You cannot create a web virtual directory, no wscript.exe or execute script error."; Endif; SDShowmsg (Szwaittxt, False ); Endif; Return 0; END; /// creates virtual directory // function createvirtualdir (VirtualFolder) String szcmdline, szwaittxt; begin if (VirtualFolder = ") Then MessageBox (" Didn't read the name of the virtual directory! Please contact the system supplier! " Targetdir, Severe); Else Szwaittxt =" Create " TMP_PRODUCT_NAME " virtual directory .... "; sdshowmsg (szwaittxt, true); delay (3); szcmdline = supportdir ^" mkwebdir .vbs " " -w 1 - v / " virtualfolder " / ", /" targetdir "/" "; if (" Wscript.exe ", Szcmdline, Wait <0) Then MessageBox (" Cannot establish a web virtual directory without finding WScript Or execution of script errors. ", seve); Endif; szwaittxt, false; Endif; Return 0;