automation

.NET Interop: Find All instances of of a running COM object with C#

江枫思渺然 提交于 2019-12-30 07:03:08
问题 Background I am automating some Office application (Word and PowerPoint) via command-line tool. One thing my tool needs to do is locate all the running instances of Word. I know how to get a reference to one of the instances... Object running_obj = null; { running_obj = System.Runtime.InteropServices.Marshal.GetActiveObject(progid); } catch (System.Exception) { //failed to find the object; } if (running_obj!=null) { var running_obj_type = System.Type.GetTypeFromProgID(progid); Microsoft

Automatically call all functions matching a certain pattern in python

大兔子大兔子 提交于 2019-12-30 03:28:27
问题 In python I have many functions likes the ones below. I would like to run all the functions whose name matches setup_* without having to explicitly call them from main. The order in which the functions are run is not important. How can I do this in python? def setup_1(): .... def setup_2(): .... def setup_3(): ... ... if __name__ == '__main__': setup_*() 回答1: def setup_1(): print('1') def setup_2(): print('2') def setup_3(): print('3') if __name__ == '__main__': for func in (val for key,val

How to add subscript characters in paragraphs using Word Automation?

被刻印的时光 ゝ 提交于 2019-12-30 03:27:06
问题 I’m working on a program in C# that uses Microsoft Word 14.0 Object Library to create a .doc file, add paragraphs to it and saves it. There is a small form with a button that does described actions (see the code below). This part has no problems. Problem: Current text in created word file will be the following: Some text beff = 3.0 What I need to accomplish, is creating a paragraph, which has subscript characters inside.(in paragraph above letters "eff" should be subscripted): The final

Telnet automation / scripting [closed]

五迷三道 提交于 2019-12-29 14:59:51
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 months ago . I have already checked this question but could not find what I'm looking for. I am running Windows (the client), and the server is a legacy mainframe type server. Basically I need to write a script, python code or whatever, to send some know commands to the server via telnet, and

IE COM automation: How to get the return value of `window.execScript` in PowerShell

╄→尐↘猪︶ㄣ 提交于 2019-12-29 10:07:35
问题 From this other post it looks like it is possible to get the return value of IHTMLWindow2::execScript from Internet Explorer API, however the linked example is in C++ and I don't really understand it. I'm trying to do the same thing in PowerShell , so here's my code that shows the problem: $ie = New-Object -COM InternetExplorer.Application $ie.visible = $true $ie.navigate("http://google.com") while ( $ie.busy ) { start-sleep -m 100 } $document = $ie.document $window = $document.parentWindow

Access and handle chrome extension popup using selenium webdriver

断了今生、忘了曾经 提交于 2019-12-29 09:32:37
问题 I am trying to install the IBM DAP chrome extension using Selenium webdriver. I don't have access to crx file. So, I tried to install it directly through the chrome web store for plugins as: browser = webdriver.Chrome() browser.get('https://chrome.google.com/webstore/detail/dynamic-assessment-plugin/fnapgcgphlfhecijolobjodbbnjjpdga') browser.maximize_window() browser.implicitly_wait(5) browser.find_element_by_css_selector("body > div.F-ia-k.S-ph.S-pb-qa > div.h-F-f-k.F-f-k > div > div > div.e

Access and handle chrome extension popup using selenium webdriver

做~自己de王妃 提交于 2019-12-29 09:32:11
问题 I am trying to install the IBM DAP chrome extension using Selenium webdriver. I don't have access to crx file. So, I tried to install it directly through the chrome web store for plugins as: browser = webdriver.Chrome() browser.get('https://chrome.google.com/webstore/detail/dynamic-assessment-plugin/fnapgcgphlfhecijolobjodbbnjjpdga') browser.maximize_window() browser.implicitly_wait(5) browser.find_element_by_css_selector("body > div.F-ia-k.S-ph.S-pb-qa > div.h-F-f-k.F-f-k > div > div > div.e

How to call JavaScript function in VBA?

佐手、 提交于 2019-12-29 08:17:09
问题 I need to by pass an IE confirm 'OK'/'Cancel' pop-up message. I have a problem running a JavaScript function in my VBA script. My JavaScript: function ConfirmSave() { var Ok = confirm('Are you sure all Documents and Information are attached and correct before saving?'); if(Ok) return true; else return false; } function submitbutton_click() { document.getElementById('FileAttachement2_hdnButtonFlag').value = "SAVE"; var submitbutton = document.getElementById('cmdDownSave'); var uploadobj

How to use variable, which value should be set in keyword or test, in XPATH?

泪湿孤枕 提交于 2019-12-29 07:06:10
问题 I need to click on element based on what value it contains..but I want to set this value in test run or keyword definition (best option is in the test I guess) How should I do it? the variable containing xpath should look like that: ${DROPDOWN ITEMS} xpath=//*[contains(@class,'listitem-element')]/span[contains(text(),'${second_number}')] This locator works when I replace the variable with actual number like '002', but I want to have it more general.. In keyword definition I use it like:

Automating Visual Studio with EnvDTE

天涯浪子 提交于 2019-12-29 02:51:06
问题 I am successfully instantiating/automating Visual Studio using the following code: System.Type t = System.Type.GetTypeFromProgID("VisualStudio.DTE.9.0"); object obj = Activator.CreateInstance(t, true); dte = (DTE)obj; Solution sln = dte.Solution; sln.Open(SolutionFile); System.Threading.Thread.Sleep(1000); //Do stuff with the solution Notice the Thread.Sleep(1000) call? If I don't include that, the code tries to bug the instance before it's ready and I get an exception: the message filter