Sign in to follow this  
Followers 0
y0_Aero

First Script Problems

3 posts in this topic

#1 ·  Posted (edited)

Hello,

Basically i have a script which allows you to enter workstation names into a GUI and click submit, on submit it will run two simple commands via DOS on a loop with the workstation name changed each time.

I'm currently using the code below which doesn't seem to be working for me but i may be setting the variables wrong and how do i get the DOS window to stay active instead of terminating?

The code below runs and displays the GUI, allows me to enter a workstation name and click Run but the CMD windows flashes then dissappears.

$Form1 = GUICreate("Toolbox", 419, 342, 513, 226)
$PageControl1 = GUICtrlCreateTab(0, 8, 444, 336)
$TabSheet2 = GUICtrlCreateTabItem("Program")
$Edit1 = GUICtrlCreateEdit("", 8, 56, 393, 241)
GUICtrlSetData(-1, "Edit1")
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button1 = GUICtrlCreateButton("Run Script", 320, 304, 89, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Button2 = GUICtrlCreateButton("Clear Text", 16, 304, 81, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label1 = GUICtrlCreateLabel("Enter the workstation names below that you would like to remotely DelProf", 8, 32, 407, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Button3 = GUICtrlCreateButton("Export Script", 216, 304, 89, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Button4 = GUICtrlCreateButton("Import File", 112, 304, 89, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ExitLoop
    EndSwitch
WEnd

$EditValue = GUICtrlRead($Edit1) 
$StartService = 
$DelProf = 

workstation() 

Func workstation()
    RunWait (@ComSpec & " /k sc" & $EditValue & "config remoteregistry start= auto && sc" & $EditValue & "start remoteregistry pause" )
    Sleep(500)
    RunWait (@ComSpec & " /k @C:\Program\Program.exe /c:" & $EditValue & "/u /ed:admin* /ed:123* )
    
EndFunc

Also how would i get multiple workstations that have been entered, i've been reading up that i could use StringSplit but then how would i get it to loop the two commands for each workstation?

Any help would be appreciated,

Thanks.

Edited by y0_Aero

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Any errors in your command-line may be causing it to fail.

I'm not aware you can pass something like

@C:\Program\Program.exe

You need to be careful with conflicts too. C:\Program could be seen by the DOS interpreter as meaning C:\Program Files but incorrectly, as it should be something like C:\Progra~1 without quotes.

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thankyou for your reply.

its actually pointing to a path like this:

C:\FolderName/Programname.exe

I just edited out the name of it due to privacy reasons.

Edited by y0_Aero

Share this post


Link to post
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
Sign in to follow this  
Followers 0