[Autoit]Help

01/23/2016 17:28 Dexinion#1
Can Someone help me on my process Suspender!?
01/23/2016 19:00 Deverixz#2
First of all, it's not yours. It's just a simple source you copied.
Second, try reading the error line, it will help alot even if the solution or problem is damn simple.
01/23/2016 20:36 alpines#3
Quote:
Originally Posted by Deverixz View Post
First of all, it's not yours. It's just a simple source you copied.
Second, try reading the error line, it will help alot even if the solution or problem is damn simple.
^this and besides try using a better thread title. "Help" doesn't give any relevant information about your problem.
01/24/2016 01:45 Traumhändler#4
ja ne. wenn man die funcs in die while donnert isset ja auch kein wunder das dein script nicht funkt. wenn du schon dir dein source zamm klaust dann mach es doch vernünftig.

isset eig noch erlaubt mit #request4ban oder so? wenn ja würde ich das machen. wenn nicht beachtet das einfach garnicht.
01/29/2016 16:28 [Beatrice]#5
God 1337 0815 hexz coder (c++,c# and autoit) pro coder who doesnt copy paste shit.
Mind checking the error line? God ur being so pro at checking variables on the error line.
Edit : why the fuck you are placing the udf inside while, looks lame.
01/29/2016 18:05 Fuuki#6
Code:
╚►C++/C#/Autoit[Coder]◄╝
Says alot..
01/30/2016 11:24 mlukac89#7
First of all when i puted this code in autoit i get few errors, then i try it it dont work, so here u go working one.

Btw for start process from windows itself u can do it with ShellExecute or Run commands, but in your case u need path to the game exe file so u can start it only with process name because its not in windows core.


Best solution will be to just add 1 more button so u can add path to exe file then write it in ini file or registry and save it when u exit program.


Then when u load program again make function to read registry or ini file where u saved path to game and u will be able to start game from button.


U can test with explorer.exe shut it down and turn back up with button.


Code:

#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ###
$Form1_1 = GUICreate("", 331, 145, 329, 285)
$Button1 = GUICtrlCreateButton("Suspend S4Client", 120, 48, 99, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Resume S4Client", 120, 80, 99, 25, $WS_GROUP)
$process = GUICtrlCreateInput("Process Name!", 112, 16, 121, 21)
$Label1 = GUICtrlCreateLabel("Created By Dexinion", 96, 112, 148, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


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


        Case $button1
            _ProcessSuspend($process)


        Case $button2
            _ProcessResume($process)


    EndSwitch
WEnd


Func _ProcessSuspend($process)


#cs


    Error messages


    Success:    1.
    Failure:    0 and sets the @error flag to non-zero.
    @error:    1 = OpenProcess failed
    2 = AdjustTokenPrivileges Failed
    3 = TerminateProcess Failed
    4 = Cannot verify if process exists
    @extended:    sets to Windows API GetLastError()


#ce
    $process_name = GUICtrlRead($process) ; read process name from input


    ; check if process exists
    If ProcessExists($process_name) Then
        ; close process
        ProcessClose($process_name)
    Else
        ; if any error show message with error number ( if u made this for yourself only leave it as it is, if its for others put friendly user message )
        MsgBox(0, "Info", "There was a error" & @CRLF & "Error " & @error & ", " & @extended)
    EndIf


EndFunc


Func _ProcessResume($process)


    $process_name = GUICtrlRead($process) ; read process name from input


    ShellExecute($process_name)




EndFunc


If u make it for yourself only


Code:

#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 285, 55, 192, 124)
$Button1 = GUICtrlCreateButton("Start S4 League ", 27, 16, 107, 25)
$Button2 = GUICtrlCreateButton("Close S4 League ", 151, 16, 107, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


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


		Case $Button1
			_ProcessResume()


		Case $Button2
			_ProcessSuspend()




	EndSwitch
WEnd


Func _ProcessSuspend()


	$process_name = "S4league.exe" ; change this to right one, i dont know process name
	If ProcessExists($process_name) Then ProcessClose($process_name)


EndFunc


Func _ProcessResume()


	$path_to_game = "C:\Program Files\S4league\S4league.exe" ; change this to yours game path
	ShellExecute($path_to_game)


EndFunc