*start* 16967 00024 US Date: 6 Apr 84 14:45:22 PST (Friday) Subject: PSAssign.tds In-reply-to: Masinter.pa's message of 6 Apr 84 11:50 PST To: Masinter.pa cc: sannella.pa From: Bruce Hamilton <Hamilton.ES> Reply-To: Hamilton.ES Here are a couple of scripts that do queries, auto-assignment, and report generation. There's a lot of bullet-proofing for rare error situations, and a certain amount of redundancy to try to make pieces of a script separable. I sure wish ToolDriver had Procedures, or at least Macros; but Daniels says no major work is planned on it. --Bruce --<>PSAssign.tds by Hamilton 20-Dec-83 14:13:22 --FTP rain st/usa PSAssign.tds <StarARStatus>PSAssign.tds!H -- FTP rain st/usa PSAssignStarted.msg <StarARStatus>PSAssignStarted.msg!H -- FTP rain st/usa PSAssignFinished.msg <StarARStatus>PSAssignFinished.msg!H --bitmap bigger than 496x512 --from WJThomas -- DO AUTOASSIGNMENT ON NEW ARS. -- ADOBE TOOLS MUST BE INACTIVE. -- DEACTIVATE THEN REACTIVATE EXEC AFTER ACTIVATING TOOLDRIVER. AppendCommand[SimpleExec.ExecTTY, " FTP rain dir StarARStatus ret/<>a PSSoftware.user PSAssignStarted.msg PSAssignFinished.msg op/c igor ret/ua <hacks>10.0>tools>MailFrom.bcd "] AppendCommand[SimpleExec.ExecTTY, " MailFrom PSAssignStarted.msg "] ActivateTool["AdobeUpdate"] ActivateTool["AdobeReport"] -- need Report for temp string storage WindowOnTop[AdobeUpdate] DO -- UpdateHeraldLoop InvokeMCR[AdobeUpdate.msgSW,"Adobe systems","Product Software"] IF SubString[LastMessage[AdobeUpdate.msgSW], 0, 3] # "Try" THEN EXITLOOP UpdateHeraldLoop; ENDLOOP UpdateHeraldLoop; TOOL ← "AdobeUpdate" SUBWINDOW ← "cmdSW" IF SubString[LastMessage[msgSW], 0, 23] = "Incorrect user-password" THEN Pause["Login then Proceed", FALSE] Update IF SubString[LastMessage[msgSW], 0, 29] = "Please select an Adobe system" THEN BEGIN Pause["Select Adobe system, then Proceed", FALSE] Update END IF SubString[LastMessage[msgSW], 0, 16] = "Illegal password" THEN BEGIN Pause["Log in, then Proceed", FALSE] Update END IF SubString[LastMessage[msgSW], 0, 15] = "Try once again:" THEN Restart IF SubString[LastMessage[msgSW], 0, 57] = "Bad access control state: Supplied FullID Not Current One" THEN Restart IF SubString[LastMessage[msgSW], 0, 22] = "Update in progress by:" THEN BEGIN Pause["Proceed to Restart", FALSE] Restart END --end of UPDATE ActivateTool["AdobeQuery"] WindowOnTop[AdobeQuery] InvokeMCR[AdobeQuery.msgSW,"Adobe Systems","Product Software"] InvokeMCR[AdobeQuery.msgSW,"Adobe Systems","Product Software"] TOOL ← "AdobeQuery" SUBWINDOW ← "formSW" Number ← " > 0" Status ← "NIL" System ← "Basic Workstation OR Documents OR Fonts OR System Data OR Workstation Features OR Other" Assigned' to ← "# NIL" Subsystem ← "" cmdSW.Query ActivateTool["AdobeQueryList"] WindowOnTop[AdobeQueryList] TOOL ← "AdobeQueryList" SUBWINDOW ← "cmdsw" InvokeMCR[msgSW, "Adobe systems", "Product Software"] InvokeMCR[msgSW, "Adobe systems", "Product Software"] Operand1 ← "SysQL" Result ← "Query1.ql" Copy ActivateTool["AdobeQuery"] WindowOnTop[AdobeQuery] InvokeMCR[msgSW,"Adobe Systems","Product Software"] InvokeMCR[msgSW,"Adobe Systems","Product Software"] TOOL ← "AdobeQuery" SUBWINDOW ← "formSW" Number ← " > 0" Status ← "Open OR Wish OR New OR Other OR NIL" System ← "Basic Workstation OR Documents OR Fonts OR System Data OR Workstation Features OR Other" Assigned' to ← "NIL" Subsystem ← "" cmdSW.Query ActivateTool["AdobeQueryList"] WindowOnTop[AdobeQueryList] TOOL ← "AdobeQueryList" SUBWINDOW ← "cmdsw" InvokeMCR[msgSW, "Adobe systems", "Product Software"] InvokeMCR[msgSW, "Adobe systems", "Product Software"] Result ← "Query2.ql" Operand1 ← "SysQL" Copy Operand1 ← "Query1.ql" Operand2 ← "Query2.ql" Result ← "SysQL" Union Operand1 ← "SysQL" Operand2 ← "" Result ← "StarNew.ql" Copy ActivateTool["AdobeQuery"] WindowOnTop[AdobeQuery] InvokeMCR[AdobeQuery.msgSW,"Adobe Systems","Product Software"] InvokeMCR[AdobeQuery.msgSW,"Adobe Systems","Product Software"] TOOL ← "AdobeQuery" SUBWINDOW ← "formSW" Number ← " > 0" Status ← "NIL" System ← "" Assigned' to ← "# NIL" Subsystem ← "# File AND # Print AND # Common Software" cmdSW.Query ActivateTool["AdobeQueryList"] WindowOnTop[AdobeQueryList] TOOL ← "AdobeQueryList" SUBWINDOW ← "cmdsw" InvokeMCR[msgSW, "Adobe systems", "Product Software"] InvokeMCR[msgSW, "Adobe systems", "Product Software"] Operand1 ← "SysQL" Result ← "Query3.ql" Copy ActivateTool["AdobeQuery"] WindowOnTop[AdobeQuery] InvokeMCR[msgSW,"Adobe Systems","Product Software"] InvokeMCR[msgSW,"Adobe Systems","Product Software"] TOOL ← "AdobeQuery" SUBWINDOW ← "formSW" Number ← " > 0" Status ← "Open OR Wish OR New OR Other OR NIL" System ← "" Assigned' to ← "NIL" Subsystem ← "# File AND # Print AND # Common Software" cmdSW.Query ActivateTool["AdobeQueryList"] WindowOnTop[AdobeQueryList] TOOL ← "AdobeQueryList" SUBWINDOW ← "cmdsw" InvokeMCR[msgSW, "Adobe systems", "Product Software"] InvokeMCR[msgSW, "Adobe systems", "Product Software"] Result ← "Query4.ql" Operand1 ← "SysQL" Copy Operand1 ← "Query3.ql" Operand2 ← "Query4.ql" Result ← "SysQL" Union ActivateTool["AdobeEdit"] WindowOnTop[AdobeEdit] TOOL ← "AdobeEdit" InvokeMCR[msgSW,"Adobe systems","Product Software"] InvokeMCR[msgSW,"Adobe systems","Product Software"] cmdSW.UseQL ← TRUE cmdSW.UseQL ← FALSE cmdSW.UseQL ← TRUE IF SubString[LastMessage[AdobeQuery.msgSW], 0, 9] # "0 matches" THEN BEGIN -- Edits cmdSW.Next ← TRUE DO -- StartoutLoop cmdSW.Checkout IF SubString[LastMessage[AdobeEdit.msgSW], 0, 47] # "Try once again: Supplied FullID Not Current One" THEN EXITLOOP StartoutLoop; ENDLOOP StartoutLoop; SUBWINDOW ← "formSW" DO --OuterLoop IF SubString[LastMessage[AdobeEdit.msgSW], 0, 29] = "Please select an Adobe system" THEN Pause["Select the system then Proceed", FALSE] IF SubString[LastMessage[AdobeEdit.msgSW], 0, 16] = "Invalid ARNumber" THEN EXITLOOP OuterLoop; DO --InnerLoop IF SubString[LastMessage[AdobeEdit.msgSW], 0, 34] = "Can't check out AR: must do update" THEN EXITLOOP InnerLoop; --DO ++Retry --IF Edit'-By#NIL THEN --BEGIN --IF Pause["Skip this one?", TRUE] THEN --BEGIN --AppendString[ToolDriverExec.fileSW, " -- SKIPPING PREVIOUSLY EDITED AR "] --AppendString[ToolDriverExec.fileSW, Number] --AppendString[ToolDriverExec.fileSW, " --"] --DO ++ CheckoutLoop --cmdSW.AbortCheckout -- IF LastMessage[AdobeEdit.msgSW] # -- "Try once again: Supplied FullID Not Current One" -- THEN EXITLOOP CheckoutLoop; --ENDLOOP CheckoutLoop; --cmdSW.Next --IF LastMessage[AdobeEdit.msgSW] = "Query List exhausted!" -- THEN EXITLOOP OuterLoop; --DO ++ GetNextLoop --cmdSW.Checkout --IF SubString[LastMessage[AdobeEdit.msgSW], 0, 3] # "Try" --THEN EXITLOOP GetNextLoop; --ENDLOOP GetNextLoop; --END --ELSE EXITLOOP Retry; --END --ELSE EXITLOOP Retry; --ENDLOOP Retry; DO -- EditLoop IF Status = NIL THEN Status ← "New" IF Assigned' To = "" THEN IF Priority = NIL THEN Status ← "New" -- per Newton 31-Oct-83 --use AdobeReport.cmdSW.Output' file for temp storage AdobeReport.cmdSW.Output' file ← Assigned' To --Applications IF System="Applications" THEN BEGIN Assigned' To ← "Herr" EXITLOOP EditLoop; END --Basic Workstation IF System="Basic Workstation" THEN BEGIN IF Subsystem="Desktop" THEN BEGIN Assigned' To ← "Sandman, SAJohnson" EXITLOOP EditLoop; END IF Subsystem="Logon/Logoff" THEN BEGIN Assigned' To ← "Sandman, SAJohnson" EXITLOOP EditLoop; END ELSE Assigned' To ← "Sandman" EXITLOOP EditLoop; END --Basic Workstation --Customer Documentation IF System="Customer Documentation" THEN BEGIN Assigned' To ← "Frahmann" EXITLOOP EditLoop; END --Diagnostics IF System="Diagnostics" THEN BEGIN Assigned' To ← "Weatherford" EXITLOOP EditLoop; END --Diagnostics --Documents IF System="Documents" THEN BEGIN Assigned' To ← "Finkel, " EXITLOOP EditLoop; END --Documents --Fonts IF System="Fonts" THEN BEGIN Assigned' To ← "Nelson, Mason" EXITLOOP EditLoop; END --Fonts IF System="Other" THEN BEGIN Assigned' To ← "Steinbach" EXITLOOP EditLoop; END --Services IF System="Services" THEN BEGIN IF Subsystem="Clearinghouse" THEN BEGIN Assigned' To ← "Redell" EXITLOOP EditLoop; END IF Subsystem="External Communication" THEN BEGIN Assigned' To ← "Garlick" EXITLOOP EditLoop; END IF Subsystem="Gateway" THEN BEGIN Assigned' To ← "Garlick" EXITLOOP EditLoop; END IF Subsystem="Internetwork Routing" THEN BEGIN Assigned' To ← "Garlick" EXITLOOP EditLoop; END IF Subsystem="Interactive Terminal" THEN BEGIN Assigned' To ← "Garlick" EXITLOOP EditLoop; END IF Subsystem="Mail" THEN BEGIN Assigned' To ← "Redell" EXITLOOP EditLoop; END ELSE Assigned' To ← "Ladner" EXITLOOP EditLoop; END --Services --System Data IF System="System Data" THEN BEGIN IF Subsystem="Emulation" THEN BEGIN Assigned' To ← "Steinbach, Kernaghan" EXITLOOP EditLoop; END IF Subsystem="Icons" THEN BEGIN Assigned' To ← "Nelson, Mason" EXITLOOP EditLoop; END IF Subsystem="J Dictionaries" THEN BEGIN Assigned' To ← "Mader" EXITLOOP EditLoop; END IF Subsystem="Services Keyboards" THEN BEGIN Assigned' To ← "Nelson, Mason" EXITLOOP EditLoop; END IF Subsystem="Services Messages" THEN BEGIN Assigned' To ← "Frahmann" EXITLOOP EditLoop; END IF Subsystem="Training materials" THEN BEGIN Assigned' To ← "Frahmann" EXITLOOP EditLoop; END IF Subsystem="WS Keyboards" THEN BEGIN Assigned' To ← "Nelson, Mason" EXITLOOP EditLoop; END IF Subsystem="WS Messages" THEN BEGIN Assigned' To ← "Frahmann" EXITLOOP EditLoop; END ELSE Assigned' To ← "Steinbach" EXITLOOP EditLoop; END --Tools IF System="Tools" THEN BEGIN Assigned' To ← "Nelson, Hamilton" EXITLOOP EditLoop; END --Workstation Features IF System="Workstation Features" THEN BEGIN IF Subsystem="Cusp" THEN BEGIN Assigned' To ← "Finkel" EXITLOOP EditLoop; END IF Subsystem="Diagnostics" THEN BEGIN Assigned' To ← "Steinbach, RHansen" EXITLOOP EditLoop; END IF Subsystem="Directories" THEN BEGIN Assigned' To ← "Mader" EXITLOOP EditLoop; END IF Subsystem="Foreign Conversion" THEN BEGIN Assigned' To ← "Steinbach, RHansen" EXITLOOP EditLoop; END IF Subsystem="File Drawer/Folder" THEN BEGIN Assigned' To ← "Sandman" EXITLOOP EditLoop; END IF Subsystem="Floppy" THEN BEGIN Assigned' To ← "Steinbach, RHansen" EXITLOOP EditLoop; END IF Subsystem="Help/Training" THEN BEGIN Assigned' To ← "Frahmann" EXITLOOP EditLoop; END IF Subsystem="Introduction" THEN BEGIN Assigned' To ← "Sandman" EXITLOOP EditLoop; END IF Subsystem="J Dictionary" THEN BEGIN Assigned' To ← "Mader, " EXITLOOP EditLoop; END IF Subsystem="J Typing" THEN BEGIN Assigned' To ← "Mader" EXITLOOP EditLoop; END IF Subsystem="Local Printing" THEN BEGIN Assigned' To ← "Mader" EXITLOOP EditLoop; END IF Subsystem="Mailing" THEN BEGIN Assigned' To ← "Mader" EXITLOOP EditLoop; END IF Subsystem="Records Processing" THEN BEGIN Assigned' To ← "Steinbach, Pettit" EXITLOOP EditLoop; END IF Subsystem="Remote Printing" THEN BEGIN Assigned' To ← "Mader" EXITLOOP EditLoop; END IF Subsystem="Spelling Checker" THEN BEGIN Assigned' To ← "Steinbach" EXITLOOP EditLoop; END IF Subsystem="Spreadsheet" THEN BEGIN Assigned' To ← "Steinbach, Pettit" EXITLOOP EditLoop; END IF Subsystem="Terminal Emulation" THEN BEGIN Assigned' To ← "Steinbach, Kernaghan" EXITLOOP EditLoop; END ELSE Assigned' To ← "Steinbach" EXITLOOP EditLoop; END --Workstation Features --Pause["Edit AR, then Proceed", FALSE] AppendString[ToolDriverExec.fileSW, " -- SKIPPING STRANGE AR "] AppendString[ToolDriverExec.fileSW, Number] AppendString[ToolDriverExec.fileSW, " "] EXITLOOP EditLoop; ENDLOOP EditLoop; IF Assigned' To = AdobeReport.cmdSW.Output' file THEN Priority ← "Nil" -- if we have edited Assigned' To, then null out prio IF Disposition = Attn THEN Disposition ← "" IF Attn = Assigned' to THEN Attn ← "" cmdSW.Next IF SubString[LastMessage[AdobeEdit.msgSW], 0, 20] = "Query List exhausted" THEN EXITLOOP OuterLoop; DO -- CheckinandoutLoop cmdSW.Checkin'&out IF SubString[LastMessage[AdobeEdit.msgSW], 0, 3] # "Try" THEN EXITLOOP CheckinandoutLoop; IF SubString[LastMessage[AdobeEdit.msgSW], 0, 20] = "Do a CheckOut first!" THEN DO -- StartoutLoop2 cmdSW.Checkout IF SubString[LastMessage[AdobeEdit.msgSW], 0, 47] # "Try once again: Supplied FullID Not Current One" THEN EXITLOOP CheckinandoutLoop; ENDLOOP StartoutLoop2; ENDLOOP CheckinandoutLoop; IF SubString[LastMessage[AdobeEdit.msgSW], 0, 34] = "Can't check out AR: must do update" THEN EXITLOOP InnerLoop; ENDLOOP InnerLoop; ActivateTool["AdobeUpdate"] WindowOnTop[AdobeUpdate] AdobeUpdate.cmdSW.Update ActivateTool["AdobeEdit"] WindowOnTop[AdobeEdit] DO -- CheckoutLoop cmdSW.Checkout IF SubString[LastMessage[AdobeEdit.msgSW], 0, 3] # "Try" THEN EXITLOOP CheckoutLoop; ENDLOOP CheckoutLoop; ENDLOOP OuterLoop; DO -- LastCheckinLoop cmdSW.Checkin IF SubString[LastMessage[AdobeEdit.msgSW], 0, 3] # "Try" THEN EXITLOOP LastCheckinLoop; ENDLOOP LastCheckinLoop; ActivateTool["AdobeUpdate"] WindowOnTop[AdobeUpdate] AdobeUpdate.cmdSW.Update AppendString[ToolDriverExec.fileSW, " CONSISTENCY CHECK: Make sure all New, Open, Wish ARs are assigned "] ActivateTool["AdobeQuery"] WindowOnTop[AdobeQuery] TOOL ← "AdobeQuery" SUBWINDOW ← "formSW" InvokeMCR[AdobeQuery.msgSW,"Adobe systems","Product Software"] InvokeMCR[AdobeQuery.msgSW,"Adobe systems","Product Software"] Number ← ">0" System ← "" Subsystem ← "# File AND # Print AND # Common Software" Status ← "New OR Open OR Wish" Assigned' To ← "NIL" cmdSW.ResetQL cmdSW.Query IF SubString[LastMessage[msgSW], 0, 9] # "0 matches" THEN BEGIN -- Consistency check failure TOOL ← "AdobeQueryList" ActivateTool["AdobeQueryList"] WindowOnTop[AdobeQueryList] InvokeMCR[msgSW, "Adobe systems", "Product Software"] InvokeMCR[msgSW, "Adobe systems", "Product Software"] cmdsw.Result ← "Unassigned.ql" cmdsw.Operand1 ← "SysQL" cmdsw.Copy AppendString[ToolDriverExec.fileSW, " -- Unassigned Services or Tableware ARs found and stored in UNASSIGNED.QL. Edit them, filling in the Assigned To field. Contact Bruce Hamilton if you're not sure who to assign one of the ARs to. "] END -- Consistency check failure -- STAR CONSISTENCY CHECK ActivateTool["AdobeQuery"] WindowOnTop[AdobeQuery] TOOL ← "AdobeQuery" SUBWINDOW ← "formSW" Number ← ">0" System ← "Basic Workstation OR Documents OR Workstation Features" Status ← "New OR Open OR Wish" Assigned' To ← "~HAS Frahmann AND ~HAS Finkel AND ~HAS FunSpec AND ~HAS Mader AND ~HAS Nelson AND ~HAS Sandman AND ~HAS Steinbach" cmdSW.ResetQL cmdSW.Query IF SubString[LastMessage[msgSW], 0, 9] # "0 matches" THEN BEGIN -- Consistency check failure ActivateTool["AdobeQueryList"] WindowOnTop[AdobeQueryList] TOOL ← "AdobeQueryList" InvokeMCR[msgSW, "Adobe systems", "Product Software"] InvokeMCR[msgSW, "Adobe systems", "Product Software"] cmdsw.Result ← "Misassigned.ql" cmdsw.Operand1 ← "SysQL" cmdsw.Copy AppendString[ToolDriverExec.fileSW, " -- Misassigned STAR ARs found and stored in MISASSIGNED.QL. Edit them, filling in the Assigned To field. Contact Bruce Hamilton if you're not sure who to assign one of the ARs to. "] END -- Consistency check failure END -- Edits AppendCommand[SimpleExec.ExecTTY, " MailFrom PSAssignFinished.msg "]