Toast Posted February 14, 2012 Report Share Posted February 14, 2012 I'm trying to create a macro where if the Window Title text changes to a specified exact match it will trigger a certain macro as requested. For example: If current window title is 222 i want to run macro named test#1, but if current window title is 333 i want to run macro named test#2 instead How do I accomplish this? Quote Link to comment Share on other sites More sharing options...
Cory Posted February 14, 2012 Report Share Posted February 14, 2012 I would use the Window Title activation. Quote Link to comment Share on other sites More sharing options...
Toast Posted February 14, 2012 Author Report Share Posted February 14, 2012 Got what you said so far. What command should I use so it decides which macro to run? Sorry im very new to all this. Quote Link to comment Share on other sites More sharing options...
Toast Posted February 14, 2012 Author Report Share Posted February 14, 2012 cory, just sent you an email Quote Link to comment Share on other sites More sharing options...
acantor Posted February 15, 2012 Report Share Posted February 15, 2012 Variable Set String %WindowTitle% to topmost window title // Get window title // You may want to parse the window title, e.g., like this: Variable Modify String: Replace " - Mozilla Firefox" in %WindowTitle% with "" Switch( %WindowTitle% ) Case: 222 Macro Run: Test1 End Case Case: 333 Macro Run: Test2 End Case Default Case Text Box Display: Window title = 222 or 333 not found! End Case End Switch Or something like this, which may be harder to follow but may be more familiar, as it uses nested IF... ELSE instead of the SWITCH... CASE statements. Variable Set String %WinTitle% to topmost program name If Variable %WinTitle% Contains "222" Macro Run: Test1 Else If Variable %WinTitle% Contains "333" Macro Run: Test2 Else Text Box Display: Window title = 222 or 333 not found! End If End If Quote Link to comment Share on other sites More sharing options...
paul Posted February 16, 2012 Report Share Posted February 16, 2012 But Alan, your code doesn't get triggered by anything. I believe Toast wants the macros to start automatically based on the Window title. There are 2 main approaches. If all your target windows share some common text, e.g. Windows Internet Explorer, then you could write a macro similar to what Alan described above, where this macro is triggered by a window title containing your common text being opened. I'd use this approach if possible. If there's no common text, you'll have to write one macro for each target window, and have each macro triggered by opening a window containing the target text. Depending on how many windows you're attempting to control, this may get rather messy and hard to manage. But it should work. Quote Link to comment Share on other sites More sharing options...
acantor Posted February 16, 2012 Report Share Posted February 16, 2012 I find window title activation in MEP is iffy. It tends to be most reliable when windows gain focus, and less reliable when windows open or close. When it does work, there can be long delays before the command is activated. I think the feature worked better in ME3. I don't know a solution. I suspect conflicts with other software may be a factor... still testing that theory! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.