Jump to content

Few Questions from a newbie


Recommended Posts

Hi everyone!

First, I'd like to say THANK YOU for creating AutoIt and also to everyone who contributes their knowledge and expertise to help people such as myself. It's rather difficult in most cases (in my opinion/past experiences) to get help from people that program and/or script without somehow being attached to their little click so a site/community such as this is just fantastic!

I suppose now it's time for my question(s).

I've been toying with Autoit now for a few months trying to learn different things but mostly a different scripting language rather than batch. Here's what I think I'm looking to do and am looking just for general direction.

I've been creating an Autoit script that will run some XP CMD commands mostly dealing with the net shell (NETSH) but have found that the message boxes are rather annoying and have decided to try with the GUI. What I would like to know if it is rather simple to A.) Make a list of my DOS commands in a seperate file(i.e. store the commands in commands.txt) or in a separate function then B.) Have my gui loop through the file or function and perfom each command while C.) Displaying the output of the command from the Prompt to the GUI Window/Control adn also D.) putting that same output along with other stuff from the GUI to a logfile.

If it helps, here's a better idea of what the script looked like in a batch file.

ECHO This can take some time so please be patient
ECHO -----NETSH SHOW HELPER----- >%mylog%
netsh show helper >>%mylog%
ECHO ----END NETSH SHOW HELPER---- >>%mylog%

ECHO. >>%mylog%

ECHO ----NETSH DIAG SHOW ALL---- >>%mylog%
netsh diag show all >>%mylog%
ECHO ----END NETSH DIAG SHOW ALL---- >>%mylog%

With this GUI, I'd also like to add parameteres to it. For example if I compiled this script to say myprog.exe could I give it parameters that would make it run a certain function like C:\myprog.exe /function1 . Reason being is because during some of the commands that are used you have to restart the computer and instead of the whole thing running over again I'd like it to just pick up where it left off.

If you think it would help to answer these questions with the original batch file that I've created please let me know and I'd be happy to attach it to a reply.

I think that's about all for now and I'm sorry if this is too long of a post for being a first timer here. Any help would be much appreciated!

Sincerely and Thankfully,

PartieHonteuse

Edit: It seems as though a better query for the search has lead me to answer my own Q (letter C). Located here if anyone else is interested http://www.autoitscript.com/forum/index.ph...topic=19161&hl=

Edited by PartieHonteuse
Link to comment
Share on other sites

ok, i think everything is possible

a) i'd suggest a ini-file, that would look like

[Command]1=...

2=...

...

[done]

done=0

:lmao: this might look like

$a = inireadsection ("this.ini", "Command")
$done = iniread("this.ini", "done", "done", 0)
$exec = $done + 1
for $i = $exec to $a[0][0] step 1
run (iniread("this.ini", "Command", $i, ""))
next

this is as well the solution for your "i want to start this function later on (after restart)"-problem

d) if you solved c than just do

filewrite ("yourlog.txt", "whatever from c" & @crlf)

hope this all works, no time to test

very basic as well but it should do the job

oops forgot 1 thing

opt ("onexitfunc", "leaveme")
;...
func leaveme()
iniwrite ("this.ini", "done", "done", $i)
endfunc

just add the opt thing in front of your script and the rest at the end

Edited by Nuffilein805
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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