' Description: Content List (Sheet) ' ' Changes: ' 20.09.1999 CIM-Team Initial Version ' 31.05.2000 CIM-Team New version ' 23.03.2004 CIM-Team Show only the first created sheet ' 29.06.2004 CIM-Team Use the texts which can be translated ' 18.08.2004 CIM-Team Added control of internal/external execution ' 04.04.2005 CIM-Team Added portuguese strings ' 28.07.2005 CIM-Team added strings for chinese and russian '- EOH - '... ' Connect to application and declare object variables to call methods later Set App = ConnectToE3 set Job = App.CreateJobObject set Sheet = Job.CreateSheetObject set Graph = Job.CreateGraphObject set Text = Job.CreateTextObject units = "MM" y_min = 24 y_max = 242 y_space = 8 x_page = 28 x_description_1 = 52 x_description_2 = 164 x_date = 164 x_user = 292 x_documenttype = 348 text_height = 4 text_description = 40 'erste Sprache (Texttype 40, Sprache 1 (/1)) text_description_A = 48 'zweite Sprache (Texttype 40, Sprache 2 (/2)) text_description_B = 501 'dritte Sprache (Texttype 40, Sprache 3 (/4)) text_documenttype = 39 y = 0 sheet_number = 0 ContentsId = 0 FirstShtId = 0 message = """" & App.GetInstallationPath & "scripts\message.vbs" & """" language = App.GetInstallationLanguage sheet_format = "STULZ_A3-Content" select case language case "01" sheet_name = "Cont_" case "44" sheet_name = "Cont_" case "49" sheet_name = "Inh_" case "33" sheet_name = "Cont_" case "34" sheet_name = "Cont_" case "39" sheet_name = "Ind_" Case "55" sheet_name = "Cont_" case "07" sheet_name = "Cont_" case "86" sheet_name = "Cont_" case "90" sheet_name = "Cont_" case else sheet_name = "Cont_" end select if Job.GetId = 0 then WshShell.run message & " No_Project" wscript.quit end if nSheets = Job.GetSheetCount ' get sheet count if nSheets = 0 then WshShell.run message & " No_Sheets" wscript.quit end if for n = 1 to nSheets Sheet.Search 0, sheet_name & n ' search for already built if Sheet.GetId then ' contents sheets and remove Sheet.Delete ' them else exit for end if next nSheets = Job.GetSheetIds (Ids) ' get all sheet ids. if nSheets = 0 then WshShell.run message & " No_Sheets" wscript.quit end if SaveMeasure = Job.GetMeasure SaveTextMode = Job.GetGraphTextMode SaveTextHeight = Job.GetGraphTextHeight Job.SetMeasure units Job.SetGraphTextMode 1 Job.SetGraphTextHeight text_height for n = 1 to nSheets ' loop around formerly read sheets y = y - y_space if y < y_min then if ContentsId <> 0 And FirstShtId = 0 then FirstShtId = ContentsId end if y = y_max sheet_number = sheet_number + 1 Sheet.Create 0, sheet_name & sheet_number, sheet_format, ContentsId, 0 ' create new sheet ContentsId = Sheet.GetId if ContentsId = 0 then WshShell.run message & " Error_Content_Sheet" wscript.quit end if end if Sheet.SetId Ids(n) nTexts = Sheet.GetTextIds (TextIds) ' read all title texts of the sheet Text_Description_1_found = "" Text_Description_2_found = "" text_description_A_found = "" text_description_B_found = "" Text_Documenttype_found = "" Description_1_found = false Description_2_found = false Date_found = false User_found = false Documenttype_found = false i_found_text = 0 ' search for required texts for t = 1 to nTexts Text.SetId TextIds(t) if Text.GetTypeId = text_description and not Description_1_found then Text_Description_1_found = Text.GetInternalText i_found_text = i_found_text + 1 Description_1_found = true elseif Text.GetTypeId = text_description and not Description_2_found then Text_Description_2_found = Text.GetInternalText i_found_text = i_found_text + 1 Description_2_found = true elseif Text.GetTypeId = text_description_A and not Date_found then text_description_A_found = Text.GetInternalText i_found_text = i_found_text + 1 Date_found = true elseif Text.GetTypeId = text_description_B and not User_found then text_description_B_found = Text.GetInternalText i_found_text = i_found_text + 1 User_found = true elseif Text.GetTypeId = text_documenttype and not Documenttype_found then Text_Documenttype_found = Text.GetInternalText i_found_text = i_found_text + 1 Documenttype_found = true end if if i_found_text = 5 then exit for next Graph.CreateText ContentsId, Sheet.GetName, x_page, y ' add sheet name and other texts to contents sheet with default if Description_1_found then Graph.CreateText ContentsId, Text_Description_1_found, x_description_1, y if Description_2_found then Graph.CreateText ContentsId, Text_Description_2_found, x_description_2, y if Date_found then Graph.CreateText ContentsId, text_description_A_found, x_date, y if User_found then Graph.CreateText ContentsId, text_description_B_found, x_user, y if Documenttype_found then Graph.CreateText ContentsId, Text_Documenttype_found, x_documenttype, y next Sheet.SetId FirstShtId Sheet.Display Job.SetMeasure SaveMeasure Job.SetGraphTextMode SaveTextMode Job.SetGraphTextHeight SaveTextHeight wscript.quit ' ---------------------------------------------------------------------------------------------- ' check for several E3 processes and if process is running internally or externally function ConnectToE3 if InStr(WScript.FullName, "E³") then set ConnectToE3 = WScript ' internal else strComputer = "." set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colItems = objWMIService.ExecQuery("Select * from Win32_Process",,48) ProcessCnt = 0 for each objItem in colItems if InStr(objItem.Caption, "E3.series") then ProcessCnt = ProcessCnt + 1 next set objWMIService = Nothing set colItems = Nothing if ProcessCnt > 1 then MsgBox "More than one E3-Application running. Script can't run as external program." & vbCrLf &_ "Please close the other E3-Applications.", 48 WScript.Quit else set ConnectToE3 = CreateObject ("CT.Application") ' external end if end if end function ' ----------------------------------------------------------------------------------------------