Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8943291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:44:16+00:00 2026-06-15T11:44:16+00:00

I have a device related vbscript problem. The code below is not even supposed

  • 0

I have a device related vbscript problem. The code below is not even supposed to execute after i = playercount but it does.

Do Until i = playercount

    If i = playercount then
        Exit Do
    end if

    Select Case True
        Case i >=1 And i <= 4
            'usb hubs 1-4
            'b = i + 1
             If pluggedindev(4) = False Then

                   msgbox(i)
                   msgbox(playercount)
                   Set ExtHubPort(i) = ExtHub(1).Ports(i)
                   Wscript.Sleep 2000
                   ExtHubPort(i).HotPlug GenericHIDDSFDev(i)
                   WScript.Sleep 10000
                   pluggedindev(i) = True
                   MsgBox("usb device (ports 1-4)")
             'else if playercount <= 4 then
                   'Exit Do
             End If

        Case i >=5 And i <= 8
            'usb hubs 5-8
            Wscript.sleep 2000

            For b = 1 To 4
                 Set ExtHubPort(i) = ExtHub(2).Ports(b)
                 Wscript.sleep 2000
                 ExtHubPort(i).HotPlug GenericHIDDSFDev(i)
                 WScript.Sleep 10000
                 'Log("Usb devices 1 through 4 set")
            Next 

            'usb hubs 9-12
        Case i >=9 And i <= 12
            For b = 1 To 4 
            Set ExtHubPort(i) = ExtHub(3).Ports(b)
                Wscript.sleep 2000
                ExtHubPort(i).HotPlug GenericHIDDSFDev(i)
                WScript.Sleep 10000
            Next 
           'usb hubs 13-16
        Case i >=13 And i <= 16
            For b = 1 To 4 
                Set ExtHubPort(i) = ExtHub(4).Ports(b)
                Wscript.sleep 2000
                ExtHubPort(i).HotPlug GenericHIDDSFDev(i)
                WScript.Sleep 10000
            Next 
         'usb hubs 17-20
        Case i >=17 And i <=20
            For b = 1 To 4 
                Set ExtHubPort(i) = ExtHub(5).Ports(b)
                Wscript.sleep 2000
                ExtHubPort(i).HotPlug GenericHIDDSFDev(i)
                WScript.Sleep 10000
            Next 
    End Select

    i = i + 1

Loop

Anyone take a look and see why?
It appears that i subscript is going out of range and causing the problem but clearly the code above is supposed to work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:44:17+00:00Added an answer on June 15, 2026 at 11:44 am

    I figured it out as the comment about the value of I or playercount was correct. I solved it by putting this code at the end of the loop forcing the counter to stop before it reached playercount (it stopped at 4?). variable i just keep on going up because my if and other statements where not used correctly. Thanks for all who helped.

    If i = playercount  then
    Exit Do
    elseif i < playercount then
    i = i + 1
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem on an embedded device that I think might be related
I have read the Apple documentation regarding Mobile Device Management (MDM) but did not
I have three related entities: a user has many device a user has a
I am reading about device drivers and I have a question related to the
I have a strange problem, or possibly a hardware related problem. I have a
This may not be considered to be directly programming related but I am at
This question is related to this project . I have to send device information
The Problem: I have time-related data in my database and I am struggling to
I have the following problem, related to the Apple Push Notification service on iPhone:
i have successfuly created provisioning certificates and tested the app on my device, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.