Jump to content

Recommended Posts

Hi guy's I have a tool I created for my work place as an IT Helpdesk supporter
I primarily am the second line support, i get calls on a daily basis and have created this tool to help me work much quicker, I am trying at the moment to evolve my program to an exe with a user friendly GUI, my program consists of 3 Bat files which I have added to paste bin with the links below, has anyone any suggestions as to how I could evolve my software, I have visual studio on my PC but have no idea how to get a gui to communicate or incorporate my cli tools, the gui is a whole new world for me and am happy jumping in the deep end, but have no idea where to begin, as I have tried unsuccessfully to create a C + environment on visual studio, tried multiple bat to exe converters hoping for a gui option to point things around, and tried VBS scripts to incorporate my script.
any suggestions.
(sidenote: I have most of my tools in my PSTools folder in its directory " Hence the pointing to PSTools everywhere)

http://pastebin.com/KxQ7KY7s
which opens the next two windows with the IP or host name from the Remote Helper bat
http://pastebin.com/jHSCUqMN and

http://pastebin.com/Hyzegids

also this program is my baby as most of the reg fixes incorporated (but not uploaded) are of my own creations.

Edited by silver-moonshine
Link to comment
Share on other sites

Unfortunately all these programs are command line batch, actually porting them to C++/C/C# might be a bit of a challenge, unless you simply wanted to run them as is from an executable GUI. I prefer C# for desktop GUI development, C# is object oriented, and the syntax is very clean. Most Winforms in C# are basically you just drag and drop a control onto a form (in the designer), change a few settings, and resize to how you want it to look. Then you can double click on elements and it will take you to the form's code implementation, and it will automatically make a click event handler for you for whatever you clicked on. There is a lightning bolt on the properties window you can select to fill in different events with their handlers.

It might be worth knowing what version of Visual Studio you have, I have Visual Studio 2010, but my home PC is a little bit behind.

I am reasonably sure there should be some way of implementing a command line in-between/display for your programs if you did want to keep them as batch files.

I am sure the batch programs could be ported to actual C# etc, or even C/C++ calls used in a C# program, it just depends on what you want.

This might be what you want, except for C#: http://techvalleyprojects.blogspot.com/2012/04/c-using-command-prompt.html

When I learned C# in college I learned it from the book "Microsoft Visual C# 2012 an introduction to object-oriented programming" by Joyce Farrell. If you pick up a C# book, make sure you get current versions, and read the reviews, and be aware of the date the book was written before you buy it.

Link to comment
Share on other sites

Let me just start by saying that as long as it works and gets the job done, it's a solid effort no matter what people say.

Now, people may have a language preference, but as I'm sure you've discovered by now, shell scripting and 'programming in a programming language' are a bit of a world apart.

From your statements on this thus far I get the idea that you have some familiarity with actual programming languages. Could you perhaps elaborate on these a bit?

You see, I could tell you that you should code this in [FILL IN THE BLANK] because it's vastly superior in at least 1 area relative to [TO WHATEVER THE N00B IS CURRENTLY USING] - but that doesn't really help you, does it? So what languages, if any, do you have at least some familiarity with? This would help us advise you in the best way to replicate this in that language, or suggest something in a language that will be very similar and thus quite natural for you to come to grips with and gets you producing something worth bragging about once you've completed it.

You could try to be a hipster and learn either C# or Java which seems to be what all the cool kids use these days, but I would say you're best served with something nearer to what you're already familiar with. Like powershell.

Link to comment
Share on other sites

I'v recently been doing a hell of allot of batch files for work to help me out, but in the past I have used pretty basic C++, Python and java, as well as now dabbling with VBS.
As much as I love my CLI and dont get me wrong, I adore it and have put alot of work into it.
I have gone form v1 to v 2 to v3 and then applied mac logic to version 3.1 to 3.2 etc so forth , I am determined that v5 will have a gui.
Like i said before I have Visual studio , its v2015, and my main issue with any other languages, is how to attach parameters with variables to exe.
this has been my main hurdle in other languages. I can get the basics, but sometimes I get stuck , im going to give it a try in C# today as overwraith suggested. side note, granted iv put alot of work into this script and if anyone does wish to use it , feel free.
cc.exe is relative to crisscontrol as an emergency remote protocol, but side from that, if anyone wishes to use it :) enjoy as it makes my life hellza easy haha :)

Link to comment
Share on other sites

Update : Gui Designed, now for the bloody hard bit of re writing the whole bloody thing.

http://i61.tinypic.com/2yos86e.png

C# tutorials here I come.

Link to comment
Share on other sites

Yeah, iv wrapped my head around that i'm just having issues setting my one text box as a variable to be able to drop in arguments for my exe's however learning a hell of a lot about C# today :)

Link to comment
Share on other sites

I think you will really like C#. Here is another link that may help you out, I used it when getting excel to open two files simultaneously in an excel matching program. The program would change the cell color of cells which didn't match the corresponding cell in excel file #2. The program was used for validating data exported from test/production databases. Matched based on keys specified as a column/label.

http://www.dotnetperls.com/process

I think I also used the page to simultaneously open two html files in notepad++ for side by side viewing/comparison.

I guess the Arguments property of ProcessInfo is just a string, so you will have to make sure you format the string correctly.

https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.arguments%28v=vs.110%29.aspx

You should probably draw out what you want your GUI to look like first, and make sure you are using all the right controls for what you are trying to accomplish.

Edited by overwraith
Link to comment
Share on other sites

For c#, you would indeed be doing a new Process.

Process myProc = new Process();

Then setting up its StartInfo properties.

Also for args, setup a string variable if you'd like.

string myProgramArgs = " /h /t --blablafoobarbla "

The one that handles what executable to launch is:

myProc.StartInfo.FileName = "c:\myProgram.exe" + " " + myPragramArgs;

Sudonicks post below, is more detailed, and is a nice helper method :-).

Edited by DataHead
Link to comment
Share on other sites

This is how I start programs in C#

public static string exec(string program, string args)
{
    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
    startInfo.CreateNoWindow = true;
    startInfo.UseShellExecute = false;
    startInfo.RedirectStandardOutput = true;
    startInfo.FileName = program;
    startInfo.Arguments = args;
    proc.StartInfo = startInfo;
    proc.Start();
    return proc.StandardOutput.ReadToEnd();
}

If you actually want to see the window of the program you will need to change the CreateNoWindow property to false.

You can then open the program like this:

exec("cmd.exe", "netstat -na | FINDSTR LISTEN");

If you care about output you can assign it to a string variable:

string output = exec("cmd.exe", "netstat -na | FINDSTR LISTEN");
MessageBox.Show(output, "Listening Ports");
Edited by sud0nick
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...