Sign in to follow this  
Followers 0

put the Process name to Auto Kill [ in GUI ]


15 posts in this topic

Posted

hi guys

see this Simple GUI

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 227, 106, 201, 125)
GUICtrlCreateInput("", 48, 24, 129, 21)
$Button1 = GUICtrlCreateButton("Close", 48, 56, 129, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

is that possible to put the Process name to put it under auto kill like

While 1
ProcessClose("Anything.exe")
Wend

sorry about my english

Share this post


Link to post
Share on other sites



Posted

Put in a text field. Assign it a variable. You enter in the name of the application in that field. When you click on your "Close" button this calls a function that pulls the variable name into the process close command.

That is one way to do it and there are many more ways to go about it.

Share this post


Link to post
Share on other sites

Posted

A quick question TarwadaC4, any reason why you always post the same snippet of code to create a GUI?

Share this post


Link to post
Share on other sites

Posted

cuz im using Koda GUI Creator

is there a problem with that ?

Share this post


Link to post
Share on other sites

Posted

No problem at all, Koda is good program to use, but still doesn't answer why you always post the exact same code.

Share this post


Link to post
Share on other sites

Posted (edited)

Look at GUICtrlRead() and examples for it in helpfile.

Edited by Zedna
1 person likes this

Share this post


Link to post
Share on other sites

Posted

Solved

$input = InputBox("test","Proccess name : ","","")
While 1
If ProcessExists ($input) Then
ProcessClose($input)
EndIf
WEnd

... but this means you need to write another script to kill the script which just killed the task .... right?

Share this post


Link to post
Share on other sites

Posted (edited)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 227, 106, 201, 125)
$input = GUICtrlCreateInput("", 48, 24, 129, 21)
$Button1 = GUICtrlCreateButton("Close", 48, 56, 129, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
   Case $Button1
    While 1
  GUICtrlRead($Input)
    ProcessClose (GUICtrlRead($Input))
   WEnd
EndSwitch
WEnd

Edited by TarwadaC4

Share this post


Link to post
Share on other sites

Posted (edited)

No you cannot since that doesn't work, but that was again explained in the other thread you have going.

Edited by Jos

Share this post


Link to post
Share on other sites

Posted

yeah....

anyway this post solved

Share this post


Link to post
Share on other sites

Posted

Where is the GUICtrlRead? Melba pointed it out in your second thread.

Share this post


Link to post
Share on other sites

Posted

Not really since you still need something to kill your script after it killed the task... or change the script logic not to go into an endless loop.

1 person likes this

Share this post


Link to post
Share on other sites

Posted

i have edit my comment ^^"

thanks

Share this post


Link to post
Share on other sites

Posted

I would pay close attention to what Jos says as you might just learn something. That second loop will not escape so you need to add ExitLoop to the second loop, perhaps If ProcessClose(GUICtrlRead($iInput)) Then ExitLoop

Secondly there is no need for two GUICtrlReads in that loop.

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