Asim Posted January 12, 2011 Share Posted January 12, 2011 Hi, I am writing a script -------- and I paused somewhere in the middle ------- the perpouse of the script is nothing(For Fun). I need Help in: Activating a Notepad Window(Or in other words bring focus to the window.) I know that can be done by : WinActive("[CLASS:Notepad]") But I want to drag the screen meaning the notepad window to the Top to the top of the screen. Please Answer Fast. I really Need Help. If it is not possible by a mouse. Than maybe by pressing "Alt+Scace" And than clicking Move --- to move the screen ... Please Help. Link to comment Share on other sites More sharing options...
nitekram Posted January 12, 2011 Share Posted January 12, 2011 (edited) So if all you want to do is bring it to the top try - WinSetState("[CLASS:Notepad]", "", @sw_maximize) edit spelling Edited January 12, 2011 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Asim Posted January 12, 2011 Author Share Posted January 12, 2011 So if all you want to do is bring it to the top try - WinSetState("[CLASS:Notepad]", "", @sw_maximize) edit spelling Yeh I new that no... But I want it on the side.. Because I have something else open too.. And I want to write on it while that other window is going on. Notepad window will be active and on the side. And the other window open to. I want to learn how to move it too Link to comment Share on other sites More sharing options...
nitekram Posted January 12, 2011 Share Posted January 12, 2011 (edited) so try from the help file - WinMove (as you have a window that you want to move) Lots of ways to search for what you want - normally the name of the function is in the process or process is in the funtion name edit not sure why Edited January 12, 2011 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Varian Posted January 12, 2011 Share Posted January 12, 2011 WinMove() to resize or move a window, unless you're talking about theWindows 7 snap feature Link to comment Share on other sites More sharing options...
Asim Posted January 12, 2011 Author Share Posted January 12, 2011 WinMove() to resize or move a window, unless you're talking about theWindows 7 snap feature I used that.. and its not working... It opens the notepad... put not moving it.. Yes I use Windows 7. Run(@WindowsDir & "\Notepad.exe") WinMove("[CLASS:Notepad]", "", 0, 0, 10, 10) Link to comment Share on other sites More sharing options...
Asim Posted January 12, 2011 Author Share Posted January 12, 2011 I used that.. and its not working... It opens the notepad... put not moving it.. Yes I use Windows 7. Run(@WindowsDir & "\Notepad.exe") WinMove("[CLASS:Notepad]", "", 0, 0, 10, 10) wait I got it... I put sleep(2000) but still problem.. the notpad goes to that really little form... You can see notepad .. than "-""[]""x" ---- thats all you can see after the notepad Link to comment Share on other sites More sharing options...
Varian Posted January 12, 2011 Share Posted January 12, 2011 (edited) Add WinWait() between the 2 linesRun(@WindowsDir & "\Notepad.exe") WinWait("[CLASS:Notepad]") WinMove("[CLASS:Notepad]", "", 0, 0, 10, 10) Edited January 12, 2011 by Varian Link to comment Share on other sites More sharing options...
Varian Posted January 12, 2011 Share Posted January 12, 2011 (edited) wait I got it... I put sleep(2000) but still problem.. the notpad goes to that really little form... You can see notepad .. than "-""[]""x" ---- thats all you can see after the notepad Read the help file on WinMove()..you moved it to x=0, y=o, width=10, height = 10; make the window bigger, or you can move without resizing by using the Default keyword for width or height Edited January 12, 2011 by Varian Link to comment Share on other sites More sharing options...
Asim Posted January 12, 2011 Author Share Posted January 12, 2011 Read the help file on WinMove()..you moved it to x=0, y=o, width=10, height = 10; make the window bigger, or you can move without resizing by using the Default keyword for width or height I got it thxs.. I didnt the help file was that Good.. thxs... umm.. I just have one more question sorry to bother you... but.. is there any program that can get my mouse x, y cordinates? I have been using this script for sooo long... MsgBox( 0, "A.K.", "First Take your Mouse there and than press Enter...") $pos = MouseGetPos() MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1]) And this one is sooo slow... is there any legit program? thxs... Link to comment Share on other sites More sharing options...
Varian Posted January 12, 2011 Share Posted January 12, 2011 I do not know what could be slow about that script. Try this one and see how responsive it is. The Escape key exits the scriptexpandcollapse popupOpt('PixelCoordMode', 2) Opt('MouseCoordMode', 2) Opt('TrayIconDebug', 1) Opt('TrayAutoPause', 0) #include <Misc.au3> _Singleton(@ScriptName, 0) ProcessSetPriority(@AutoItPID, 0) Global $wPos, $mPos, $mClientPos, $mWindowPos, $Text, $wTitle, $Color HotKeySet('{ESC}', '_Quit') While 1 Mouse_Coords() ;Sleep(10) WEnd Func _Quit() ToolTip('') $Text &= 'Mouse Position/Desktop: ' & $mPos[0] & ',' & $mPos[1] & @CRLF $Text &= 'Mouse Position/Window: ' & $mWindowPos[0] & ',' & $mWindowPos[1] & @CRLF $Text &= 'Mouse Position/Client: ' & $mClientPos[0] & ',' & $mClientPos[1] & @CRLF $wPos = WinGetPos('[ACTIVE]', '') $wTitle = StringLeft(WinGetTitle('[ACTIVE]', ''), 15) $Text &= '"' & $wTitle & '" Top-Left Coords: ' & $wPos[0] & ',' & $wPos[1] & @CRLF $Text &= '"' & $wTitle & '" Window Size: ' & $wPos[2] & ',' & $wPos[3] & @CRLF $Text &= 'Color: ' & Hex(PixelGetColor($mClientPos[0], $mClientPos[1]), 6) ClipPut($Text) MsgBox(0, 'Mouse Position Results', $Text) Exit EndFunc ;==>_Quit Func Mouse_Coords() Local $String Opt('MouseCoordMode', 1) $mPos = MouseGetPos() Opt('MouseCoordMode', 0) $mWindowPos = MouseGetPos() Opt('MouseCoordMode', 2) $mClientPos = MouseGetPos() $Color = 'Hex Color: ' & Hex(PixelGetColor($mClientPos[0], $mClientPos[1]), 6) $String &= 'Window Title: ' & StringLeft(WinGetTiTle('[ACTIVE]'), 25) & @LF $String &= 'Relative to Desktop X: ' & $mPos[0] & ' Y: ' & $mPos[1] & @LF $String &= 'Relative to Window X: ' & $mWindowPos[0] & ' Y: ' & $mWindowPos[1] & @LF $String &= 'Relative to Client X: ' & $mClientPos[0] & ' Y: ' & $mClientPos[1] & @LF ToolTip($String & $Color) EndFunc ;==>Mouse_Coords Link to comment Share on other sites More sharing options...
Asim Posted January 12, 2011 Author Share Posted January 12, 2011 I do not know what could be slow about that script. Try this one and see how responsive it is. The Escape key exits the scriptexpandcollapse popupOpt('PixelCoordMode', 2) Opt('MouseCoordMode', 2) Opt('TrayIconDebug', 1) Opt('TrayAutoPause', 0) #include <Misc.au3> _Singleton(@ScriptName, 0) ProcessSetPriority(@AutoItPID, 0) Global $wPos, $mPos, $mClientPos, $mWindowPos, $Text, $wTitle, $Color HotKeySet('{ESC}', '_Quit') While 1 Mouse_Coords() ;Sleep(10) WEnd Func _Quit() ToolTip('') $Text &= 'Mouse Position/Desktop: ' & $mPos[0] & ',' & $mPos[1] & @CRLF $Text &= 'Mouse Position/Window: ' & $mWindowPos[0] & ',' & $mWindowPos[1] & @CRLF $Text &= 'Mouse Position/Client: ' & $mClientPos[0] & ',' & $mClientPos[1] & @CRLF $wPos = WinGetPos('[ACTIVE]', '') $wTitle = StringLeft(WinGetTitle('[ACTIVE]', ''), 15) $Text &= '"' & $wTitle & '" Top-Left Coords: ' & $wPos[0] & ',' & $wPos[1] & @CRLF $Text &= '"' & $wTitle & '" Window Size: ' & $wPos[2] & ',' & $wPos[3] & @CRLF $Text &= 'Color: ' & Hex(PixelGetColor($mClientPos[0], $mClientPos[1]), 6) ClipPut($Text) MsgBox(0, 'Mouse Position Results', $Text) Exit EndFunc ;==>_Quit Func Mouse_Coords() Local $String Opt('MouseCoordMode', 1) $mPos = MouseGetPos() Opt('MouseCoordMode', 0) $mWindowPos = MouseGetPos() Opt('MouseCoordMode', 2) $mClientPos = MouseGetPos() $Color = 'Hex Color: ' & Hex(PixelGetColor($mClientPos[0], $mClientPos[1]), 6) $String &= 'Window Title: ' & StringLeft(WinGetTiTle('[ACTIVE]'), 25) & @LF $String &= 'Relative to Desktop X: ' & $mPos[0] & ' Y: ' & $mPos[1] & @LF $String &= 'Relative to Window X: ' & $mWindowPos[0] & ' Y: ' & $mWindowPos[1] & @LF $String &= 'Relative to Client X: ' & $mClientPos[0] & ' Y: ' & $mClientPos[1] & @LF ToolTip($String & $Color) EndFunc ;==>Mouse_Coords OMG Thxs... Thats is All I needed.. You are Awsome.. Gotta Say...! Awsome! Link to comment Share on other sites More sharing options...
Varian Posted January 12, 2011 Share Posted January 12, 2011 No prob! 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