Jump to content

Resize Notepad Windows And My GUI


DCCD
 Share

Recommended Posts

What exactly are you trying to do? Do you have any code?

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

#include <GUIConstants.au3>

WinWaitActive("Untitled - Notepad")
$size = WinGetPos("Untitled - Notepad")
$var = PixelGetColor($size[0]+100,$size[1]+300)

;
;


$Form1 = GUICreate ("My GUI",400 ,400,400,400 ,0x80000000, 0x00000080)

GUISetBkColor ($var)

GUISetState  ()


While 1
    if WinActive ("Untitled - Notepad") Then
        $1=1
    Else
        $1=0
    EndIf
    WinSetOnTop("My GUI", "", $1)
    $state = WinGetState("Untitled - Notepad", "")
    If BitAnd($state, 16) Then
    Exit
    Else
    WinMove($Form1,"",$size[0]+10,$size[1]+200)
    EndIf
    $size = WinGetPos("Untitled - Notepad")
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Edited by DCCD
Link to comment
Share on other sites

Adding "WinMove($Form1,"",$size[0],$size[1], $size[2],$size[3])" does work but there is heaps of flicker.

Either way, you want to get the values from the notepad window then apply them to your form.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

#include <GuiConstantsEx.au3>

Run(@WindowsDir & "\Notepad.exe")
WinWait("[CLASS:Notepad]")

Global $aNotepadWin_Pos = WinGetPos("[CLASS:Notepad]")

$hGUI = GUICreate("Test GUI")
WinMove($hGUI, "", $aNotepadWin_Pos[0], $aNotepadWin_Pos[1], $aNotepadWin_Pos[2], $aNotepadWin_Pos[3])
WinSetOnTop($hGUI, "", 1)

GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    
    $aCurrent_NotepadWin_Pos = WinGetPos("[CLASS:Notepad]")
    
    If IsArray($aCurrent_NotepadWin_Pos) And Not _ArrayCompare($aNotepadWin_Pos, $aCurrent_NotepadWin_Pos) Then
        $aNotepadWin_Pos = $aCurrent_NotepadWin_Pos
        WinMove($hGUI, "", $aNotepadWin_Pos[0], $aNotepadWin_Pos[1], $aNotepadWin_Pos[2], $aNotepadWin_Pos[3])
    EndIf
WEnd

Func _ArrayCompare(ByRef $aArray1, ByRef $aArray2, $iCaseSense=1)
    Local $iUbound1 = UBound($aArray1)
    Local $iUbound2 = UBound($aArray2)
    
    If $iUbound1 <> $iUbound2 Then Return 0
    
    For $i = 1 To $iUbound1-1
        If ($iCaseSense And ($aArray1[$i] == $aArray2[$i]) = False) Or _
            (Not $iCaseSense And $aArray1[$i] <> $aArray2[$i]) Then Return 0
    Next
    
    Return 1
EndFunc

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Really Awesome

MrCreatoR , Thank you so much ^_^ Is There Anything Autoit Can't Do? ;)

#include <GuiConstantsEx.au3>

Run(@WindowsDir & "\Notepad.exe")
WinWait("[CLASS:Notepad]")

Global $aNotepadWin_Pos = WinGetPos("[CLASS:Notepad]")

$hGUI = GUICreate("Test GUI")
WinMove($hGUI, "", $aNotepadWin_Pos[0], $aNotepadWin_Pos[1], $aNotepadWin_Pos[2], $aNotepadWin_Pos[3])
WinSetOnTop($hGUI, "", 1)

GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    
    $aCurrent_NotepadWin_Pos = WinGetPos("[CLASS:Notepad]")
    
    If IsArray($aCurrent_NotepadWin_Pos) And Not _ArrayCompare($aNotepadWin_Pos, $aCurrent_NotepadWin_Pos) Then
        $aNotepadWin_Pos = $aCurrent_NotepadWin_Pos
        WinMove($hGUI, "", $aNotepadWin_Pos[0], $aNotepadWin_Pos[1], $aNotepadWin_Pos[2], $aNotepadWin_Pos[3])
    EndIf
WEnd

Func _ArrayCompare(ByRef $aArray1, ByRef $aArray2, $iCaseSense=1)
    Local $iUbound1 = UBound($aArray1)
    Local $iUbound2 = UBound($aArray2)
    
    If $iUbound1 <> $iUbound2 Then Return 0
    
    For $i = 1 To $iUbound1-1
        If ($iCaseSense And ($aArray1[$i] == $aArray2[$i]) = False) Or _
            (Not $iCaseSense And $aArray1[$i] <> $aArray2[$i]) Then Return 0
    Next
    
    Return 1
EndFunc
Link to comment
Share on other sites

No - some say it can do everything. I want it to make me some coffee ^_^

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...