Rawox Posted January 2, 2009 Share Posted January 2, 2009 Hi, Is there an possible option to open 2 notepad windows beside each other and switch between them... Detailed Idea: Script opens 2 notepad windows, 1 on the left of the screen and one on the right. Script activates the first window, types some text. Script activates second window, types some text. etc. Any Ideas, or simple scripts? I'm not really good with AutoIt!! Tnx! Link to comment Share on other sites More sharing options...
Olsson Posted January 2, 2009 Share Posted January 2, 2009 Maybe like you said, and then look at "WinActivate" function? Link to comment Share on other sites More sharing options...
FireFox Posted January 2, 2009 Share Posted January 2, 2009 @Rawox Script opens 2 notepad windows, 1 on the left of the screen and one on the right.WinMove("[CLASS:Notepad]",'',x,y) Script activates the first window, types some text.WinActivate("[CLASS:Notepad]") WinWaitActive("[CLASS:Notepad]",'',3) ControlSend("[CLASS:Notepad]",'',15,"your text") Cheers, FireFox. Link to comment Share on other sites More sharing options...
Rawox Posted January 2, 2009 Author Share Posted January 2, 2009 @Rawox WinMove("[CLASS:Notepad]",'',x,y) WinActivate("[CLASS:Notepad]") WinWaitActive("[CLASS:Notepad]",'',3) ControlSend("[CLASS:Notepad]",'',15,"your text") Cheers, FireFox. Tnx! nice Icon btw Link to comment Share on other sites More sharing options...
trinitrotoluen Posted January 2, 2009 Share Posted January 2, 2009 Can you code the program to open 10 notepad at the same time and type some text at the same time Link to comment Share on other sites More sharing options...
FireFox Posted January 2, 2009 Share Posted January 2, 2009 @trinitrotoluenat the same timeNot possible...Cheers, FireFox. Link to comment Share on other sites More sharing options...
trinitrotoluen Posted January 2, 2009 Share Posted January 2, 2009 @trinitrotoluenNot possible...Cheers, FireFox.OK, Can you teach me how to switch from notepad 1 to notepad 2 then 3 ... Link to comment Share on other sites More sharing options...
Malkey Posted January 2, 2009 Share Posted January 2, 2009 Hi, Is there an possible option to open 2 notepad windows beside each other and switch between them... Detailed Idea: Script opens 2 notepad windows, 1 on the left of the screen and one on the right. Script activates the first window, types some text. Script activates second window, types some text. etc. Any Ideas, or simple scripts? I'm not really good with AutoIt!! Tnx! This is an example script you can experiment with. expandcollapse popup#include <SendMessage.au3> #include <WindowsConstants.au3> Opt("WinWaitDelay", 0) If Not WinExists('[CLASS:Notepad]') Then Run(@WindowsDir & '\Notepad.exe') WinActivate('[CLASS:Notepad]') WinWait('[CLASS:Notepad]') $hRNotepad = WinGetHandle('[CLASS:Notepad]') $iWidth = (@DesktopWidth / 2) - 10 $iHeight = (@DesktopHeight / 2) $y = (@DesktopHeight / 4) WinMove($hRNotepad, "", (@DesktopWidth / 2) + 5, $y, $iWidth, $iHeight) WinSetTitle(WinGetTitle($hRNotepad), "", "R") Run(@WindowsDir & '\Notepad.exe') WinActivate("Untitled - ") WinWait("Untitled - ") $hLNotepad = WinGetHandle("Untitled - ") $iWidth = (@DesktopWidth / 2) - 10 $iHeight = (@DesktopHeight / 2) $y = (@DesktopHeight / 4) WinMove($hLNotepad, "", 5, $y, $iWidth, $iHeight) ControlSetText($hLNotepad, "", "", "Left Notepad 1st entry") WinActivate($hRNotepad) WinWait($hRNotepad) Send("{ENTER}") WinWait($hRNotepad) ControlSend($hRNotepad, "", "", "ControlSend Right Notepad N0. 1.{ENTER}") WinWait($hRNotepad) Send("{ENTER}") ControlSend($hRNotepad, "", "", "ControlSend Right Notepad No 2.{ENTER}") WinActivate($hLNotepad) WinWait($hLNotepad) Send("^{END}{ENTER}") ControlSend($hLNotepad, "", "", "ControlSend left Notepad 2nd Entry A{ENTER}B") WinWait($hLNotepad) WinActivate($hRNotepad) WinWait($hRNotepad) Send("{ENTER}") ClipPut("ClipPut Right Notepad.") _SendMessage($hRNotepad, $WM_COMMAND, $WM_PASTE, 0) ; $WM_PASTE, 0) Send("{ENTER}") WinActivate($hLNotepad) WinWait($hLNotepad) Send("{ENTER}") ControlSend($hLNotepad, "", "", "Last ControlSend Left Notepad ") WinWait($hLNotepad) Send("^{END}{ENTER}") WinWait($hLNotepad) ClipPut("ClipPut left Notepad.") Send("^v") Link to comment Share on other sites More sharing options...
FireFox Posted January 2, 2009 Share Posted January 2, 2009 @trinitrotoluen I dont see other way to do that : For $i = 1 To 4 Run("notepad.exe") Next For $i = 1 To 4 Sleep(250) WinActivate("[CLASS:Notepad]", '') WinWaitActive("[CLASS:Notepad]", '', 3) Send("Notepad " & $i) WinSetState("[CLASS:Notepad]", '', @SW_MINIMIZE) Next Sleep(3000) For $i = 1 To 4 Sleep(300) ProcessClose("notepad.exe") Next Cheers, FireFox. Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 2, 2009 Share Posted January 2, 2009 (edited) @FireFoxNot possible...Are you sure? i once also thought that many thing are not possible with AutoIt, but i was so wrong Check this example. Edited January 2, 2009 by MrCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
FireFox Posted January 2, 2009 Share Posted January 2, 2009 @MrCreatoR At the same time is at the same time... you have min 1ms between 2 function so its impossible Cheers, FireFox. Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 2, 2009 Share Posted January 2, 2009 @MrCreatoRAt the same time is at the same time... you have min 1ms between 2 function so its impossible Cheers, FireFox.You have a (bad?) habit to "judge" scripts only by looking at them on the surface - Please, check first the concept/idea that someone trying to show/pass, before you say how stuff works in other's scripts ...And actualy i have there 10 ms delay , but i could remove the sleep completely (with a "price" of CPU load), and it's not the point here... the concept here is quit simple: First we executing few scripts that waiting for the main Edit (of the "parent" GUI) to have specific data (in our case it is a Notepad Instances = 5), and when the last notepad process is executed, this data is set and then all scripts will "fire" (send) some string to the notepad that was preserved (by title) for this current script - so the bottom line here is that the strings are sent in the same time (for the human eye anyway, i don't think that we need here an atomic precision ). Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
FireFox Posted January 2, 2009 Share Posted January 2, 2009 (edited) @MrCreatoRYou have a (bad?) habit to "judge" scripts only by looking at them on the surface wink.gif - Please, check first the concept/idea that someone trying to show/pass, before you say how stuff works in other's scripts ...You're Right... And actualy i have there 10 ms delay Edit : I am not totally right (for the human eye anyway, i don't think that we need here an atomic precision )of course but I understand that by "the same time" Cheers, FireFox. Edited January 2, 2009 by FireFox Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 2, 2009 Share Posted January 2, 2009 @FireFoxI am rightNope, you talking about a delay between functions in the same script, and in my example it's not the case... but it's not really matter, as someone said once : “Be smart, not right” ... or something like this.P.SSorry for the offtopic. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Rawox Posted January 4, 2009 Author Share Posted January 4, 2009 Well. I can't yet got any script done... please help Link to comment Share on other sites More sharing options...
bundyxc Posted January 4, 2009 Share Posted January 4, 2009 In all reality, it's theoretically impossible to do more than one thing at once, because the processor deals with things round-robin style, therefore two things can never be done at the same time.. unless you're working with multiple processors.. ;D Global $arr[2] $arr[0]="hip" $arr[1]="hip" ;^^ hip hip array. ^^ Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 5, 2009 Share Posted January 5, 2009 Hi, Is there an possible option to open 2 notepad windows beside each other and switch between them... Detailed Idea: Script opens 2 notepad windows, 1 on the left of the screen and one on the right. Script activates the first window, types some text. Script activates second window, types some text. etc. Any Ideas, or simple scripts? I'm not really good with AutoIt!! Tnx! Like this perhaps: expandcollapse popup;============= Open Notepads part ============= $iPID1 = Run(@WindowsDir & "\Notepad.exe") $hNotepad1 = _WinWaitByPID($iPID1) WinMove($hNotepad1, "", 0, 0, 300, @DesktopHeight-30) $iPID2 = Run(@WindowsDir & "\Notepad.exe") $hNotepad2 = _WinWaitByPID($iPID2) ;============= Open Notepads part ============= ;============= Set text part ============= WinMove($hNotepad2, "", @DesktopWidth-300, 0, 300, @DesktopHeight-30) WinActivate($hNotepad1) ControlSetText($hNotepad1, "", "Edit1", "Notepad Test 1") WinActivate($hNotepad2) ControlSetText($hNotepad2, "", "Edit1", "Notepad Test 2") ;============= Set text part ============= Func _WinWaitByPID($iPID, $iWaitTime=-1) Local $iTimer = TimerInit() Local $aWinList While 1 $aWinList = WinList() For $i = 1 To $aWinList[0][0] If WinGetProcess($aWinList[$i][1]) = $iPID Then Return $aWinList[$i][1] Next If $iWaitTime > 0 And TimerDiff($iTimer) >= $iWaitTime * 1000 Then ExitLoop WEnd Return 0 EndFunc ? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team 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