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

  • SEARCH
  • Home
  • 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 7434249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:48:18+00:00 2026-05-29T09:48:18+00:00

Unfortunately my VB knowledge is very minimum, but i need a script to do

  • 0

Unfortunately my VB knowledge is very minimum, but i need a script to do the following:
I have a file Licenses.txt, which contains one license per line:
License 1
License 2
License 3

I have an other file response.ini, which has a value ProductKey in this format : ProductKey=XXXXX-XXXXXX-XXXXXX-XXXX

I want to do the following:
Read from Licenses.txt the first license. If it is free (a license is free if after the license don’t stay Used), then it should replace the XXXXX-XXXXXX-XXXXXX-XXXX value in response.ini and put Used after the first License, so in License.txt it should stay License 1 - Used. If i run it again, then it should use the second license and put Used after it etc. If i don’t have any free License then i should get an ErrorMessage.

Hopefully you can understand what i want to do. Can someone help me?

Thanks!

  • 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-05-29T09:48:19+00:00Added an answer on May 29, 2026 at 9:48 am

    Here is the script which will do exactly what you want.

    Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
    
    'Read the licence.txt file
    Dim f : Set f = oFSO.OpenTextFile("Licence.txt", 1)
    Dim sData : sData = f.ReadAll
    f.close
    
    'Find next available licence
    licenceKey = ""
    Dim sLine : for each sLine in split(sData, vbNewLine)
        if (lcase(right(sLine,7)) <> " - used") then
            licenceKey = sLine
            exit for
        end if
    Next
    
    if (licenceKey = "") then
        'Show error if no licences are available
        msgbox "No available licences! ", vbOkOnly + vbexclamation, "Licence"
    else
        'Write a Response.ini file
        Set f = oFSO.OpenTextFile("Response.ini", 2, true)
        f.Write licenceKey
        f.close
    
        'Mark the licence as used
        sData = replace(sData, licenceKey, licenceKey & " - Used")
    
        'ReWrite the licence.txt file
        Set f = oFSO.OpenTextFile("Licence.txt", 2)
        f.Write sData
        f.close
    end if
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Unfortunately my knowledge of NANT stuff is very limited but embarked today on updating
I just started C++ but have some prior knowledge to other languages (vb awhile
First off, I don't have any knowledge about java/jquery/ajax or such, but I think
I am a beginner in C programming language but I have knowledge of programming
I have looked for the answer to this on Google and stackoverflow, but unfortunately
Unfortunately it looks like for various reasons I'm going to have to use Visual
Unfortunately, I need to do this. I'm using ELMAH for my error log. Before
Unfortunately I don't have access to a *nix box at work or at home.
Unfortunately I have to use Windows Server 2003 on my 32 bit workstation due
Unfortunately the BOL is a little vague on this, but index_id = 0 on

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.