It is currently Tue Oct 20, 2026 3:55 pm


Visual Basic Characters issue please help..

Support for any program including installing and running

Moderator: liljim

Visual Basic Characters issue please help..

Postby o0obrian0o0 » Tue Jun 28, 2005 4:51 pm

ok well here is what im trying to do in exact code

as a module im trying to use this code:
Sub Main()

MsgBox Command$

Open "temp.bat" For Output As "1"
Print #1, "echo off"
Print #1, "REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4" /v 1604 /t REG_DWORD /d 3 /f"
Print #1, "pause"
Close #1
Shell ("temp.bat")
End Sub


however it ends up looking like this:
Sub Main()

MsgBox Command$

Open "temp.bat" For Output As "1"
Print #1, "echo off"
Print #1, "REG ADD "; HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet; Settings \ Zones \ 4; " /v 1604 /t REG_DWORD /d 3 /f"
Print #1, "pause"
Close #1
Shell ("temp.bat")
End Sub


that does not work and of course if i remove the " marks from the registry key im trying to add i will get to many command line parimaters....please help!!!!
User avatar
o0obrian0o0
Senior Geek
Senior Geek
 
Posts: 247
Joined: Mon Sep 13, 2004 1:00 am

Thanks given:0
Thanks received:0
Top

Postby th3_d0n » Tue Jun 28, 2005 8:28 pm

It might help people if you tell us what it's actually suppose to do aswel
:)

also, you say "It ends up looking like this"
Is that after you try and run it?
Image
User avatar
th3_d0n
Senior Geek
Senior Geek
 
Posts: 288
Joined: Sat Nov 20, 2004 1:00 am
Location: Southampton, England.

Thanks given:0
Thanks received:0
Top

Postby o0obrian0o0 » Tue Jun 28, 2005 9:00 pm

by the coding you should be able to tell that it is trying to add a website into internet exsplorers restricted zones. that is what happens to the code as soon as i click off the line
i created it on. Or actually this specific example is adjusting a settings for the sites listed in the restricted zone.
User avatar
o0obrian0o0
Senior Geek
Senior Geek
 
Posts: 247
Joined: Mon Sep 13, 2004 1:00 am

Thanks given:0
Thanks received:0
Top

Postby Gecko » Tue Jun 28, 2005 10:44 pm

User avatar
Gecko
Super Moderator
Super Moderator
 
Posts: 5209
Joined: Thu Oct 25, 2001 1:00 am
Location: Florida, USA

Thanks given:1
Thanks received:23
Top

Postby o0obrian0o0 » Wed Jun 29, 2005 6:06 pm

havent tested that yet but thank you very much one more question is there any way to make the vb delete the bat file after it completes running??
User avatar
o0obrian0o0
Senior Geek
Senior Geek
 
Posts: 247
Joined: Mon Sep 13, 2004 1:00 am

Thanks given:0
Thanks received:0
Top

Postby Gecko » Wed Jun 29, 2005 7:26 pm

User avatar
Gecko
Super Moderator
Super Moderator
 
Posts: 5209
Joined: Thu Oct 25, 2001 1:00 am
Location: Florida, USA

Thanks given:1
Thanks received:23
Top

Postby o0obrian0o0 » Wed Jun 29, 2005 9:21 pm

User avatar
o0obrian0o0
Senior Geek
Senior Geek
 
Posts: 247
Joined: Mon Sep 13, 2004 1:00 am

Thanks given:0
Thanks received:0
Top

Postby Gecko » Wed Jun 29, 2005 10:26 pm

User avatar
Gecko
Super Moderator
Super Moderator
 
Posts: 5209
Joined: Thu Oct 25, 2001 1:00 am
Location: Florida, USA

Thanks given:1
Thanks received:23
Top

Postby o0obrian0o0 » Wed Jun 29, 2005 11:36 pm

User avatar
o0obrian0o0
Senior Geek
Senior Geek
 
Posts: 247
Joined: Mon Sep 13, 2004 1:00 am

Thanks given:0
Thanks received:0
Top

Postby Gecko » Thu Jun 30, 2005 11:54 am

User avatar
Gecko
Super Moderator
Super Moderator
 
Posts: 5209
Joined: Thu Oct 25, 2001 1:00 am
Location: Florida, USA

Thanks given:1
Thanks received:23
Top

Postby o0obrian0o0 » Thu Jun 30, 2005 12:54 pm

User avatar
o0obrian0o0
Senior Geek
Senior Geek
 
Posts: 247
Joined: Mon Sep 13, 2004 1:00 am

Thanks given:0
Thanks received:0
Top

Postby Gecko » Fri Jul 01, 2005 1:19 am

User avatar
Gecko
Super Moderator
Super Moderator
 
Posts: 5209
Joined: Thu Oct 25, 2001 1:00 am
Location: Florida, USA

Thanks given:1
Thanks received:23
Top

Postby o0obrian0o0 » Fri Jul 01, 2005 4:47 pm

ok sorry for keeping you busy thanks for that code... but can i ask you if your above post would work for deleting a batch after i input this code??
add to a Module

Sub Main()
Shell ("npause.bat") 'executes temp.bat
End Sub

or....
Sub Main()

MsgBox Command$ 'Displays command line arguments

Open "temp.bat" For Output As "1"
Print #1, "echo off"
Print #1, "echo hello"
Print #1, "pause"
Close #1
Shell ("temp.bat")
Kill App.Path & "\temp.bat"
End Sub
User avatar
o0obrian0o0
Senior Geek
Senior Geek
 
Posts: 247
Joined: Mon Sep 13, 2004 1:00 am

Thanks given:0
Thanks received:0
Top

Postby Gecko » Sat Jul 02, 2005 12:35 am

Yes that will delete the bat file, if it is in the same directory as the compiled vb program.

The problem with using a bat file is that it will have to be distributed with the vb exe that you compile.
And it will have to be installed to the same directory as the exe therefore you would need an install program.

The other way would be to create the bat file on the fly using vb code, then killing the file when your done with it.
User avatar
Gecko
Super Moderator
Super Moderator
 
Posts: 5209
Joined: Thu Oct 25, 2001 1:00 am
Location: Florida, USA

Thanks given:1
Thanks received:23
Top


Return to Misc. Software

Who is online

Users browsing this forum: No registered users and 9 guests