home *** CD-ROM | disk | FTP | other *** search
/ Win 3.11 Apps / win311aps.iso / NORTON / MINALL.S! / MINALL.SM
Text File  |  1993-11-15  |  2KB  |  87 lines

  1. /**********************************************************************
  2.  *    MINALL.SM - Sample ScriptMaker file to minimize all windows except
  3.  *    NDW menu, drive windows and groups.
  4.  *
  5.  *    The best way to use this is to add an item to the Launch List and assign
  6.  *    it a hotkey. When you're in a maximized application, you can hit the hotkey
  7.  *    and everything but NDW will be set to an icon so you can get to all of your
  8.  *    drive and tool icons.
  9.  *
  10.  *    USES:
  11.  *        AppActivate
  12.  *        AppList
  13.  *        AppGetState
  14.  *        AppSetState
  15.  *        Declare
  16.  *        Dim
  17.  *        For..Next
  18.  *        Function
  19.  *        If..Then..Else
  20.  *        InStr
  21.  *        Len
  22.  *        ReadINI
  23.  *        Space
  24.  *        Sub
  25.  *        Trim
  26.  *        UBound
  27.  *        While..Wend
  28.  *        WinFind
  29.  *
  30.  *        Written by Ted Sadler
  31.  *        ⌐ 1993 Symantec Corporation
  32.  *********************************************************************/
  33.  
  34. 'Need to call Windows API function to get class of window
  35. Declare Function GetClassName Lib "User" (ByVal hWnd As Integer, ByVal lpClassName As String, ByVal nMaxCount As Integer) As Integer
  36.  
  37. 'Test to see if the string contains NDW's normal title
  38. Function IsNDW(window As String) As Integer
  39.     'Get NDW's current title
  40.     NDWTitle$ = ReadINI$("Configuration", "BannerTitle", "ndw.ini")
  41.  
  42.     IsNDW = FALSE        'Assume that it isn't
  43.     If InStr(window, NDWTitle) Then
  44.         IsNDW = TRUE    'It is NDW
  45.     End If
  46. End Function
  47.  
  48. Sub Main
  49. Dim wins() As String
  50. Dim i As Integer
  51.  
  52.     'get list of windows into array
  53.     AppList wins
  54.  
  55.     'Save this value for speed
  56.     ulim=UBound(wins)
  57.  
  58.     For i = 0 To ulim
  59.         '  save this value for speed
  60.         a$ = wins(i)
  61.         If (IsNDW(a) = False) Then
  62.             'If it's already minimized, we don't need to minimize it again
  63.             If (AppGetState(a) <> WS_MINIMIZED) Then
  64.                 '  Get the handle to the window so we can get the class name
  65.                 hWnd = WinFind(a)
  66.  
  67.                 Class$ = Space$(128)
  68.                 '  Get current window's class name
  69.                 nClass = GetClassName(hWnd, Class, 128)
  70.  
  71.                 'Removing spaces before and after the name
  72.                 class = Trim$(class)
  73.  
  74.                 '  If it isn't one of NDW's groups, minimize it
  75.                 If Class <> "QuickAccessGroup" Then AppSetState 2, a
  76.             End If
  77.         Else
  78.             'It is NDW so save it to activate at the end
  79.             NDW$ = a
  80.         End If
  81.     Next i
  82.  
  83.     'Now make NDW  the active window
  84.     AppActivate(NDW)
  85.  
  86. End Sub
  87.