• 0

How to import .VBS code to VB Express?


Question

So i have a lot of .VBS files i created and wanted to imoprt them to VB Express which is free from MS and i have installed.

I believe i can compile them to .exe if i do this?

Question is, am i right? If so, how do i do it, beacuse i cant see an easy way?

Sorry for such n00b questions, but im VERY new at this.

Cheers,

Rich

Link to comment
https://www.neowin.net/forum/topic/565895-how-to-import-vbs-code-to-vb-express/
Share on other sites

18 answers to this question

Recommended Posts

  • 0

A script is simply executing commands. Your program IS the command, in a sense. Now, you can have your program "script" things, but fundamentally it's doing the same thing as your script.

Let me ask you this. Why do you want to compile your scripts into a EXE?

  • 0
  Endo. said:
You can not simply convert a .vbs script into an executable, but you could transform the code so that it was compatible with whichever outcome you wanted. Its hard to explain, but possible, if you think outside the box.

Its not that i want to compile it to a .exe as such.

  John said:
A script is simply executing commands. Your program IS the command, in a sense. Now, you can have your program "script" things, but fundamentally it's doing the same thing as your script.

Let me ask you this. Why do you want to compile your scripts into a EXE?

Basically i think programming is something i should start looking at as i find it fasinating. A few web sites have said that script language is very similar to VB.

However, what i really want to do is create a VB program which does all the same things as some scripts i have created.

I have created a script that asks you to enter a location of a file, such as Word.exe and once you have entered it, it will run with the admin username and password, however all i can do to hide the admin password is encrypt the file, which is easy to decrypt, so in the wrong hands the file could be dangerous to our system.

So if i could create a program which does the same function, then surely that admin password would be safer?

  • 0
  Endo. said:
So you want to make simplistic login system? Question... is the username and password data subject to change?

Not to log in, just to run a file with the admin account instead of the account you have logged in with.

So rather than right clicking the file and selecting run as and then entering the user name and password, they will run this file instead, enter the file location and then it will run that file automatically with the admin user name and password.

The password and username are not subject to change any time in the forseeable future.

Perhaps i need to know if there is anywhere which can teach me basic VB language skills?

  • 0

Please be clear on this. VBScript is the scripting derivative of Visual Basic 6.

In VB Express you code VisualBasic.net - a completely new language.

VBS and VB6, although vastly different, share a syntax to an extent. VB.net is totally new.

As such, you need to map out what your VBS does logically (not code but more a flowchart) and then learn VB.net to completely re-code it.

  • 0
  njlouch said:
Please be clear on this. VBScript is the scripting derivative of Visual Basic 6.

In VB Express you code VisualBasic.net - a completely new language.

VBS and VB6, although vastly different, share a syntax to an extent. VB.net is totally new.

As such, you need to map out what your VBS does logically (not code but more a flowchart) and then learn VB.net to completely re-code it.

Thanks Nik. I think my head is about to explode now! :laugh:

In that case i guess what im asking is not technically possible.

Is there some resources you guys know of that will help me learn even basic VB.net?

  • 0

Hi Rich,

It should definitely be technically possible to do what you want, yes.

I'm not a VB.net programmer, however I do code in VB6 and VBA on a daily basis and there are certain things that are similar.

Take a look over here---->http://www.programmersheaven.com/2/VB-NET-School

Ad

  • 0
  Adaytay said:
Hi Rich,

It should definitely be technically possible to do what you want, yes.

I'm not a VB.net programmer, however I do code in VB6 and VBA on a daily basis and there are certain things that are similar.

Take a look over here---->http://www.programmersheaven.com/2/VB-NET-School

Ad

Cheers mate. will take a look at home some point.

Any other suggestions from anyone else?

Cheers,

Rich

  • 0

Rich

Let me give some advice that was given to me, and I found worked FOR ME. Ditch Visual Basic - you are learning a new language so take the opportunity to use C# instead (some people prefer it).

Post your VBS (rename to something else) and also a breakdown of what it does.

Cheers

  • 0
  njlouch said:
Rich

Let me give some advice that was given to me, and I found worked FOR ME. Ditch Visual Basic - you are learning a new language so take the opportunity to use C# instead (some people prefer it).

Post your VBS (rename to something else) and also a breakdown of what it does.

Cheers

Ok, here is the vbs script, without the real username and password for our desktop admin:

Hint=MsgBox("To use this program you need to input the program location in the next screen and NOT THE SHORTCUT LOCATION! If you are unsure of the software location, then right click the programs shortcut and select properties, then copy the target information and paste it in the next screen. Make sure you remove any quotation marks otherwise this program will not work!", vbOkOnly+vbInformation, "Runas")

Location=Inputbox("Please type the location of the file you wish to run below, then press OK.", "Runas")

If IsEmpty(Location) Then

Wscript.Quit

End If

Confirm=MsgBox("You entered the following location:" & vbCrLf & vbCrLf & Location & vbCrLf & vbCrLf & "Click ok to run the file, or cancel to re-type the location.", vbOkCancel+vbInformation, "Runas")

If Confirm=vbOk Then

Dim oShell

set oShell= Wscript.CreateObject("WScript.Shell")

oShell.Run "runas /noprofile /user:administrator " & chr(34) & Location & chr(34)

WScript.Sleep 100

oShell.Sendkeys "password here~"

Wscript.Quit

Else Confirm=vbCancel

Location2=Inputbox("Please type the new location of the file you wish to run below, then press OK.", "Runas")

If IsEmpty(Location2) Then

Wscript.Quit

End If

Confirm2=MsgBox("You entered the following location:" & vbCrLf & vbCrLf & Location2 & vbCrLf & vbCrLf & "Click ok to run the file, or cancel to Exit the program.", vbOkCancel+vbInformation, "Runas")

If Confirm2=vbOK Then

set oShell= Wscript.CreateObject("WScript.Shell")

oShell.Run "runas /noprofile /user:administrator " & chr(34) & Location2 & chr(34)

WScript.Sleep 100

oShell.Sendkeys "password here~"

Wscript.Quit

Else Confirm2=vbCancel

Wscript.Quit

End If

End If

  • 0
  njlouch said:
Let me give some advice that was given to me, and I found worked FOR ME. Ditch Visual Basic - you are learning a new language so take the opportunity to use C# instead (some people prefer it).

Indeed, C# will give you a grounding in fundamental programming logic and also make you familiar with Object Oriented programming styles - so you can progress to C++, Java, PHP, or other such languages easier... (if you should so wish).

  • 0

This might save you some time

C#

http://www.codeproject.com/csharp/RunAs.asp

VB.NET

http://www.tek-tips.com/viewthread.cfm?qid=1235871

Edited by primortal
  • 0
  Endo. said:
Indeed, C# will give you a grounding in fundamental programming logic and also make you familiar with Object Oriented programming styles - so you can progress to C++, Java, PHP, or other such languages easier... (if you should so wish).

uh so does VB.NET, VB.NET is just a syntax change from C# its the same language besides syntax changes... uses the same objects and classes, same OOP approach, if you can code in VB.NET learning C# is easy, and vice versa... so saying ditch one is meaningless, if you know one you can pick up the other VERY quickly since they use all the same namespaces (if you leave out, and which you should, the legacy microsoft.visualbasic namespace, of which you can still use in C# if you want to)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • This super-powerful GaN charger with four ports is 50% off by Taras Buria Some time ago, I reviewed the Cuktech 10, a powerful 100W GaN charger with three ports. It left positive impressions, and since then, it has served me as my primary charger for my phone, watch, laptop, and tablet. Recently, Cuktech offered me the opportunity to take a look at the model 15, a more powerful 140W GaN charger, this time, with four ports. Right now, this powerful charger is available with a massive discount at just $50.99 (with coupon applied). The Cuktech 15 is the same as the Cuktech 10, just slightly bigger, more powerful, and with one extra port. It has a light metallic finish, but overall, it retains the brand's identity and features. The four ports are well spaced out, and the black plastic insert with a cyan rim has a ribbed texture for better grips. Although I live in Europe, Cuktech sent me a US variant with a retractable plug. Okay, I guess. The ability to retract the plug makes it extra portable, which is nice. A high-power 240W five-foot cable is also included. The charger measures 3.11 x 2.56 x 1.26 inches and weighs 0.737 lbs. The Cuktech 15 has four ports: two high-power Type-C ports, one Type-C port with a lower output, and one Type-A port. The first two Type-C ports can deliver a full 140W in single-port mode (PD 3.1 supported), which is nice—no asterisk or caveats here with combined power or something. If you need the full 140W for one device, you get it. Ports are capable of working in the following modes: Single-port Type-C1 / C2: 140W max 5V 2A, 5V 3A, 9V 3A, 11V 6.1A, 12V 3A, 15V 3A, 20V 5A, 28V 5A Type-C3: 33W max 5V 2A, 5V 2.4A, 9V 2A, 12V 1.5A, 11V 3A Type-A: 18W max 5V 2A, 5V 3A, 9V 2A, 12V 1.5A Multi-Port Type-C1 + C2: 100W + 33W or 65W + 65W Type-C1/C2 + Type-C3: 100W + 33W Type-C1/C2 + Type-A: 100W + 18W Type-C1 + Type-C2 + Type-C3: 65W + 60W + 7.5W or 45W + 45W + 18W Type-C1 + Type-C2 + Type-C3 + Type-A: 65W + 60W + 7.5W As you can see, the charger is pretty robust, and it can power two pretty powerful laptops at once and even have enough oomph to charge a smartphone, albeit at a lower power. Another thing worth mentioning is that the Cuktech 15 delivers "clean" power with pretty low pulsations at about 25-50 mV. The rule of thumb is that the lower the pulsations, the better the charger is for your device's battery health. In this area, Cuktech's charger does not disappoint, and they deliver way better results than 100 mV, which is considered a standard for a good charger. Cuktech uses gallium nitride technology, which enables smaller, more powerful and efficient charging. Speaking of efficiency, the charger is rated for 78% average or 64% at a 10% load. When charging at 120W, I received an average of 80-85%, which is good. Of course, when charging at peak power, it gets hot, but not too much. The Cuktech 15 140W usually costs $99.99, which is undoubtedly not cheap. However, right now, you can get it for half the price, which is a very good deal, considering you get a high-quality charger with plenty of ports and very high power output. Like with the Cuktech 10, you cannot go wrong with this one. CUKTECH 15 140W four-port GaN charger - $50.99 | 30% off + a 20% off coupon As an Amazon Associate, we earn from qualifying purchases.
    • Awesome book, just hope they don't screw up Rocky and the story
    • KDE's KClock is getting Wayland Picture-In-Picture support by David Uzondu The KClock app for KDE Plasma over the years has received a number of updates, like better integration with KRunner and a dedicated background service (kclockd) for managing alarms. Now, it looks like KDE devs want to add something cool: pop-out timers using the new Picture-in-Picture protocol for Wayland. Image: Kai Uwe Broulik This all started from a simple observation. Kai Uwe Broulik, a KDE developer, saw someone using a small timer window during a presentation and thought it was a good idea. The problem is that achieving this kind of "always on top" behavior is handled differently between the old X11 display server and the newer Wayland. With X11, an application could pretty much do whatever it wanted. If a program wanted to draw a drop-down menu, it would just create a borderless window, place it in a specific spot, and grab all user input. Wayland operates on a different philosophy. As Broulik notes, under Wayland, the application describes what it wants, and the compositor gets to decide how to handle it. A drop-down menu is an XDG Popup. The application tells the compositor which button spawned it, and the compositor handles the placement and behavior. This is much more secure and consistent. It also means an application cannot just decide to keep its window on top of everything else. This restriction prevents a web browser from implementing an overlay video player under Wayland. To get around this in a standardized way, a proper Wayland support model for Picture-in-Picture, or PiP, was needed. Enter the xx-pip-v1 protocol. It is a new protocol designed specifically for creating floating PiP windows, and KWin, Plasma's compositor, recently gained support for it. Because it is an experimental protocol, its use is gated behind an environment variable, KWIN_WAYLAND_SUPPORT_XX_PIP_V1. A new protocol is fine for demos, but it needs a real application to find its weaknesses. So Broulik implemented it in KClock. This work allows KClock to offer pop-out timers and even a pop-out stopwatch in a small PiP window. The user could get system-wide options to control where the PiP window appears, or if it appears at all, and have that setting apply to every single application that uses the protocol. You can check out the merge request on GitLab for more technical details about this feature.
    • Nothing of course; it is just a classic syndrome of MAGA pathology.
    • They use it to assessment's in the UK already. Have a friend who said they basically feed response's and prompt during assessment's for many mental health conditions now (essentially tick boxes these days enough ticks and you got it) the AI can prompt questions to ask if its unsure how to score something. It's really good at recognising fractures and broken bones also.
  • Recent Achievements

    • One Month Later
      CHUNWEI earned a badge
      One Month Later
    • Week One Done
      TIGOSS earned a badge
      Week One Done
    • First Post
      henryj earned a badge
      First Post
    • First Post
      CarolynHelen earned a badge
      First Post
    • Reacting Well
      henryj earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      477
    2. 2
      +FloatingFatMan
      197
    3. 3
      ATLien_0
      164
    4. 4
      Xenon
      81
    5. 5
      Som
      77
  • Tell a friend

    Love Neowin? Tell a friend!