Jump to content
Sign in to follow this  
Fire

How to execute correct?

Recommended Posts

Fire

Hi to all.

I create simple GUI for EMET TOOL(from MS) because EMET TOOL has CLI usage.

My trouble is: When i want execute EMET_conf.exe with parameters from script i`m unable write of Guictrlread($a) to shellexecute with parameters. ..

My code below.

I try run & shellexecute but no success.

Here is after execution of my script i get an list of emetized apps.

J:\emetize\emet>EMET_conf.exe --list

EMET 1.0.2

List of EMET-ized processes:

Guictrlread($a) <= This is my trouble:( My input in this case is calc.exe(for ex.) but script writes Guictrlread($a)

I try this with filewrrite and then execute of generated batch file .This method is successfull.

But i dont know where is my mistakes in 1-st method.

How to do this?Have any other ways or may be i`m doing somethink wrong?

Thanks to all.

Sry for my english.

#include <GUIConstants.au3>



$Form1_1 = GUICreate("EMETIZE GUI TOOL", 830, 366, 240, 176)
GUISetBkColor(0x808080)
$Label1 = GUICtrlCreateLabel("EMETIZE GUI ", 320, 8, 124, 24)
GUICtrlSetFont(-1, 12, 800, 2, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetCursor (-1, 3)
$Label2 = GUICtrlCreateLabel("EMetize This Process", 56, 64, 182, 17)
GUICtrlSetFont(-1, 8, 800, 2, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$a=GUICtrlCreateInput("", 312, 64, 193, 21)
$Label3 = GUICtrlCreateLabel("De-Emetize This Process", 48, 160, 193, 17)
GUICtrlSetFont(-1, 8, 800, 2, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$b = GUICtrlCreateInput("", 312, 152, 201, 21)
;$Label4 = GUICtrlCreateLabel("View Emetized Process List", 48, 240, 231, 17)
;GUICtrlSetFont(-1, 8, 800, 2, "MS Sans Serif")
;GUICtrlSetColor(-1, 0xFF0000)
;GUICtrlCreateInput("", 312, 232, 201, 21)
$OK = GUICtrlCreateButton("OK", 544, 64, 137, 25)
GUICtrlSetFont(-1, 8, 800, 2, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Exit = GUICtrlCreateButton("Exit", 344, 312, 121, 25, 0)
$DeEmetize = GUICtrlCreateButton("DeEmetize", 544, 152, 137, 25, 0)
$View = GUICtrlCreateButton("View", 544, 232, 137, 25, 0)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $OK
            if GUICtrlRead($a) = "" Then
                MsgBox(64, "Input Yoxdur!", "Input Yoxdur!")
                Exit
            Else 
                
                
                ShellExecute("EMET_conf.exe", "--add", Guictrlread($a), "" )      ; => My trouble is here.
                
                MsgBox(64, "Emetized!", Guictrlread($a) )
                EndIf
            Case $DeEmetize
                if GUICtrlRead($b) = "" Then
                    MsgBox(64, "Input Yoxdur!", "Input Yoxdur!")
                    Exit
                Else
                    run("EMET_conf.exe --delete Guictrlread($b) ")
                    MsgBox(64, "De-Emetized ", GUICtrlRead($b) )
                EndIf
            case $Exit
                Exit
            Case $View
                run("EMET_conf.exe --list ")
                
    EndSwitch
WEnd

[size="5"] [/size]

Share this post


Link to post
Share on other sites
MariusN

You might try this -->

$b = Guictrlread($a)

Run(@ComSpec & " /c EMET_conf.exe --add "&$b, "", @SW_HIDE)

Share this post


Link to post
Share on other sites
Fire

Thanks for your help bro.I try it but in other syntax.

with cmd.exe /c and i try your method too no success .Unable to write and list of apps is empty after execution.

J:\emetize\emet>EMET_conf.exe --list

EMET 1.0.2

List of EMET-ized processes:


[size="5"] [/size]

Share this post


Link to post
Share on other sites
MariusN

OO i see...it MUST be 2 -- sorry

Ill play with it and see what happens

Edited by MariusN

Share this post


Link to post
Share on other sites
Fire

Yes MariusN usually i use restricted user accaunt but now i logged to admin accaunt with runas.

And all regedit access privilegies i have.But problem is still.

J:\emetize\emet>EMET_conf.exe

EMET 1.0.2

Usage: EMET_conf.exe [--list | --add program.exe | --delete program.exe | --dele

te_all]

Edited by Sh3llC043r

[size="5"] [/size]

Share this post


Link to post
Share on other sites
MariusN

Yes MariusN usually i use restricted user accaunt but now i logged to admin accaunt with runas.

And all regedit access privilegies i have.But problem is still.

J:\emetize\emet>EMET_conf.exe

EMET 1.0.2

Usage: EMET_conf.exe [--list | --add program.exe | --delete program.exe | --dele

te_all]

1) did you copy and paste my code?

2) Did you change the double -- to a single - ?

Share this post


Link to post
Share on other sites
Fire

Yes bro.Your code:

$ba = Guictrlread($a)
Run(@ComSpec & " /c EMET_conf.exe -add "&$ba, "", @SW_HIDE)

I try it yes with "-" (without quotes) problem is still again.


[size="5"] [/size]

Share this post


Link to post
Share on other sites
MariusN

OO i see...it MUST be 2 -- sorry

Ill play with it and see what happens

this works...Take this as a beginning--->

Opt("MustDeclareVars", 1)

Local $test

$test = Run(@ComSpec & " /c EMET_conf.exe --list >"&@HomeDrive&"\test.txt",@HomeDrive); put EMET_conf.exe in c-drive root

tested and worked! now you can just implement it further :)

Share this post


Link to post
Share on other sites
Fire

MariusN Thanks you for take your time for me .Bro i test your scenario it works fine.

But my trouble with GuictrlRead($a)

For example i try analog scenariop for yours Run("cmd.exe /c emet_conf.exe --list>>salam.txt", "") it works bro.

I dont know how to use GuictrlRead($a) in this.

I use it but $a value (which typed by user on dialogBox1 is not writed.And after execution i dont see which application is emetized i see

GuictrlRead($a) on emetized apps.

May be i`m doind something wrong.

Thank your very much for helps.

Imho the rights way for this is:

#include <GUIConstants.au3>
#include <Process.au3>





$Form1_1 = GUICreate("EMETIZE GUI TOOL", 830, 366, 240, 176)
GUISetBkColor(0x808080)
$Label1 = GUICtrlCreateLabel("EMETIZE GUI ", 320, 8, 124, 24)
GUICtrlSetFont(-1, 12, 800, 2, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetCursor (-1, 3)
$Label2 = GUICtrlCreateLabel("EMetize This Process", 56, 64, 182, 17)
GUICtrlSetFont(-1, 8, 800, 2, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$a=GUICtrlCreateInput("", 312, 64, 193, 21)
$Label3 = GUICtrlCreateLabel("De-Emetize This Process", 48, 160, 193, 17)
GUICtrlSetFont(-1, 8, 800, 2, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$b = GUICtrlCreateInput("", 312, 152, 201, 21)
$OK = GUICtrlCreateButton("OK", 544, 64, 137, 25)
GUICtrlSetFont(-1, 8, 800, 2, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Exit = GUICtrlCreateButton("Exit", 344, 312, 121, 25, 0)
$DeEmetize = GUICtrlCreateButton("DeEmetize", 544, 152, 137, 25, 0)
$View = GUICtrlCreateButton("View", 544, 232, 137, 25, 0)
GUISetState(@SW_SHOW)
$file="somebatchfile.bat"
$f1le="EMET_conf.exe --add "



While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $OK
            if GUICtrlRead($a) = "" Then
                MsgBox(64, "Input Yoxdur!", "Input Yoxdur!")
                Exit
            Else 
                filewrite($file, $f1le)
                filewrite($file, Guictrlread($a) & @CRLF)
                Run($file, "", @SW_HIDE )
                sleep(2000)
               FileDelete($file)                
                MsgBox(64, "Emetized!", Guictrlread($a) )
                EndIf
            Case $DeEmetize
                if GUICtrlRead($b) = "" Then
                    MsgBox(64, "Input Yoxdur!", "Input Yoxdur!")
                    Exit
                Else
                    
                    run("EMET_conf.exe --delete Guictrlread($b) ")
                    MsgBox(64, "De-Emetized ", GUICtrlRead($b) )
                EndIf
            case $Exit
                Exit
            Case $View
                run("EMET_conf.exe --list ")
                
    EndSwitch
WEnd
Edited by Sh3llC043r

[size="5"] [/size]

Share this post


Link to post
Share on other sites
MariusN

#include <GUIConstants.au3>

Opt("MustDeclareVars", 1)

Local $a, $b, $DeEmetize, $Exit, $Form1_1, $Label1, $Label2, $Label3, $Label4, $nMsg, $OK, $test, $View, $c, $e

$Form1_1 = GUICreate("EMETIZE GUI TOOL", 830, 366, 240, 176)

GUISetBkColor(0x808080)

$Label1 = GUICtrlCreateLabel("EMETIZE GUI ", 320, 8, 124, 24)

GUICtrlSetFont(-1, 12, 800, 2, "MS Sans Serif")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetCursor(-1, 3)

$Label2 = GUICtrlCreateLabel("EMetize This Process", 56, 64, 182, 17)

GUICtrlSetFont(-1, 8, 800, 2, "MS Sans Serif")

GUICtrlSetColor(-1, 0xFF0000)

$a = GUICtrlCreateInput("", 312, 64, 193, 21)

$Label3 = GUICtrlCreateLabel("De-Emetize This Process", 48, 160, 193, 17)

GUICtrlSetFont(-1, 8, 800, 2, "MS Sans Serif")

GUICtrlSetColor(-1, 0xFF0000)

$c = GUICtrlCreateInput("", 312, 152, 201, 21)

$OK = GUICtrlCreateButton("OK", 544, 64, 137, 25)

GUICtrlSetFont(-1, 8, 800, 2, "MS Sans Serif")

GUICtrlSetColor(-1, 0xFF0000)

$Exit = GUICtrlCreateButton("Exit", 344, 312, 121, 25, 0)

$DeEmetize = GUICtrlCreateButton("DeEmetize", 544, 152, 137, 25, 0)

$View = GUICtrlCreateButton("View", 544, 232, 137, 25, 0)

GUISetState(@SW_SHOW)

While 1

$b = GUICtrlRead($a)

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

ExitLoop

Case $OK

$b = GUICtrlRead($a)

If $b = "" Then

MsgBox(64, "Input Yoxdur!", "Input Yoxdur!")

Else

$test = Run(@ComSpec & " /c EMET_conf.exe --add " & $b, @HomeDrive)

MsgBox(64, "Emetized!", $:); this must be a $b

EndIf

Case $DeEmetize

$e = GUICtrlRead($c)

If $e = "" Then

MsgBox(64, "Input Yoxdur!", "Input Yoxdur!-2")

Else

Run(@ComSpec & " /c EMET_conf.exe --delete " & $e, @HomeDrive)

MsgBox(64, "De-Emetized ", $e)

EndIf

Case $Exit

Exit

Case $View

Run(@ComSpec & " /c EMET_conf.exe --list > " & @HomeDrive & "\test.txt", @HomeDrive)

RunWait("notepad.exe " & @HomeDrive & "\test.txt")

EndSwitch

WEnd

Edited by MariusN

Share this post


Link to post
Share on other sites
Fire

Great Job MariusN Thanks you very very much.Really you help me .Thank you++

I never forget your help for me.Thanks. :)

Edited by Sh3llC043r

[size="5"] [/size]

Share this post


Link to post
Share on other sites
MariusN

Great Job MariusN Thanks you very very much.Really you help me .Thank you++

I never forget your help for me.Thanks. :)

pleasure...Just remember the "smily" must be $b...dunno why the site does this...lol

Share this post


Link to post
Share on other sites
PsaltyDS

pleasure...Just remember the "smily" must be $b...dunno why the site does this...lol

Put code tags around script code to avoid that.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
MariusN

Put code tags around script code to avoid that.

:)

thanks 'PsaltyDS'...will it also tidy the code?

Share this post


Link to post
Share on other sites
PsaltyDS

thanks 'PsaltyDS'...will it also tidy the code?

No, that would require too much scripting at the web server. It just preserves (mostly) the formatting you put in it, like leading whitespace so indentation is preserved, not interpreting smilies, etc.

Any code you post should be run through Tidy in SciTE, then pasted inside code tags. It will also automatically put long code in a scrollable box.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.