Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: QMB Pro Missions Missing Markings On Stationary Planes  (Read 385 times)

0 Members and 1 Guest are viewing this topic.

glibble

  • member
  • Offline Offline
  • Posts: 289
  • RTFM Gold Star Award
QMB Pro Missions Missing Markings On Stationary Planes
« on: November 30, 2024, 02:17:57 PM »

Hi All,

I noticed that in a lot of missions in QMB Pro, the stationary planes are missing their markings (ie. national emblems).
I know I can go into each mission file and check that "Markings On" box in FMB,
or
I can go into each file in notepad and edit, for example:

5_Static vehicles.planes.Plane$IL_2MLate 1 86613.14 19085.14 315.00 0.0 null
Becomes:
5_Static vehicles.planes.Plane$IL_2MLate 1 86613.14 19085.14 315.00 0.0 null 1 1.0 null 1

But even that way is PAINFULLY slow.  :(

Is there a better way to do this? Has anyone made a script to do this before?

Thank you.
Logged

UberDemon

  • UberDemon/danzigzag
  • Modder
  • member
  • Offline Offline
  • Posts: 1553
Re: QMB Pro Missions Missing Markings On Stationary Planes
« Reply #1 on: November 30, 2024, 03:41:30 PM »

Many solutions:
* Bulk Notepad substitution using Ctrl+H
* Using batch file programming in command prompt
* Using Powershell (incredibly painful and unnecessarily complicated) scripting
* Programming it yourself (Java, VB, C#, Pearl, etc)
* combining Batch file programming with VBScript or JScript

I created a recent solution using Copilot AI help.
Logged
Best Regards, UberDemon/danzigzag, Get UQMG at SAS BAT Mission area.  www.uberdemon.net no longer exists.  (** Alienware Aurora R7 / i7-8700 3.20GHz / 16GB RAM / Win 10 x64 / NVIDIA GeForce GTX 1080 **)

UberDemon

  • UberDemon/danzigzag
  • Modder
  • member
  • Offline Offline
  • Posts: 1553
Re: QMB Pro Missions Missing Markings On Stationary Planes
« Reply #2 on: November 30, 2024, 03:52:03 PM »

Here is the vbscript, file name is "ReplaceText.vbs"

Code: [Select]
Option Explicit

Dim objFSO, objFile, objArgs, strFile, strText1, strText2, includeSubdirs, extension

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments

If objArgs.Count <> 5 Then
    WScript.Echo "Usage: ReplaceText.vbs ""Text String1"" ""Text String2"" ""Subdirectories"" ""file extension"" ""directory"""
    WScript.Quit 1
End If

strText1 = objArgs(0)
strText2 = objArgs(1)
includeSubdirs = objArgs(2)
extension = objArgs(3)
strFile = objArgs(4)

If Left(extension, 1) = "." Then
    extension = Mid(extension, 2)
End If

' Function to replace text in a file
Sub ReplaceTextInFile(filePath, searchText, replaceText)
    Dim fileContent, updatedContent
    Set objFile = objFSO.OpenTextFile(filePath, 1)
    fileContent = objFile.ReadAll
    objFile.Close
   
    updatedContent = Replace(fileContent, searchText, replaceText)
   
    Set objFile = objFSO.OpenTextFile(filePath, 2)
    objFile.Write updatedContent
    objFile.Close
End Sub

' Function to recursively process files in directories
Sub ProcessDirectory(directoryPath)
    Dim folder, file, subfolder
    Set folder = objFSO.GetFolder(directoryPath)
   
    For Each file In folder.Files
        If LCase(objFSO.GetExtensionName(file.Name)) = LCase(extension) Then
            WScript.Echo "Processing " & file.Path
            Call ReplaceTextInFile(file.Path, strText1, strText2)
        End If
    Next
   
    If includeSubdirs = "true" Then
        For Each subfolder In folder.SubFolders
            Call ProcessDirectory(subfolder.Path)
        Next
    End If
End Sub

' Start processing
Call ProcessDirectory(strFile)
WScript.Echo "All files processed."

The parameters are as follows:
1) Text to replace
2) Replacement text
3) Look in subdirectories (true or false)
4) File extension (without ".")
5) Current directory (use "." for directory you are calling from... as in where you are making changes)

In Command prompt you could do the following command:

Code: [Select]
cscript //nologo ReplaceText.vbs " 0.0 null" " 0.0 null 1 1.0 null 1" "false" "mis" "."

or something similar, but be sure you know exactly what you need substituted.

alternatively you could write a batch to invoke many substitutions...

Say, a batch file named "subqmbthings.bat"

Code: [Select]
@echo off
echo Starting update...
:: Call ReplaceText.vbs for different replacements
cscript //nologo ReplaceText.vbs "\nAuthor" " Winter\nAuthor" "false" "properties" "."
cscript //nologo ReplaceText.vbs "Net1Summer/load.ini" "Net1Winter/load.ini" "false" "mis" "."
cscript //nologo ReplaceText.vbs "House$FurnitureSandbags_Round" "House$FurnitureSandbags_Round_W" "false" "mis" "."
cscript //nologo ReplaceText.vbs "House$FurnitureSandbag_Wall" "House$FurnitureSandbag_Wall_W" "false" "mis" "."
cscript //nologo ReplaceText.vbs "House$Tente-QG" "House$Tent_PyramidW_US" "false" "mis" "."
cscript //nologo ReplaceText.vbs "House$Crater100x6" "House$Crater100x6W" "false" "mis" "."
cscript //nologo ReplaceText.vbs "House$Tent_HQ_US" "House$Tent_HQW_US" "false" "mis" "."
cscript //nologo ReplaceText.vbs "House$filet_camouflage1" "House$Tent_HQW_US" "false" "mis" "."
cscript //nologo ReplaceText.vbs "House$AirdromeMaskingnet" "House$AirdromeMaskingnetW" "false" "mis" "."
echo All replacements completed.

that is just a sample that I used to make many substitutions for diorama "mis" files.
Logged
Best Regards, UberDemon/danzigzag, Get UQMG at SAS BAT Mission area.  www.uberdemon.net no longer exists.  (** Alienware Aurora R7 / i7-8700 3.20GHz / 16GB RAM / Win 10 x64 / NVIDIA GeForce GTX 1080 **)

glibble

  • member
  • Offline Offline
  • Posts: 289
  • RTFM Gold Star Award
Re: QMB Pro Missions Missing Markings On Stationary Planes
« Reply #3 on: December 01, 2024, 12:12:57 PM »

Thank you UberDemon for your very detailed reply.
I guess I'll have to learn how to use vb scripts.

Dumb question: do I need to download any software to run .vbs files? Or do I just run it in the command prompt like you mentioned?
Logged

UberDemon

  • UberDemon/danzigzag
  • Modder
  • member
  • Offline Offline
  • Posts: 1553
Re: QMB Pro Missions Missing Markings On Stationary Planes
« Reply #4 on: December 01, 2024, 01:41:59 PM »

Nothing extra.  VBScript runs in Windows natively.
Logged
Best Regards, UberDemon/danzigzag, Get UQMG at SAS BAT Mission area.  www.uberdemon.net no longer exists.  (** Alienware Aurora R7 / i7-8700 3.20GHz / 16GB RAM / Win 10 x64 / NVIDIA GeForce GTX 1080 **)
Pages: [1]   Go Up
 

Page created in 0.046 seconds with 26 queries.