mbt masai
 
Welcome !
         

                                
After experiencing a lot of down time, We decided to move this site to CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.

 VBS Runtime error 800A000D - Type mismatch

Author Message
ironryan77

  • Total Posts : 5
  • Scores: 0
  • Reward points : 0
  • Joined: 3/9/2010
  • Status: offline
VBS Runtime error 800A000D - Type mismatch Tuesday, March 09, 2010 9:35 PM (permalink)
0
I am trying to run a .VBS script from Windows explorer and am a novice VBScripting programmer.  I am getting above error when running the following code.  What am I doing wrong?  I just need to generate the IIS MIME types please!
Error detail: Line 49, char 5;
where line 49:
    MimeMapArray = MimeMapObj.GetEx("MimeMap")

And code:
' This script adds the necessary Windows Presentation Foundation MIME types
' to an IIS Server.
' To use this script, just double-click or execute it from a command line.
' Running this script multiple times results in multiple entries in the IIS MimeMap.
' Set the MIME types to be added
Dim MimeMapObj
Dim MimeMapArray()
Dim WshShell
Dim oExec
Const ADS_PROPERTY_UPDATE = 2

Dim MimeTypesToAddArray
MimeTypesToAddArray = Array(".manifest", "application/manifest", ".xaml", _
    "application/xaml+xml", ".application", "application/x-ms-application", _
    ".deploy", "application/octet-stream", ".xbap", "application/x-ms-xbap", _
    ".xps", "application/vnd.ms-xpsdocument")

' Get the mimemap object
Set MimeMapObj = GetObject("IIS://LocalHost/MimeMap")

' Call AddMimeType for every pair of extension/MIME type
For counter = 0 to UBound(MimeTypesToAddArray) Step 2
    AddMimeType MimeTypesToAddArray(counter), MimeTypesToAddArray(counter+1)
Next

' Create a Shell object
Set WshShell = CreateObject("WScript.Shell")

' Stop and Start the IIS Service
Set oExec = WshShell.Exec("net stop w3svc")
Do While oExec.Status = 0
    WScript.Sleep 100
Loop

Set oExec = WshShell.Exec("net start w3svc")
Do While oExec.Status = 0
    WScript.Sleep 100
Loop

Set oExec = Nothing

' Report status to user
WScript.Echo "Windows Presentation Foundation MIME types have been registered."

' AddMimeType Sub
Public Sub AddMimeType(ByVal Ext, ByVal MType)

    ' Get the mappings from the MimeMap property.
    MimeMapArray = MimeMapObj.GetEx("MimeMap")

    ' Add a new mapping.
    i = UBound(MimeMapArray) + 1
    ReDim Preserve MimeMapArray(i)
    MimeMapArray(i) = CreateObject("MimeMap")
    MimeMapArray(i).Extension = Ext
    MimeMapArray(i).MimeType = MType
    MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", MimeMapArray
    MimeMapObj.SetInfo()

End Sub

#1
    rasimmer

    • Total Posts : 2360
    • Scores: 163
    • Reward points : 0
    • Joined: 3/19/2009
    • Location: Cedar Rapids, IA
    • Status: offline
    Re:VBS Runtime error 800A000D - Type mismatch Wednesday, March 10, 2010 2:24 AM (permalink)
    0
    What version of IIS are you working with?  Did the script work "as is" without modification from http://msdn.microsoft.com/en-us/library/ms752346.aspx?
    #2
      ironryan77

      • Total Posts : 5
      • Scores: 0
      • Reward points : 0
      • Joined: 3/9/2010
      • Status: offline
      Re:VBS Runtime error 800A000D - Type mismatch Wednesday, March 10, 2010 3:36 AM (permalink)
      0
      This is IIS Manager version 6
      #3
        ironryan77

        • Total Posts : 5
        • Scores: 0
        • Reward points : 0
        • Joined: 3/9/2010
        • Status: offline
        Re:VBS Runtime error 800A000D - Type mismatch Wednesday, March 10, 2010 5:17 AM (permalink)
        0
        Never mind, I fixed this problem.  Thanks!
        #4
          Deckyon

          • Total Posts : 45
          • Scores: 0
          • Reward points : 0
          • Joined: 8/1/2006
          • Location: Louisville, KY - USA
          • Status: offline
          Re:VBS Runtime error 800A000D - Type mismatch Wednesday, March 10, 2010 5:23 AM (permalink)
          0
          How did you fix it?  It is nice to also see the changes required, in case someone else is having the same problem.
          #5
            ironryan77

            • Total Posts : 5
            • Scores: 0
            • Reward points : 0
            • Joined: 3/9/2010
            • Status: offline
            Re:VBS Runtime error 800A000D - Type mismatch Wednesday, March 10, 2010 5:29 AM (permalink)
            0
            Well I made this code work now, however, not all of my MIME types show as registered.  Do u know how to do this?
            #6
              ebgreen

              • Total Posts : 8088
              • Scores: 95
              • Reward points : 0
              • Joined: 7/12/2005
              • Status: offline
              Re:VBS Runtime error 800A000D - Type mismatch Wednesday, March 10, 2010 5:30 AM (permalink)
              0
              How did you make this code work?

              As for registering the MIME types, there may be someone here that knows that, but it really isn't a VBScript question.
              "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
              Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
              http://www.visualbasicscript.com/m_47117/tm.htm
              #7
                ironryan77

                • Total Posts : 5
                • Scores: 0
                • Reward points : 0
                • Joined: 3/9/2010
                • Status: offline
                Re:VBS Runtime error 800A000D - Type mismatch Wednesday, March 10, 2010 7:48 AM (permalink)
                0
                I made this code work by replacing last section with this code:
                Dim i
                ' AddMimeType Sub
                Sub AddMimeType(ByVal Ext, ByVal MType)

                    ' Get the mappings from the MimeMap property.
                    ' Add a new mapping.
                    For i = 0 to 14
                ' UBound(MimeMapArray) - 1
                    ReDim Preserve MimeMapArray(i)
                    Set MimeMapArray(i) = CreateObject("MimeMap")
                    MimeMapArray(i).Extension = Ext
                    MimeMapArray(i).MimeType = MType
                    MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", MimeMapArray
                    MimeMapObj.SetInfo()
                Next

                #8

                  Online Bookmarks Sharing: Share/Bookmark

                  Jump to:

                  Current active users

                  There are 0 members and 1 guests.

                  Icon Legend and Permission

                  • New Messages
                  • No New Messages
                  • Hot Topic w/ New Messages
                  • Hot Topic w/o New Messages
                  • Locked w/ New Messages
                  • Locked w/o New Messages
                  • Read Message
                  • Post New Thread
                  • Reply to message
                  • Post New Poll
                  • Submit Vote
                  • Post reward post
                  • Delete my own posts
                  • Delete my own threads
                  • Rate post

                  2000-2012 ASPPlayground.NET Forum Version 3.8
                  mbt shoes www.wileywilson.com