Muffin Posted April 26, 2008 Share Posted April 26, 2008 (edited) hey im pretty new to writing scripts with auto it, and i need to know how to get a process id.... i already used search, and other common things. i know the WinGetProcess command, but for some reason it isnt workin here is an example what actually should work i think but it doesnt $pid = WinGetProcess ( "Untitled - Notepad" ) ControlSend ( "Untitled - Notepad", "", $pid, "i just dont get it" ) this is just a short example thx in advance edit: btw, i want the script to simulate keystrokes in a window, even when its minimized/hidden Edited April 26, 2008 by Muffin Link to comment Share on other sites More sharing options...
ProgAndy Posted April 26, 2008 Share Posted April 26, 2008 I think you neede a CONTROL ID, not a Process-ID. Instaed of ControlId, you could use ClassNameNN, too You get it with Au3Info Tool *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Muffin Posted April 26, 2008 Author Share Posted April 26, 2008 mh, ty for the fast reply and how to get the control id if i want the script to get it itself? like i wrote with ProcessId Link to comment Share on other sites More sharing options...
ProgAndy Posted April 26, 2008 Share Posted April 26, 2008 Use the CLASSNmeNN, this shouldn't change use "[CLASSNN:ClassnameNNFromAu3Info]" ControlSend("Unbenannt - Editor","","[CLASSNN:Edit1]","TESTSTTGSHF") ControlSend ( "Untitled - Notepad","","[CLASSNN:Edit1]","TESTSTTGSHF" *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Muffin Posted April 27, 2008 Author Share Posted April 27, 2008 nah, okay ty i have one more issue the autoitwindowinfo programm doesnt show the id, classname and this stuff (from control tab) if i want to get control datas from a game i play called silkroad online. its just empty then Link to comment Share on other sites More sharing options...
Muffin Posted April 30, 2008 Author Share Posted April 30, 2008 post, just to not let this topic die..... Link to comment Share on other sites More sharing options...
ProgAndy Posted April 30, 2008 Share Posted April 30, 2008 Tr, if it works, when you let ClassNameNN empty ControlSend("GAME","","","TESTSTTGSHF") *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Muffin Posted April 30, 2008 Author Share Posted April 30, 2008 (edited) ya but the problem is i have the game opened more than once, and i want to send the keys to a certain client/window Edited May 2, 2008 by Muffin Link to comment Share on other sites More sharing options...
Muffin Posted May 5, 2008 Author Share Posted May 5, 2008 dun let this topic die, need your help guys! Link to comment Share on other sites More sharing options...
MikeP Posted May 5, 2008 Share Posted May 5, 2008 (edited) ok.. I rewrote it to fit your game and removed infos about mine so there might be some typos but it should help you a lot : expandcollapse popup#include <GUIConstants.au3> #include <Misc.au3> #Include <WinAPI.au3> Opt("GUIOnEventMode", 1) Opt("WinTitleMatchMode", 2) $mainwindow = GUICreate("SILK Window Select", 250, 120,0,100) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUICtrlCreateLabel("Select SILK client to activate.", 5, 5) $selectcharA = GUICtrlCreateButton("Character A",160 , 30, 80) $selectcharB = GUICtrlCreateButton("Character B",160 , 70, 80) $startbot = GUICtrlCreateButton("Start bot", 30, 90, 80) $mylist = GuiCtrlCreateList("", 1, 30, 140, 60) GUICtrlSetOnEvent($mylist, "ActivateSelected") GUICtrlSetOnEvent($selectcharA, "CHARAButton") GUICtrlSetOnEvent($selectcharA, "CHARBButton") GUICtrlSetOnEvent($startbot, "StartBot") GUICtrlSetState($startbot, $GUI_DISABLE) WinSetOnTop("WinSelect", "", 1) $var = WinList("SILK") $charAselect = 0 $charBselect = 0 Global $charAhandle, $charBhandle Global $activehandle For $i = 1 to $var[0][0] If $var[$i][0] <> "" AND IsVisible($var[$i][1]) and $var[$i][0] <> "WinSelect" Then GUICtrlSetData($mylist,$var[$i][0]&" "&$var[$i][1]) EndIf Next GUISetState(@SW_SHOW) While 1 Sleep(1000) If ($charAselect OR $charBselect ) AND GUICtrlGetState($startbot) <> 80 Then GUICtrlSetState($startbot, $GUI_ENABLE) EndIf WEnd Func ActivateSelected() If GUICtrlRead($mylist) <> "" Then $silkhandle = StringTrimLeft(GUICtrlRead($mylist), 12) WinActivate(HWnd($silkhandle)) $activehandle = HWnd($silkhandle) Else MsgBox(4096, "Error", "Please select a SILK client!") EndIf EndFunc Func CHARAButton() GUICtrlSetState($selectcharA, $GUI_HIDE) $charAhandle = WinGetHandle($activehandle) $charAselect = 1 EndFunc Func CHARBButton() GUICtrlSetState($selectcharB, $GUI_HIDE) $charBhandle = WinGetHandle($activehandle) $charBselect = 1 EndFunc Func startbot() MsgBox(0,"","Starting bot...",3) ;~ ---- ;~ write your bot here ;~ --- EndFunc Func CLOSEClicked() Exit EndFunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Func QuitIt() Exit EndFunc *cough* no I'm not a botter ! ... ^^" .. or .. am I ? Edited May 5, 2008 by MikeP Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 5, 2008 Share Posted May 5, 2008 ya but the problem is i have the game opened more than once, and i want to send the keys to a certain client/windowOpen the helpfile and read about "Controls" specifically INSTANCE. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
MikeP Posted May 5, 2008 Share Posted May 5, 2008 That doesn't work for all windows.. especially for games, you can't get ClassnameNN or Instance number... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now