fikri Posted January 27, 2011 Share Posted January 27, 2011 Hello, I'm new on this forum and I try to make some script to monitor events on the application which is compiled in Delphi (no activex). I'm trying to make that script activate something before application (user click), which I monitoring events, do import function and activate new window. Is it possible? Thank you Link to comment Share on other sites More sharing options...
fikri Posted January 31, 2011 Author Share Posted January 31, 2011 Anything? Is it possible to monitoring application's form with title which is need for me? Example: "Importing.."? I founded example script on this forum but how can I activate my app when form with this title appear...? I was try with functio IF but it is not secure, because my application sometimes activated when form without this title appear.. Why that? Link to comment Share on other sites More sharing options...
Varian Posted January 31, 2011 Share Posted January 31, 2011 If I understand, you have a Delphi app that you want to monitor before a user click on a button or field so before that happens you can run your custom program? Is the action that you are trying to intercept a click on a button? If yes, have you run AU# Window Info Tool on the button yet? Does the Control tab give you information about the button. What happens when the button is clicked? Will another window open, or the form change with a specific Window Title? I am thinking that if nothing else works, you can disable or hide the main application window after the button click (if you can detect the button click from the Window Title change or the appearance of another Window). Then you can run your custom program. When it finishes, you can enable or restore your main application window. Let me know if I understand your question properly. Link to comment Share on other sites More sharing options...
martin Posted January 31, 2011 Share Posted January 31, 2011 Hello, I'm new on this forum and I try to make some script to monitor events on the application which is compiled in Delphi (no activex). I'm trying to make that script activate something before application (user click), which I monitoring events, do import function and activate new window. Is it possible?Thank youAre you able to modify the Delphi app? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
fikri Posted January 31, 2011 Author Share Posted January 31, 2011 (edited) Sorry for my bad English and thank You for your reply. Varian, You are understand what I mean, but only problem is that I cannot always successfully detect button click or new window with specific tittle?! Do you have same examples about that? Marian, I cannot modify compiled delphi file, except in hex mode, which is very hard. I think that only way is this which I'm trying to do. Edited January 31, 2011 by fikri Link to comment Share on other sites More sharing options...
Varian Posted January 31, 2011 Share Posted January 31, 2011 Sorry for my bad English and thank You for your reply.Varian, You are understand what I mean, but only problem is that I cannot always successfully detect button click or new window with specific tittle?! Do you have same examples about that?Marian, I cannot modify compiled delphi file, except in hex mode, which is very hard. I think that only way is this which I'm trying to do.No problem...please answer these questions...I am calling your Script "YourCustomScript.exe"1. Are you trying to run "YourCustomScript.exe" before the Button press?2. When the button is pressed, does another window ALWAYS open? Does this window always have the same title? Are there words or phrases in the title that are always the same?3. When the button is pressed, does the main Delphi window ALWAYS change title? If so, does the title give the same name, or at least part of it is always the same?4. Have you run the AutoIT Window Info Tool on these windows and this button? If so, you will need to provide the summary page for:the Delphi Window before the button is clickedthe Delphi Window after the button is clickedthe window that pops up after the button is clickedthe button itself, with the AutoIT Window Info Tool focused on it Link to comment Share on other sites More sharing options...
fikri Posted February 1, 2011 Author Share Posted February 1, 2011 (edited) 1. yes, I'm trying to run "YourCustomScript.exe" after or before button click or before new window appear. 2. window are always open 3. Main window change name to new which is always same 4. new window title is always same "Importing in progress..." I cannot pickup button with AutoiT Finder Tool because it is activate on menu after right mouse click. Edited February 1, 2011 by fikri Link to comment Share on other sites More sharing options...
Varian Posted February 1, 2011 Share Posted February 1, 2011 When you click the Button and the new window (with the title "Importing in progress...") appears: Would hiding this new window, running "YourCustomScript.exe" and waiting for it to close, the restoring the new window, would that work for you? Does the button return any control information from the AutoIT Window Information Tool or is it blank? If there is information, please post that information. Link to comment Share on other sites More sharing options...
fikri Posted February 1, 2011 Author Share Posted February 1, 2011 Yes, Varian that it will work for me.. Here is info as attachment Link to comment Share on other sites More sharing options...
Varian Posted February 1, 2011 Share Posted February 1, 2011 What button is being pressed to initiate the Import? Is it on the toolbar? Is the entire toolbar one control or is there a separate button that triggers the Import? Here is an example of what I am thinking. The second script creates a delphi executable that I found on the web. It's pretty long, so I had to attach it. Place the attached script in the same folder at script below and run Main.au3 Main.au3expandcollapse popupOpt('ExpandEnvStrings', 1) Opt('TrayAutoPause', 0) Opt('TrayIconDebug', 1) Opt('TrayOnEventMode', 1) Opt('WinTitleMatchMode', 4) Opt('WinWaitDelay', 100) Opt('MouseCoordMode', 2) #include 'DataFiler-Booty.au3' #include <Misc.au3> _Singleton(@ScriptName, 0) OnAutoitExitRegister('_Quit') If Not FileExists(@TempDir & '\Booty.exe') Then _WriteBootyToDir(@TempDir) Run(@TempDir & '\Booty.exe') WinWait('Booty Help') $Hwnd = WinGetHandle('Booty Help') $Control = '[CLASS:TButton; INSTANCE:1]' MsgBox(262208, 'Now That The Window Is Here', 'The Button Will Be Disabled, But Still Click On It', 10) WinActivate($Hwnd) ControlDisable($Hwnd, '', $Control) WinActivate($Hwnd) While 1 Sleep(10) If WinActive($Hwnd) And _IsPressed(01) Then $Controlpos = ControlGetPos($Hwnd, '', $Control) $Mousepos = MouseGetPos() If $Mousepos[0] >= $Controlpos[0] And $Mousepos[0] <= $Controlpos[0] + $Controlpos[2] Then If $Mousepos[1] >= $Controlpos[1] And $Mousepos[1] <= $Controlpos[1] + $Controlpos[3] Then $String = 'We Have Intercepted The Button, And Can Run Anything We Want' $String &= @LF & 'Before Eventually Sending The Click To The Button' $String &= @LF & @LF & 'Press Ok To Proceed' MsgBox(262208, 'Success', $String) Sleep(500) ControlEnable($hwnd, '', $Control) ControlClick($hwnd, '', $Control) _Quit() EndIf EndIf EndIf WEnd Func _Quit() ControlEnable($Hwnd, '', $Control) Exit EndFunc ;==>_QuitDataFiler-Booty.au3 Link to comment Share on other sites More sharing options...
fikri Posted February 1, 2011 Author Share Posted February 1, 2011 Varian, thank you very much for this. Your idea is great. Only I must applied it on my application. Here is concept: I have main form wit the title "Orders". On the main form is more toolbar with command. One of the command is "Import" (I can see class only for whole toolbar). Instance name and class is same for whole toolbar. The second way is run "Import" shortcut CTRL+I. Another way (which I'm using) is Mouse Right Click -> Import First is running form "Import in Progress..." which became disabled and then is activated form "Open" for selecting file for import. Form "Import in Progress..." is behind form "Open" and when form "Open" is closed then form "Importing.." is show and then import started. My idea is when form "Import in Progress..." show that I disable executing delphi code or hide app, activate my app, and after executing app, activate delphi code or show it's form for selecting file. On the picture You can see some data. Thank you 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