xcxooxl Posted February 24, 2007 Share Posted February 24, 2007 is it possible to get the window title from process? and if possible please how.. Link to comment Share on other sites More sharing options...
_Kurt Posted February 24, 2007 Share Posted February 24, 2007 WinGetTitle? Check the helpfile. Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 24, 2007 Moderators Share Posted February 24, 2007 WinGetTitle? Check the helpfile. KurtHow does that get it from a process? Func _WinGetByPID($iPID, $nArray = 1);0 will return 1 base array; leaving it 1 will return the first visible window it finds If IsString($iPID) Then $iPID = ProcessExists($iPID) Local $aWList = WinList(), $sHold For $iCC = 1 To $aWList[0][0] If WinGetProcess($aWList[$iCC][1]) = $iPID And _ BitAND(WinGetState($aWList[$iCC][1]), 2) Then If $nArray Then Return $aWList[$iCC][0] $sHold &= $aWList[$iCC][0] & Chr(1) EndIf Next If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1)) Return SetError(1, 0, 0) EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
JohnBailey Posted March 6, 2007 Share Posted March 6, 2007 Smoke_N, I'm missing something, especially since xcxooxl didn't respond with any questions. I can't seem to retrieve the Wintitle of a process. Here's what I did expandcollapse popupHotKeySet('{ESC}',"terminate") ;My attempt $wintitleProcess = _WinGetByPID(1248) MsgBox(0,"my Name",$wintitleProcess) ; List all processes $list = ProcessList() run("notepad.exe") WinWaitActive("Untitled - Notepad") for $i = 1 to $list[0][0] send($list[$i][0]&" - handler: "&$list[$i][1]&@CRLF) next ; <> ------- Functions ---------- <> ;Smoke_N's WinGetByPID Func _WinGetByPID($iPID, $nArray = 1);0 will return 1 base array; leaving it 1 will return the first visible window it finds If IsString($iPID) Then $iPID = ProcessExists($iPID) Local $aWList = WinList(), $sHold For $iCC = 1 To $aWList[0][0] If WinGetProcess($aWList[$iCC][1]) = $iPID And _ BitAND(WinGetState($aWList[$iCC][1]), 2) Then If $nArray Then Return $aWList[$iCC][0] $sHold &= $aWList[$iCC][0] & Chr(1) EndIf Next If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1)) Return SetError(1, 0, 0) EndFunc Func terminate() exit EndFunc ;<> ---------- end of functions -----<> A decision is a powerful thing Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 6, 2007 Moderators Share Posted March 6, 2007 Smoke_N, I'm missing something, especially since xcxooxl didn't respond with any questions. I can't seem to retrieve the Wintitle of a process. Here's what I did HotKeySet('{ESC}',"terminate") ;My attempt $wintitleProcess = _WinGetByPID(1248) MsgBox(0,"my Name",$wintitleProcess) ; List all processes $list = ProcessList() run("notepad.exe") WinWaitActive("Untitled - Notepad") for $i = 1 to $list[0][0] send($list[$i][0]&" - handler: "&$list[$i][1]&@CRLF) next ; <> ------- Functions ---------- <> ;Smoke_N's WinGetByPID Func _WinGetByPID($iPID, $nArray = 1);0 will return 1 base array; leaving it 1 will return the first visible window it finds If IsString($iPID) Then $iPID = ProcessExists($iPID) Local $aWList = WinList(), $sHold For $iCC = 1 To $aWList[0][0] If WinGetProcess($aWList[$iCC][1]) = $iPID And _ BitAND(WinGetState($aWList[$iCC][1]), 2) Then If $nArray Then Return $aWList[$iCC][0] $sHold &= $aWList[$iCC][0] & Chr(1) EndIf Next If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1)) Return SetError(1, 0, 0) EndFunc Func terminate() exit EndFunc ;<> ---------- end of functions -----<>oÝ÷ Ûú®¢×¢ê''[ayû§rبÜy©Ý"¯zz"uæ°«uÛ"±.q©í¯&®¶sd×6t&÷cBÂb33´æfòb33²Âb33µFFÆRÒb33²fײõvävWD'B&ö6W74W7G2b33¶æ÷FWBæWRb33²¤gVæ2õvävWD'Bb33c¶BÂb33c¶ä'&Ò³vÆÂ&WGW&â&6R'&²ÆVfærBvÆÂ&WGW&âFRf'7Bf6&ÆRvæF÷rBfæG0¢b57G&ærb33c¶BFVâb33c¶BÒ&ö6W74W7G2b33c¶B¢Æö6Âb33c¶tÆ7BÒväÆ7BÂb33c·4öÆ@¢f÷"b33c¶42ÒFòb33c¶tÆ7E³Õ³Ð¢bvävWE&ö6W72b33c¶tÆ7E²b33c¶45Õ³ÒÒb33c¶BæBð¢&DäBvävWE7FFRb33c¶tÆ7E²b33c¶45Õ³ÒÂ"FVà¢bb33c¶ä'&FVâ&WGW&âb33c¶tÆ7E²b33c¶45ճТb33c·4öÆBf׳Òb33c¶tÆ7E²b33c¶45Õ³Òfײ6"¢VæD`¢æW@¢bb33c·4öÆBFVâ&WGW&â7G&æu7ÆB7G&æuG&Õ&vBb33c·4öÆBÂÂ6"¢&WGW&â6WDW'&÷"¤VæDgVæ0That works fine. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
JohnBailey Posted March 6, 2007 Share Posted March 6, 2007 Smoke_N, I totally was using your function wrong. My apologies as for the 1248 without explanation. It was the process id of sorts for QuickTimeMainPlayer.exe that was running on my system but was not shown. I figured out how to display it. However, it's a complicated mess. I want to study your script indepth. I'll do so mañana. My eyes are heavy and brain no worky. Thank you for your reply! I look forward to really understanding the script more indepth. I'll also post what I did in another thread (don't want to totally change topics here). A decision is a powerful thing Link to comment Share on other sites More sharing options...
JohnBailey Posted March 6, 2007 Share Posted March 6, 2007 What does &= mean? I've been searching for an answer, but I've found nothing conclusive.Other than that, I understand the script and think it's great! I never noticed that ProcessExist returns a PID.Note: This is not to hi-jack this thread. Further discussion on the below script, we should start a new thread. The script I have below is very messy and Smoke_N's function is MUCH better in achieving what I want to do.First I obtained the winName via#include <Array.au3> #include <File.au3> HotKeySet('{ESC}',"terminate") Global $write, $iCC, $aWL _FileArrayWinList("winList.txt") ;mTry Func _FileArrayWinList($hFile) If FileExists($hFile) Then FileDelete($hFile) EndIf Local $array = WinList(),$i, $sHold = '' For $i=1 to Ubound($array)-1 $sHold = $array[$i][1] &" - "& $array[$i][0]& @CRLF FileWrite($hFile, $sHold) Next ;$write = _FileWriteFromArray($hFile, $array,1) EndFunc Func terminate() exit EndFuncoÝ÷ Ù8^¬yÖ®¶sevå6WE7FFRgV÷CµV6µFÖUÆW$ÖâgV÷C²ÂgV÷C²gV÷C²Ä5uõ$U5Dõ$RThe above script is available as promised to show what I was doing and to compare the ease of Smoke_N's method to mine. Thanks Smoke_N!! A decision is a powerful thing Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 6, 2007 Moderators Share Posted March 6, 2007 http://www.autoitscript.com/autoit3/docs/i...g_operators.htm Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
JohnBailey Posted March 6, 2007 Share Posted March 6, 2007 AWESOME!! This is going to be so useful! A decision is a powerful thing Link to comment Share on other sites More sharing options...
DigitalIsBetter Posted March 14, 2008 Share Posted March 14, 2008 I tired to use your function but its not woriking for me could you give me some pointers on what Im doing wrong? When I when I run this now it renames the autoit program. Any help is appreciated. Thank you. I'm trying to rename the Title to what the Name is in Memory. In Fuction Refresh() --->WinSetTitle (_WinGetByPID($Process2) ,"", $Mem_Read1) expandcollapse popup#include <GUIConstants.au3> #include <NomadMemory.au3> #Include <GuiListView.au3> $Name = StringReplace(StringRight(IniRead(@ScriptDir & "\ma-global.inf", "MemAdd", "CharName", "NotFound"),7),"h","0x00",0);name $Level = StringReplace(StringRight(IniRead(@ScriptDir & "\ma-global.inf", "MemAdd", "CharLV", "NotFound"),7),"h","0x00",0);level $XP = StringReplace(StringRight(IniRead(@ScriptDir & "\ma-global.inf", "MemAdd", "CharName", "NotFound"),7),"h","0x00",0);xp $VP = StringReplace(StringRight(IniRead(@ScriptDir & "\ma-global.inf", "MemAdd", "CharVP", "NotFound"),7),"h","0x00",0);vp $XCord = StringReplace(StringRight(IniRead(@ScriptDir & "\ma-global.inf", "MemAdd", "OrdX", "NotFound"),7),"h","0x00",0);x coord $YCord = StringReplace(StringRight(IniRead(@ScriptDir & "\ma-global.inf", "MemAdd", "OrdY", "NotFound"),7),"h","0x00",0);y coord $Cyclone = StringReplace(StringRight(IniRead(@ScriptDir & "\ma-global.inf", "MemAdd", "CharEffects", "NotFound"),7),"h","0x00",0);cyclone $Zoom = StringReplace(StringRight(IniRead(@ScriptDir & "\ma-global.inf", "MemAdd", "ClientZoom", "NotFound"),7),"h","0x00",0);zoom #region var Dim $List_Item[15] $List_Item[0] = 0 $List_Item[1] = 0 $List_Item[2] = 0 $List_Item[3] = 0 $List_Item[4] = 0 $List_Item[5] = 0 $List_Item[6] = 0 $List_Item[7] = 0 $List_Item[8] = 0 $List_Item[9] = 0 $List_Item[10] = 0 $List_Item[11] = 0 $List_Item[12] = 0 $List_Item[13] = 0 $List_Item[14] = 0 #endregion $Form1_1 = GUICreate("B2DM", 427, 142, 250, 169) $List1 = GUICtrlCreateListView("Name | Speed ", 0, 0, 161, 107) $Button1 = GUICtrlCreateButton("Refresh", 0, 110, 65, 20) $Group1 = GUICtrlCreateGroup("Options", 320, 0, 95, 125) $Checkbox1 = GUICtrlCreateCheckbox("Speed", 322, 20, 50, 17) $Button2 = GUICtrlCreateButton("Set", 338, 102, 45, 20) $Label11 = GUICtrlCreateLabel("Zoom:", 322, 50, 34, 17) $Input1 = GUICtrlCreateInput("256", 360, 47, 50, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlCreateUpdown ($Input1) GUICtrlSetLimit ($Input1, 600 ,150 ) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Player", 163, 0, 145, 125) $Label1 = GUICtrlCreateLabel("Name:", 165, 20, 35, 17) $Label2 = GUICtrlCreateLabel("Level:", 165, 40, 33, 17) $Label3 = GUICtrlCreateLabel("Percent:", 165, 60, 44, 17) $Label4 = GUICtrlCreateLabel("Vp:", 165, 80, 20, 17) $Label5 = GUICtrlCreateLabel("Coords:", 165, 100, 40, 17) $Label6 = GUICtrlCreateLabel("", 198, 20, 96, 17) $Label7 = GUICtrlCreateLabel("", 198, 40, 96, 17) $Label8 = GUICtrlCreateLabel("", 208, 60, 96, 17) $Label9 = GUICtrlCreateLabel("", 188, 80, 96, 17) $Label10 = GUICtrlCreateLabel("", 205, 100, 100, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 HotKeySet("^f", "Focus") LoadOption() LoadAbout() Update() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Refresh() Case $Button2 Zoom() Case $Checkbox1 Speed() EndSwitch WEnd Func _WinGetByPID($iPID, $nArray = 0);0 will return 1 base array; leaving it 1 will return the first visible window it finds If IsString($iPID) Then $iPID = ProcessExists($iPID) Local $aWList = WinList(), $sHold For $iCC = 1 To $aWList[0][0] If WinGetProcess($aWList[$iCC][1]) = $iPID And _ BitAND(WinGetState($aWList[$iCC][1]), 2) Then If $nArray Then Return $aWList[$iCC][0] $sHold &= $aWList[$iCC][0] & Chr(1) EndIf Next If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1)) Return SetError(1, 0, 0) EndFunc Func Refresh() GUICtrlDelete($List1) $List1 = GUICtrlCreateListView("Name |Speed", 0, 0, 161, 107) $num1 = 0 $Process1 = ProcessList ("conquer.exe") Do If $Process1[0][0] <> 0 Then $num1 = $num1 +1 $Process2 = $Process1[$num1][1] $Mem_Open1 = _MemoryOpen($Process2) $Mem_Read1 = _MemoryRead($Name, $Mem_Open1, 'char[16]');name _MemoryClose($Mem_Open1) $List_Item[$num1] = GUICtrlCreateListViewItem ( $Mem_Read1, $List1) IniWrite(@ScriptDir & "\Speed.ini", $Mem_Read1, "window", $Process2) IniWrite(@ScriptDir & "\Speed.ini", $Mem_Read1, "list", $Process2) WinSetTitle (_WinGetByPID($Process2) ,"", $Mem_Read1) EndIf Until $num1 = $Process1[0][0] EndFunc Func Zoom() $GUI_Read3 = GUICtrlRead($Input1);value of zoom input $GUI_Read4 = GUICtrlRead($Label6);label name $INI_Read1 = IniRead(@ScriptDir & "\Speed.ini", $GUI_Read4, "window", 0) If $GUI_Read4 = "" Then Else If $GUI_Read3 > 149 And $GUI_Read3 < 601 Then #region mem write $Mem_Open1 = _MemoryOpen($INI_Read1) _MemoryWrite($Zoom,$Mem_Open1,$GUI_Read3);zoom IniWrite(@ScriptDir & "\Speed.ini", $GUI_Read4, "Zoom", $GUI_Read3) _MemoryClose($Mem_Open1) #endregion Else MsgBox(48,"Error","Zoom must be between 150-600") EndIf EndIf EndFunc Func Speed() $GUI_Read4 = GUICtrlRead($Label6);label name $GUI_Read5 = GUICtrlRead($Checkbox1) $INI_Read1 = IniRead(@ScriptDir & "\Speed.ini", $GUI_Read4, "window", 0) If $GUI_Read4 = "" Then Else #region mem write If $GUI_Read5 = $GUI_CHECKED Then $Mem_Open1 = _MemoryOpen($INI_Read1) _MemoryWrite($Cyclone,$Mem_Open1,128);cyclone on IniWrite(@ScriptDir & "\Speed.ini", $GUI_Read4, "Cyclone", "128") _MemoryClose($Mem_Open1) EndIf If $GUI_Read5 = $GUI_UNCHECKED Then $Mem_Open1 = _MemoryOpen($INI_Read1) _MemoryWrite($Cyclone,$Mem_Open1,0);cyclone off IniWrite(@ScriptDir & "\Speed.ini", $GUI_Read4, "Cyclone", "0") _MemoryClose($Mem_Open1) EndIf #endregion EndIf EndFunc Func LoadAbout() $GUI_Read1 = GUICtrlRead($List1) $GUI_Read2 = _GUICtrlListView_GetItemText($List1, $GUI_Read1 - 25);current sel GUICtrlSetData($Label6, $GUI_Read2) $INI_Read1 = IniRead(@ScriptDir & "\Speed.ini", $GUI_Read2, "window", 0) If $GUI_Read2 = "" Then GUICtrlSetData($Label7, "0");level GUICtrlSetData($Label8, "0");percent GUICtrlSetData($Label9, "0");vp GUICtrlSetData($Label10, "0");x,y Else #region mem read $Mem_Open1 = _MemoryOpen($ini_Read1) $Mem_Read2 = _MemoryRead($Level, $Mem_Open1);level $Mem_Read3 = _MemoryRead($XP, $Mem_Open1);xp $Mem_Read4 = _MemoryRead($VP, $Mem_Open1);vp $Mem_Read5 = _MemoryRead($XCord, $Mem_Open1);x coord $Mem_Read6 = _MemoryRead($YCord, $Mem_Open1);y coord _MemoryClose($Mem_Open1) #endregion $INI_Read2 = IniRead(@ScriptDir & "\Speed.ini","Experience",$Mem_Read2,0) GUICtrlSetData($Label7, $Mem_Read2);level GUICtrlSetData($Label8, Round ($Mem_Read3/$INI_Read2 * 100, 7));percent GUICtrlSetData($Label9, $Mem_Read4);vp If $Mem_Read5 = 0 And $Mem_Read6 = 0 Then GUICtrlSetData($Label10, "Attacking or Jumping") Else GUICtrlSetData($Label10, $Mem_Read5 & "," & $Mem_Read6);x,y EndIf EndIf Sleep(25) EndFunc Func LoadOption() $GUI_Read1 = GUICtrlRead($List1) $GUI_Read2 = _GUICtrlListView_GetItemText($List1, $GUI_Read1 - 25);current sel $GUI_Read4 = GUICtrlRead($Label6) If $GUI_Read2 <> $GUI_Read4 Then $INI_Read3 = IniRead(@ScriptDir & "\Speed.ini",$GUI_Read2,"Zoom",256) $INI_Read4 = IniRead(@ScriptDir & "\Speed.ini",$GUI_Read2,"Cyclone",0) GUICtrlSetData($Input1, $INI_Read3);zoom If $INI_Read4 = 0 Then GUICtrlSetState ( $Checkbox1,$GUI_UNCHECKED) ElseIf $INI_Read4 = 128 Then GUICtrlSetState ( $Checkbox1,$GUI_CHECKED) EndIf EndIf EndFunc Func Update() $var1 = 0 $List_Count = _GUICtrlListView_GetItemCount($List1) If $List_Count = 0 Then ElseIf $List_Count > 0 Then Do $GUI_Read6 = _GUICtrlListView_GetItemText($List1,$var1) $var1 = $var1 + 1 $INI_Read1 = IniRead(@ScriptDir & "\Speed.ini", $GUI_Read6, "window", 0) $INI_Read5 = IniRead(@ScriptDir & "\Speed.ini",$GUI_Read6,"Cyclone",0) $Mem_Open1 = _MemoryOpen($INI_Read1) If $INI_Read5 = 128 Then GUICtrlSetData ( $List_Item[$var1],"|on") _MemoryWrite($Cyclone,$Mem_Open1,128) ElseIf $INI_Read5 = 0 Then GUICtrlSetData ( $List_Item[$var1],"|off") EndIf _MemoryClose($Mem_Open1) Until $var1 = $List_Count EndIf EndFunc Func Focus() $GUI_Read4 = GUICtrlRead($Label6) $INI_Read1 = IniRead(@ScriptDir & "\Speed.ini", $GUI_Read4, "window", 0) $INI_Read2 = IniRead(@ScriptDir & "\Speed.ini", $GUI_Read4, "list",0) WinActivate ($GUI_Read4) EndFunc Func OnAutoItExit() $num1 = 0 $Process1 = ProcessList ("conquer.exe") Do If $Process1[0][0] <> 0 Then $num1 = $num1 +1 $Process2 = $Process1[$num1][1] $Mem_Open1 = _MemoryOpen($Process2) $Mem_Read1 = _MemoryRead($Name, $Mem_Open1, 'char[16]');name _MemoryWrite($Cyclone,$Mem_Open1,0);cyclone off _MemoryClose($Mem_Open1) $List_Item[$num1] = GUICtrlCreateListViewItem ( $Mem_Read1, $List1) IniWrite(@ScriptDir & "\Speed.ini", $Mem_Read1, "window", $Process2) IniWrite(@ScriptDir & "\Speed.ini", $Mem_Read1, "list", $Process2) WinSetTitle ($Mem_Read1, "", "[Conquer2.0]") EndIf Until $num1 = $Process1[0][0] EndFuncB2DM.rar 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