*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 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 PSAssign.tds!H -- FTP rain st/usa PSAssignStarted.msg PSAssignStarted.msg!H -- FTP rain st/usa PSAssignFinished.msg 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 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 "]