trinitrotoluen Posted January 2, 2009 Share Posted January 2, 2009 Hi, I'm new here. I want to make a solution to manage multi program. For example : Open 10 notepad at the same time and type some text in 10 notepad at the same time. How can I code ? thx in advance ! Link to comment Share on other sites More sharing options...
Olsson Posted January 2, 2009 Share Posted January 2, 2009 http://www.autoitscript.com/forum/index.php?showtopic=86973Check out that topic, just under yours. Link to comment Share on other sites More sharing options...
trinitrotoluen Posted January 2, 2009 Author Share Posted January 2, 2009 http://www.autoitscript.com/forum/index.php?showtopic=86973Check out that topic, just under yours.Thx you for your link but it can't. I mean type some text in 10 notepad at the same time Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 2, 2009 Share Posted January 2, 2009 (edited) Open 10 notepad at the same time and type some text in 10 notepad at the same timeHere is an example of how you can do it: expandcollapse popupOpt("WinWaitDelay", 150) ;In some cases may need to be increesed $iTop = 30 $iRun_Instances = 5 $sSet_Data = "Notepad Instance #%i" $hGUI = GUICreate("__Simultanius_Run_Handling_GUI__") $nEdit = GUICtrlCreateEdit("", 0, 0, 200, 200) For $i = 1 To $iRun_Instances Run(@WindowsDir & "\Notepad.exe") If @error Then ContinueLoop WinWait("[CLASS:Notepad]", "", 5) WinSetTitle("[CLASS:Notepad]", "", "Untitled_" & $i) $aWin_Pos = WinGetPos("Untitled_" & $i) WinMove("Untitled_" & $i, "", $aWin_Pos[0], $iTop) $iTop += 80 $sRun_Script_Content = _ '#NoTrayIcon' & @CRLF & _ 'While ControlGetText(Hwnd(' & $hGUI & '), "", "Edit1") <> "Notepad Instances = ' & $iRun_Instances & '"' & @CRLF & _ ' Sleep(10)' & @CRLF & _ 'WEnd' & @CRLF & _ 'ControlSetText("[CLASS:Notepad;TITLE:Untitled_' & $i & ']", "", "Edit1", StringFormat("' & $sSet_Data & '", ' & $i & '))' $hFOpen = FileOpen(@TempDir & "\~Au3_Run_" & $i & ".Tmp", 2) FileWrite($hFOpen, $sRun_Script_Content) FileClose($hFOpen) Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @TempDir & '\~Au3_Run_' & $i & '.Tmp"') If $i = $iRun_Instances Then MsgBox(64, "Attention...", "Now we will see the data set almost in the same time in all [" & $i & "] Notepads...", 3) Sleep(500) EndIf GUICtrlSetData($nEdit, "Notepad Instances = " & $i) Next Sleep(2000) MsgBox(64, "Attention...", "Now we need to clean a little :) (delete temporary files and close Notepad windows)...", 5) Opt("WinWaitDelay", 0) For $i = $iRun_Instances To 1 Step -1 FileDelete(@TempDir & '\~Au3_Run_' & $i & '.Tmp') WinKill("Untitled_" & $i) Next Just run the script, and follow the message boxes P.S 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 ). Edited January 4, 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...
trinitrotoluen Posted January 3, 2009 Author Share Posted January 3, 2009 Here is an example of how you can do it: expandcollapse popupOpt("WinWaitDelay", 150) ;In some cases may need to be increesed $iTop = 30 $iRun_Instances = 5 $sSet_Data = "Notepad Instance #%i" $hGUI = GUICreate("__Simultanius_Run_Handling_GUI__") $nEdit = GUICtrlCreateEdit("", 0, 0, 200, 200) For $i = 1 To $iRun_Instances Run(@WindowsDir & "\Notepad.exe") If @error Then ContinueLoop WinWait("[CLASS:Notepad]", "", 5) WinSetTitle("[CLASS:Notepad]", "", "Untitled_" & $i) $aWin_Pos = WinGetPos("Untitled_" & $i) WinMove("Untitled_" & $i, "", $aWin_Pos[0], $iTop) $iTop += 80 $sRun_Script_Content = _ '#NoTrayIcon' & @CRLF & _ 'While ControlGetText(Hwnd(' & $hGUI & '), "", "Edit1") <> "Notepad Instances = ' & $iRun_Instances & '"' & @CRLF & _ ' Sleep(10)' & @CRLF & _ 'WEnd' & @CRLF & _ 'ControlSetText("[CLASS:Notepad;TITLE:Untitled_' & $i & ']", "", "Edit1", StringFormat("' & $sSet_Data & '", ' & $i & '))' $hFOpen = FileOpen(@TempDir & "\~Au3_Run_" & $i & ".Tmp", 2) FileWrite($hFOpen, $sRun_Script_Content) FileClose($hFOpen) Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @TempDir & '\~Au3_Run_' & $i & '.Tmp"') If $i = $iRun_Instances Then MsgBox(64, "Attention...", "Now we will see the data set almost in the same time in all [" & $i & "] Notepads...", 3) Sleep(500) EndIf GUICtrlSetData($nEdit, "Notepad Instances = " & $i) Next Sleep(2000) MsgBox(64, "Attention...", "Now we need to clean a little :) (delete temporary files and close Notepad windows)...", 5) Opt("WinWaitDelay", 0) For $i = $iRun_Instances To 1 Step -1 FileDelete(@TempDir & '\~Au3_Run_' & $i & '.Tmp') WinKill("Untitled_" & $i) Next Just run the script, and follow the message boxes Great ! Work like a charm ! Link to comment Share on other sites More sharing options...
trinitrotoluen Posted January 3, 2009 Author Share Posted January 3, 2009 (edited) @TempDir is it C:\WINDOWS\Temp ? I want to find it. Edited January 3, 2009 by trinitrotoluen Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 3, 2009 Share Posted January 3, 2009 @TempDir is it C:\WINDOWS\Temp ? I want to find it. ShellExecute(@TempDir) ? 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...
trinitrotoluen Posted January 4, 2009 Author Share Posted January 4, 2009 (edited) Hi, MrCreatoR. Is it possible to debug AutoIT like press F10 in VC 6 ? Edited January 4, 2009 by trinitrotoluen Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 4, 2009 Share Posted January 4, 2009 Hi, MrCreatoR. Is it possible to debug AutoIT like press F10 in VC 6 ?I don't know how it works in VC 6, but in AutoIt you have Syntax Check (F8), plus this little tool: _AutoItErrorHandler (and few more found on the forum).P.SBut how is that related to this topic? 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...
rasim Posted January 4, 2009 Share Posted January 4, 2009 MrCreatoRGood example my friend! 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