Jump to content

Emmhor1

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by Emmhor1

  1. Thanks I will take a look at this
  2. Could you set this up for me and then i Will expanderen it with my needs
  3. I managed to get it to work these are the changes First Func Char1() While 1 Local $hWnd = WinWait($Class, "", 10) Local $iState = WinGetState($hWnd) If BitAND($Title, $WIN_STATE_EXISTS) Then WinActivate($Title) Else Exit EndIf Sleep(2000) Send("{q down}") Send("{q up}") Sleep(2000) WEnd EndFunc If I use this setup in both Functions only 1 is being executed But if I change it to this it works: Func Char1() WinActivate($Title) Sleep(5000) Send("{q down}") Send("{q up}") EndFunc The next problem is the functions itself. The functions contain a While this means it won't execute the second function because the first function is still in it's loop Func Char1() While 1 WinActivate($Title) Sleep(5000) Send("{q down}") Send("{q up}") WEnd EndFunc Func Char2() While 1 WinActivate($Title) Sleep(5000) Send("{a down}") Send("{a up}") WEnd EndFunc Is it possible to run the 2 functions at the same time? EDIT: Managed to get it to work by not calling the function but by running a external script The thing with this is I will have to create a lot of scripts imagine having 20 charactet this means 20 scripts atleast If BitAnd(GUICtrlRead($Character1),$GUI_CHECKED) = $GUI_CHECKED Then $PID = Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\test.au3' & '"') EndIf If BitAnd(GUICtrlRead($Character2),$GUI_CHECKED) = $GUI_CHECKED Then $PID = Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\test1.au3' & '"')
  4. I found out yesterday I had no Case $button I added it and now it seems to work but only for 1/2 functions again they don't run together
  5. That doesn't seem to run the function.
  6. Hi mLipok, Thanks for you reply although I managed to find my script I mentioned above. I modified it a bit: This is my original script #requireadmin #include <GUIConstantsEx.au3> #pragma compile(Icon, C:\Program Files (x86)\AutoIt3\Aut2Exe\Icons\AutoIt_Main_v10_48x48_256.ico) $state = "UNCHECKED" ;CHECK BOXES $gui=GUICreate("VidaXL App Installer", 500, 340) ;Standard Applications $app1 = GUICtrlCreateCheckbox("7 Zip", 20, 30, 120, 20) $app2 = GUICtrlCreateCheckbox("Google Chrome", 20, 50, 120, 20) $standardSoftware = GUICtrlCreateLabel("Standard Software", 20, 10, 120, 20) GUICtrlSetColor($StandardSoftware, 0x93117E) GUICtrlSetFont($StandardSoftware,10,Default,Default,"Comic Sans MS") $select=GUICtrlCreateButton("Select All", 20, 235, 100, 20) $deselect=GUICtrlCreateButton("Deselect All", 20, 255, 100, 20) $select2=GUICtrlCreateButton("Select All", 200, 235, 100, 20) $deselect2=GUICtrlCreateButton("Deselect All", 200, 255, 100, 20) $select3=GUICtrlCreateButton("Select All", 380, 235, 100, 20) $deselect3=GUICtrlCreateButton("Deselect All", 380, 255, 100, 20) $button=GUICtrlCreateButton("Start Installation", 150, 290, 200, 20) $cancelbutton=GUICtrlCreateButton("Cancel", 150, 310, 200, 20) $msg=GUISetState() While 1 Switch GUIGetMsg() Case $select GUICtrlSetState($app1, $GUI_CHECKED) GUICtrlSetState($app2, $GUI_CHECKED) Case $deselect GUICtrlSetState($app1, $GUI_UNCHECKED) GUICtrlSetState($app2, $GUI_UNCHECKED) Case $button If BitAnd(GUICtrlRead($app1),$GUI_CHECKED) = $GUI_CHECKED Then RunWait("\\sl051-file-01\IT Workstation\Software\Standard\7Zip.exe") EndIf If BitAnd(GUICtrlRead($app2),$GUI_CHECKED) = $GUI_CHECKED Then RunWait("\\sl051-file-01\IT Workstation\Software\Standard\Chrome.exe") EndIf Case $GUI_EVENT_CLOSE MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat') Exit Case $cancelbutton MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat') Exit EndSwitch WEnd This works. As you see I get a GUI with 2 checkboxes. If I select app1 it only installs app1 if I select app1 and app2 it installs both and if I silect app2 it only installs app2 But like you see it uses runwait to run the EXE. In the new situation I have not created multiple exe's but more functions within the script This is what I use now: $app1 = GUICtrlCreateCheckbox("Char1", 20, 30, 120, 20) $app2 = GUICtrlCreateCheckbox("Char2", 20, 50, 120, 20) $select=GUICtrlCreateButton("Select All", 20, 235, 100, 20) $deselect=GUICtrlCreateButton("Deselect All", 20, 255, 100, 20) $button=GUICtrlCreateButton("Start Installation", 150, 290, 200, 20) $cancelbutton=GUICtrlCreateButton("Cancel", 150, 310, 200, 20) $msg=GUISetState() While 1 Switch GUIGetMsg() Case $select GUICtrlSetState($app1, $GUI_CHECKED) GUICtrlSetState($app2, $GUI_CHECKED) Case $deselect GUICtrlSetState($app1, $GUI_UNCHECKED) GUICtrlSetState($app2, $GUI_UNCHECKED) Case $button If BitAnd(GUICtrlRead($app1),$GUI_CHECKED) = $GUI_CHECKED Then Call("Char1") EndIf If BitAnd(GUICtrlRead($app2),$GUI_CHECKED) = $GUI_CHECKED Then Call("Char2") EndIf Case $GUI_EVENT_CLOSE MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat') Exit Case $cancelbutton MsgBox(0, 'Thank you for using!', 'Made by Emmanuel Horvat') Exit EndSwitch WEnd Func Char1() WHAT THE FUNCTION DOESN BUT IT"S NOT IMPORTANT FOR NOW EndFunc Func Char2() As you see it is the exact same but instead of runwait I use Call to select the function to run. If I select Char1 it runs char1 function without issues If I select char2 it runs char2 function without issues If I select both it only runs char1 How do I make it to run the selected functions correctly.So if I select char1 and char2 that it runs both not only the first one.
  7. Hi All, MAIN QUESTION: Is it possible to Call specific function within a GUI So I have a script with multiple functions although I don't want to use every function every time. My Idea is to create a simple GUI which allows me to select what functions I want to use then run the funtions by clicking a button. I have already made a GUI which allows me to select specific .exe's I would like to run after selection it runs the .exe one by one. This script is on my work laptops and cannot access it right now. Who can help me with this? GUIcreate Func1 Func2 Func3 Then have a boxes which allows me to select the specif Func.(I used GUIChecked and Unchecked in my other script) Then a button which executes/calls the selected functions
  8. Hello, I need a script that's not so hard to make for someone with some experience. this is what it has to do : I needs to work in a active window and then do the following: First the script has to press space bar then sleep for 6000MS(1minute) after that it has to press CTRL + SHIFT +CLICK ON a pixel I can change whenever I need to.Then sleep for 6000ms again. After that It has to press 10x on NUMPAD 2 and Repeat the script over and over and over again
  9. Hello, So I have this basic script and lately it started behaving weird. Whenever I activate the script it looks like there is a very fast slideshow going on in the game i'm running. However i'm not losing any or barely any fps. it scans but seems to be really slow. 1/10 times this problems does not appear! that single times it runs smoothly without it looking like a slideshow. This is a part of the script that cause the slideshow. Click() Func Click() While 1 If _WinAPI_GetAsyncKeyState(0x12) = True Then Sleep(0) Local $coord = PixelSearch(922, 498, 996, 563, 12191508, 30) If Not @error Then MouseClick("Left") Sleep(0) EndIf EndIf WEnd EndFunc I tried to use different sleep speeds but that is not effecting it putting the sleep to 0 makes i quicker thats why I use it. As second I cannot make this faster right? Make autoit use more resources for example?
  10. Well it doesnt seem to work my it still does the action whgen I click pause, It only pauses for 10 ms if im correct Edit:it also makes my app lagg heavy
  11. This seems very easy but im struggling. Is it possible to make your script pause if a key is being pressed and hold? I can pause the script by clicking a key but I wan't to pause it if alt is being pressed for example.
  12. Well here is the script #include <WinAPI.au3> ;$colors = [0xBA0714, 0xBA0715] If WinExists(@ScriptName) Then Exit AutoItWinSetTitle(@ScriptName) Global $Paused, $counter = 0 HotKeySet("{F3}", "TogglePause") HotKeySet("{F2}", "Terminate") Dance() Func Dance() While 1 If _WinAPI_GetAsyncKeyState(0x02) = True Then Local $coord = PixelSearch(950,541,968,523,0xBA0715) ;Local $coord = PixelSearch(950,541,968,523$colors) If Not @error Then MouseClick("Left") Sleep(80) EndIf EndIf WEnd EndFunc While 1 $counter +=1 WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ;ToolTip('Script is "Paused"',0,0, $counter, 1) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc the colors variable doesn't work so, does anyone have any idea's.
  13. Hello. Here is my script ;________________________________________________ #include <WinAPIEx.au3> If WinExists(@ScriptName) Then Exit AutoItWinSetTitle(@ScriptName) ;________________________________________________ ;________________________________________________ ;________________________________________________ Global $Paused, $counter = 0 HotKeySet("{F3}", "TogglePause") HotKeySet("{F2}", "Terminate") Shoot() ;________________________________________________ ;________________________________________________ ;________________________________________________ Func Shoot() While 1 Local $coord = PixelSearch(948,540,978,570,12330018,40) If Not @error Then MouseClick("Left") EndIf WEnd EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ While 1 $counter +=1 WEnd ;________________________________________________ ;________________________________________________ ;________________________________________________ Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ;ToolTip('Script is "Paused"',0,0, $counter, 1) WEnd ToolTip("") EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ Func Terminate() Exit 0 EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ I Installed theWinAPIEx Libary But when I execute this script I get a Error Message Cannot Redeclare constant. >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\manuelhorvat\Desktop\HACK!.au3" "C:\Program Files (x86)\AutoIt3\Include\WinAPIEx.au3" (969) : ==> Can not redeclare a constant.: Global Const $tagBITMAPINFOHEADER = 'dword biSize;long biWidth;long biHeight;ushort biPlanes;ushort biBitCount;dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant;' Global Const ^ ERROR But when I remove the #include I dont get the Error... __________________________________________________________________________________________________________________________________________________________________ Another thing that could help aswell. The same script! ;________________________________________________ If WinExists(@ScriptName) Then Exit AutoItWinSetTitle(@ScriptName) ;________________________________________________ ;________________________________________________ ;________________________________________________ Global $Paused, $counter = 0 HotKeySet("{F3}", "TogglePause") HotKeySet("{F2}", "Terminate") Shoot() ;________________________________________________ ;________________________________________________ ;________________________________________________ Func Shoot() While 1 Local $coord = PixelSearch(948,540,978,570,12330018,40) If Not @error Then MouseClick("Left") EndIf WEnd EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ While 1 $counter +=1 WEnd ;________________________________________________ ;________________________________________________ ;________________________________________________ Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ;ToolTip('Script is "Paused"',0,0, $counter, 1) WEnd ToolTip("") EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ Func Terminate() Exit 0 EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ Whenever my XHair turns Red(The color I assigned it shoots) what code in my script do I need so It shoots when Im pressing RMB? This is the script i have in my mind. #include <WinAPIEx.au3> If WinExists(@ScriptName) Then Exit AutoItWinSetTitle(@ScriptName) Global $Paused, $counter = 0 HotKeySet("{F3}", "TogglePause") HotKeySet("{F2}", "Terminate") Shoot() Func Shoot() While 1 If _WinAPI_GetAsyncKeyState(0x02) = True Then Local $coord = PixelSearch(629, 512, 649, 490,12191508,20) If Not @error Then MouseClick("Left") Sleep(150) EndIf EndIf WEnd EndFunc While 1 $counter +=1 WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ;ToolTip('Script is "Paused"',0,0, $counter, 1) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc But I get the same cannot redeclare constant ERROR
×
×
  • Create New...