Old:Bugs 3.5-Apollo: Start vbs

From The Uniform Server Wiki
Revision as of 12:55, 21 June 2013 by BobS (talk | contribs) (BobS moved page Bugs 3.5-Apollo: Start vbs to Old:Bugs 3.5-Apollo: Start vbs without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Uniform Server 3.5-Apollo known bugs or issues.

Disk Start.vbs

Bug fix: Stop database from starting when using Disk Start.vbs

File: Disk Start.vbs
Location: *\Uniform Server

Problem: MySQL server runs even after clicking the option not to run.
Solution: Edit the file as follows:

Change the following:
t=MsgBox("Start the MySQL Database Server?", vbYesNo + vbQuestion, "Database Support")

If intDoIt = vbNo Then
m=""
Else
m=" mysql"
End If
W:\usr\local\apache2\bin>


To this:
t=MsgBox("Start the MySQL Database Server?", vbYesNo + vbQuestion, "Database Support")

If t = vbNo Then
m=""
Else
m=" mysql"
End If
W:\usr\local\apache2\bin>

This solution, although it is correct, the script will not work!
There is a bug in Server_Start.bat; parameter %2 is not checked.
If %2 is reinstated in Server_Start.bat, the above script needs to pass the correct parameters as follows:

To this:
t=MsgBox("Start the MySQL Database Server?", vbYesNo + vbQuestion, "Database Support")

If t = vbNo Then
m=" nomysql"
Else
m=" mysql"
End If
W:\usr\local\apache2\bin>

On the forum I proposed an enhancement to the VBS where the drive letter is automatically detected unfortunately I also did not return the correct parameters. The following alternative solution takes this into account.

Alternative Solution

I have hacked the beta script around resolving issues mentioned above. In addition I added two enhancements: auto detection of first free drive letter and option to run a command prompt. Note: For this script to run correctly, Server_Start.bat must be updated as described on this page.

Problem: MySQL server runs even after clicking the option not to run.
Solution: Proposed solution Edit the file as follows:

Proposed script:
' Name: disk_start.vbs
' Location: Uniform Server
' Created By: The Uniform Server Development Team
' Edited Last By: Olajide Olaolorun (empirex)
' Comment: Re-Arranged everything to look nicely.
' To Developers: Added the MySQL start option.
' MPG: Added auto drive detect and command prompt select

Dim WSHShell, dir, fso, letter, str1, str2, str3, str4
Set fso = CreateObject("Scripting.FileSystemObject")
Set WSHShell = WScript.CreateObject("WScript.Shell")

'Locate next available drive letter -- Added MPG
letter=Asc("c")
while fso.DriveExists(Chr(letter)+":")
letter=letter+1
wend

' Build string to display
str1 = "Use free drive found click OK or" & vbCR
str2 = "Specify a Disk Drive letter then click OK" & vbCR
str3 = "Note: To abort click Cancel"
str4 = str1 & str2 & str3
s=InputBox( str4 ,"Server Disk",UCASE(Chr(letter)))

If s = "" Then
WScript.Quit
End If
s=mid(s,1,1)

t=MsgBox("Start the MySQL Database Server?", vbYesNo + vbQuestion, "Database Support")
If t = vbNo Then
m=" nomysql"
Else
m=" mysql"
End If

c=MsgBox("Start a Command Prompt for MySQL commands?", vbYesNo + vbQuestion, "MySQL Command-line Support")
If c = vbNo Then
cl=""
Else
cl=" console"
End If

WSHShell.run "Server_Start.bat "&s&m&cl,0,0
WScript.sleep(1000)


Download

Download this file disk_start.vbs.txt save it as disk_start.vbs copy to folder Uniform Server.

Note: This will not overwrite any files. Use as is or rename it to Disk Start.vbs

Forum reference

Additional information or background can be found on these forum pages.

Thanks to Marshy | forum post for pointing out this problem.

Proposed solution

See alternative solution above.



Ric