Banner
Views: 236,308,548
Time: 2013-05-22 04:15:10 PM
19 users online: Akireyano, Amos Defamos, Archie, Dakras Hayashi, Epsilon, Koopster, LaughingLuigi, leod, Lui37, MarioBros980, MarioFan22, Masterlink, natnew, Ragey, Shinnok, slakkmichael, o Tahixham, wiiqwertyuiop, Z0mbie1337 - Guests: 29 - Bots: 13Users: 22,863 (1,279 active)
Latest: LONTOR505
Tip: Make sure you can beat your own levels without savestates, slowdown, or rewinding.
[VB08] CMD Scripts? (Close please)
Forum Index - Hobbies - Computers & Technology - [VB08] CMD Scripts? (Close please)
Pages: « 1 » Thread Closed
I'm trying to patch a asm file to a rom via xkas, but it's not working. It won't patch!
Here's the code, the cmd code in bold.

Code
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If CheckBox1.Checked = True Then If System.IO.File.Exists(TextBox1.Text) = True Then System.IO.File.Copy(TextBox1.Text, romcopy) MsgBox("Backup has been succesfully made!", MsgBoxStyle.Information, "Backup Made!") GoTo StartPatch Else MsgBox("File does not exist! Will instead patch the rom without making a backup.", MsgBoxStyle.Critical, "Error 1.00!") End If End If StartPatch: If System.IO.File.Exists(TextBox1.Text) = True And System.IO.File.Exists(TextBox2.Text) = True Then Shell("xkas.exe " + TextBox2.Text + TextBox1.Text) MsgBox("Rom has been successfully patched!", MsgBoxStyle.Information, "Rom patched!") ElseIf System.IO.File.Exists(TextBox1.Text) = False Then MsgBox("ROM does not exist!", MsgBoxStyle.Critical, "Error 1.01!") ElseIf System.IO.File.Exists(TextBox2.Text) = False Then MsgBox("ASM file does not exist!", MsgBoxStyle.Critical, "Error 1.02!") End If End Sub
Last edited on 2009-11-27 06:55:17 AM by x-treme.
Although, I'm not to frequent in VB08, I don't know if it matters but it might work if you have this:
Shell("xkas.exe " + TextBox2.Text + TextBox1.Text,AppWinStyle.MinimizedNoFocus)


It would probably be a good idea to make that bolded line this:

Shell("xkas.exe \"" + TextBox2.Text + "\" \"" + TextBox1.Text + "\"")

I don't know much about VB08, but I'm assuming that the \ character indicates an escape sequence, allowing you to represent the quotation marks without closing the string.

Putting quote marks around the filenames allows you to have spaces in the filenames. Also, can I recommend you type out the full path to xkas?
I'm assuming you want the names passed as separate arguments right?
Then, assuming xkas.exe is in the current directory:
Shell("xkas.exe """ & TextBox2.Text & """ """ & TextBox1.Text & """")

otherwise, use:
Shell("""C:\Path to xkas\xkas.exe"" """ & TextBox2.Text & """ """ & TextBox1.Text & """")

Two double quotes escape to a single double quote when used in a string.

So, the second one would look like this:
"C:\Path to xkas\xkas.exe" "Contents of TextBox2.Text" "Contents of TextBox1.Text"
Shell("xkas.exe " + TextBox2.Text + TextBox1.Text)
should be
Diagnostics.Process.Start("xkas.exe " & TextBox2.Text & " " & TextBox1.Text)
You'll probably need the space in between the two textbox texts.
Then, you'll have executed
xkas.exe abc 123
Originally posted by Iceplug
Shell("xkas.exe " + TextBox2.Text + TextBox1.Text)
should be
Diagnostics.Process.Start("xkas.exe " & TextBox2.Text & " " & TextBox1.Text)
You'll probably need the space in between the two textbox texts.
Then, you'll have executed
xkas.exe abc 123

Actually, that doesn't work. Although using my previous example, you could use:
Diagnostics.Process.Start("C:\Path to xkas\xkas.exe", """" & TextBox2.Text & """ """ & TextBox1.Text & """")

Technically you shouldn't need to specify the Diagnostics Namespace in there, as it's automatically imported. So you could just say Process.Start
Last edited on 2009-11-26 09:09:52 PM by sonicmike2.
Oh, you actually need the quotes?
Well, nevermind what I said earlier.
No, the problem with yours is that Process.Start(fileName As String) doesn't accept arguments. You need to use Process.Start(fileName As String, arguments As String)
Sonicmike2's code worked. Thanks to everybody though. :)
This can be closed I guess. :)
Thread(this.ID).Close();
Pages: « 1 » Thread Closed
Forum Index - Hobbies - Computers & Technology - [VB08] CMD Scripts? (Close please)

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2013 - SMW Central
Legal Information - Link To Us


Total queries: 27

Menu