• 0

Warming up: simple .exe file


Question

Hey guys, I haven't programmed in VB in over a decade and I know a ton has changed. So I'll keep it simple.

 

I still play a game Ghost Recon Advanced Warfighter (GRAW) which came out in 2005.

 

I use a mod for the game named Brettzies Weapons pack 6.0 for GRAW (2005) and then GRAW2 (2007) brettzies weapon pack is 3.02. 

 

Here's the path to the required .bat file C:\Program Files (x86)\Ubisoft\Ghost Recon Advanced Warfighter and C:\Program Files (x86)\Ubisoft\Ghost Recon Advanced Warfighter 2

 

I hope what I want to do is simple. I know days of old a "shell" command would be used to start a program or in today's terms: an application. I'd like to create a simple application that will run the file "bp_weapons_pack_v6.0.bat" which will do this;

file: bp_weapons_pack_v6.0..bat 

graw.exe -o context_bp_weapons_pack_v6.0.xml  (the -o tells GRAW.exe to run the modified .xml file "context_bp_weapons_pack_v6.0.xml

 

can one start a program from an xml file? the .bat file tells GRAW.exe to read/use the bp_weapons_pack_v6.0.xml and it will incorporate the weapon models into GRAW to play the game.

 

Q: What syntax in today's VB (express) is/are used to start external applications? my old mind remembers to create a string

 

Maybe.. DIM GRAW As String or Integer....

 

then I recall faintly Shell calls. Does this -> still apply in shell calls?

 

Q: Why Do I want to do this? because I hate having to open the folder and dbl-click the .bat file everytime I want to use it. that and I'd like to pin the new .exe file/shortcut to my taskbar and start it from my taskbar.

 

I think it might be a simple task but with me, nothing is EVER easy sometimes. :D (yeah, I find that life is easier when I can laugh at myself).

 

Regards,

Chrisj1968

 

 

 

Link to comment
https://www.neowin.net/forum/topic/1303492-warming-up-simple-exe-file/
Share on other sites

23 answers to this question

Recommended Posts

  • 0

ok, the game (modded) runs from the .bat file which tells GRAW which .xml file to use. a lot like switches in games of old like (halflife.exe -devmode -god...)

 

so it has to be something I can execute.. I can't pin a .bat file to my taskbar.. I tried.

  • 0
10 minutes ago, chrisj1968 said:

...

 

 

 

Process.Start("<filename>", "<arguments>")

 

So

 

Process.Start("graw.exe", "-o context_bp_weapons_pack_v6.0.xml")

 

You can find a full example on the MSDN web site about the Process class here:

https://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-3

  • 0
Just now, virtorio said:

Process.Start("<filename>", "<arguments>")

 

So

 

Process.Start("graw.exe", "-o context_bp_weapons_pack_v6.0.xml")

 

You can find a full example on the MSDN web site about the Process class here:

https://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-3

that's MUCH simpler than the old days!  Virtorio, if you're ever in the Reno Area, hit me up, the family and I will treat you to Dinner on me.

  • 0
9 minutes ago, virtorio said:

Process.Start("<filename>", "<arguments>")

 

So

 

Process.Start("graw.exe", "-o context_bp_weapons_pack_v6.0.xml")

 

You can find a full example on the MSDN web site about the Process class here:

https://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-3

Didn't even think about this.

  • 0
2 minutes ago, BinaryData said:

Didn't even think about this.

no worries. you've always have been cool about helping people around here. I'm getting a win32 error in VB but I'm determined to get this working. it compiles fine, I'm missing something so I'll read that link Vitorio gave me.

  • 0
17 minutes ago, chrisj1968 said:

no worries. you've always have been cool about helping people around here. I'm getting a win32 error in VB but I'm determined to get this working. it compiles fine, I'm missing something so I'll read that link Vitorio gave me.

Feel free to post details about the error here. If the output executable is not placed in the games install folder, you will need to provide the full path to the executable, e.g:

 

Process.Start("C:\Program Files (x86)\Ubisoft\Ghost Recon Advanced Warfighter\graw.exe", "-o context_bp_weapons_pack_v6.0.xml")

 

Depending on how the game looks for files you may need to set the "working directory" to the games install folder, for which there is an easy way and a slightly more difficult way.

  • 0
2 minutes ago, virtorio said:

Feel free to post details about the error here. If the output executable is not placed in the games install folder, you will need to provide the full path to the executable, e.g:

 

Process.Start("C:\Program Files (x86)\Ubisoft\Ghost Recon Advanced Warfighter\graw.exe", "-o context_bp_weapons_pack_v6.0.xml")

 

Depending on how the game looks for files you may also set the "working directory" to the games install folder, for which there is an easy way and a slightly more difficult way.

I figured it out. If I created the app to use a button click, I had a ton of work to do and waste. So  I put the code on the form1.form and it boots automatically. I tried to put an Exit in there but it gave me an error.

 

I'm taking baby steps here but it works. I need to create an icon for it. here's the code. I'm relearning to put in comments for easier reading of code reading. good programmers, I remember live by it.

 

App_code.png

Now to pretty it up. I'll give it an Icon and possibly look into adding a check box to run modded or unmodded later

  • 0
13 minutes ago, chrisj1968 said:

I figured it out. If I created the app to use a button click, I had a ton of work to do and waste. So  I put the code on the form1.form and it boots automatically. I tried to put an Exit in there but it gave me an error.

 

I'm taking baby steps here but it works. I need to create an icon for it. here's the code. I'm relearning to put in comments for easier reading of code reading. good programmers, I remember live by it.

 

App_code.png

Now to pretty it up. I'll give it an Icon and possibly look into adding a check box to run modded or unmodded later

Could do an if statement with a check box, if box = check then blah blah else run blah blah. OR just a simple window "Normal Mode: Run!" below it would be "Modded Mode: Run!" and it would run the modded version. I haven't touched vb.net since 2007. I'm learning more of C++ but that's slow going.

  • 0

You don't need to create a program at all. 

Quote
  1. Create a shortcut to your batch file.
  2. Get into shortcut property and change target to something like: cmd.exe /C "path-to-your-batch".
  3. Simply drag your new shortcut to the taskbar. It should now be pinnable.
    http://superuser.com/questions/100249/how-to-pin-either-a-shortcut-or-a-batch-file-to-the-new-windows-7-8-and-10-task

 

 

  • 0
2 hours ago, Andre S. said:

You don't need to create a program at all. 

 

I believe you. I want to get back into programming. so I figured a simple .exe would be a good start. I haven't touched VB since around VB 4 (my age is showing right?). But I Downloaded VB Express 2015 last night and fired it up. I used to teach myself how to create simple databases. Created one that I could catalog all my DVD's in the late 1990's. 

  • 0
9 hours ago, BinaryData said:

Could do an if statement with a check box, if box = check then blah blah else run blah blah. OR just a simple window "Normal Mode: Run!" below it would be "Modded Mode: Run!" and it would run the modded version. I haven't touched vb.net since 2007. I'm learning more of C++ but that's slow going.

Geez, I didn't mean to fry your brain in the middle of learning C++. I might have to learn that language instead. I've heard it's extremely powerful, more so than VB.

  • 0
34 minutes ago, chrisj1968 said:

Geez, I didn't mean to fry your brain in the middle of learning C++. I might have to learn that language instead. I've heard it's extremely powerful, more so than VB.

It depends what's meant by powerful. Both languages have a different purpose. In a broad sence you could say that Ii you need to do low level or system programming, or you want to manage memory yourself, C++ will most likely be better for the job. For other types of applications, the .NET framework provides a rich set of libraries that allow you to write more with less code. This is however a very broad comparison. There is much more to take into consideration, more than I know about :) 

  • 0
Just now, Raphaël G. said:

It depends what's meant by powerful. Both languages have a different purpose. In a broad sence you could say that Ii you need to do low level or system programming, or you want to manage memory yourself, C++ will most likely be better for the job. For other types of applications, the .NET framework provides a rich set of libraries that allow you to write more with less code. This is however a very broad comparison. There is much more to take into consideration, more than I know about :) 

Agreed.

 

@chrisj1968

I've found that C++ is oriented towards more complex and large projects, while VB.Net has been better suited for smaller scale applications. Each language can be used for large or small, all depends on the project. We'll take creating a game for instance. Let's look at World of Warcraft. Yes, it can be developed in VB .Net, but will that suit it best? Probably not. That's where C++ or Assembly comes into play. You could look at Photoshop as another example. I've always found VB .Net to be the perfect tool creation language. It's easy, and straight to the point, while C++ you have to monkey with UI code, perfecting that, and THEN getting your core code in place.

  • 0

Question: I just had an epiphany. while on simple programming, I have a daughter who is on the PC too long. my idea, why can't I create an app that allows me to establish a set time of use, an hour or two and then loggoff automatically. have it run in the background and automatically logoff.

 

what would be a best route approach to this? I'd like to use a simplified way by using the system time feature within Windows 10.

  • 0
12 minutes ago, chrisj1968 said:

Question: I just had an epiphany. while on simple programming, I have a daughter who is on the PC too long. my idea, why can't I create an app that allows me to establish a set time of use, an hour or two and then loggoff automatically. have it run in the background and automatically logoff.

 

what would be a best route approach to this? I'd like to use a simplified way by using the system time feature within Windows 10.

Setup Family Safety. No need to reinvent the wheel.

  • 0
14 minutes ago, chrisj1968 said:

Question: I just had an epiphany. while on simple programming, I have a daughter who is on the PC too long. my idea, why can't I create an app that allows me to establish a set time of use, an hour or two and then loggoff automatically. have it run in the background and automatically logoff.

 

what would be a best route approach to this? I'd like to use a simplified way by using the system time feature within Windows 10.

http://digiparent.weebly.com/

 

This is free and does just that.

  • 0
9 hours ago, chrisj1968 said:

Geez, I didn't mean to fry your brain in the middle of learning C++. I might have to learn that language instead. I've heard it's extremely powerful, more so than VB.

Unless you intend to become a professional programmer in a field that uses C++ extensively (and there are fewer of those than you might think), don't waste your time. I'm not sure what your intentions are but you can write basically anything in VB.Net. Including operating systems and AAA games. If you spend a very long time writing VB you might find that it's somewhat verbose, that most code samples for .NET libraries are in C#, that it's hard to find other highly competent VB programmers to help you online; and that there are lots of really cool languages you could learn to help you become a better programmer (like Haskell, Clojure, Assembly, etc); at which point you might want to learn something else - but probably not C++.

 

Quote

I've found that C++ is oriented towards more complex and large projects, while VB.Net has been better suited for smaller scale applications.

Because of ...? VB.Net is basically a clone of C# with slightly different syntax and some language-specific namespaces and functions to make it easier for beginners and familiar to VB6 programmers. It's statically and quite strongly typed, has namespaces, first-class OOP support and ok FP support, generics, it's supported by ReSharper, it compiles quickly, it produces assemblies that can be easily consumed by any CLI language and turned into NuGet packages for painless inclusion in other projects. C++ actually lacks several of these traits (it has no notion of assemblies and isn't amenable to nice package management like NuGet/Fake, its compilation times are a huge problem on large projects, header file management is pure tedium and doesn't exist in any other language but C, tooling support was far off what you get with Visual Studio/ReSharper for C# and VB last time I checked). I personally found it a huge pain to work on large C++ projects and I had that unfortunate experience at several different companies; this along with many other flaws of the language ultimately drove me towards more productive technologies.

 

I would certainly never write a large project in C++; I might write some parts where I really need something only C++ can give me - placement new, intrinsics, really good codegen - but that's unlikely to be more than 5% of the code.

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

    • No registered users viewing this page.