automation

Calling PowerShell From C#

泪湿孤枕 提交于 2019-12-17 16:31:20
问题 I am using System.Management.Automation DLL which allows me to call PowerShell within my C# application like so: PowerShell.Create().AddScript("Get-Process").Invoke(); What I am trying to do is call PowerShell but supply the input list. For example, in: 1, 2, 3 | ForEach-Object { $_ * 2 } I am trying to supply the left hand side 1, 2, 3 when invoking: // powershell is a PowerShell Object powershell.Invoke(new [] { 1, 2, 3 }); However this does not work. The workaround I came up with was using

VBA interaction with internet explorer

吃可爱长大的小学妹 提交于 2019-12-17 16:04:38
问题 The macro I am building takes names from an Excel spreadsheet, opens Internet Explorer, and searches the online directory. After searching the directory, it pulls up a Java form with the manager's name in it. I am able to manually tab to the manager name, right click, copy shortcut, and then post it back on the spread sheet. However, I am having problems with consistent tabbing and copying the shortcut. Is there a simple way of bringing focus back onto the IE window? How do you copy a

VBA interaction with internet explorer

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 16:02:24
问题 The macro I am building takes names from an Excel spreadsheet, opens Internet Explorer, and searches the online directory. After searching the directory, it pulls up a Java form with the manager's name in it. I am able to manually tab to the manager name, right click, copy shortcut, and then post it back on the spread sheet. However, I am having problems with consistent tabbing and copying the shortcut. Is there a simple way of bringing focus back onto the IE window? How do you copy a

How to run a PHP script in every 5-10 minutes without cron, perl etc?

核能气质少年 提交于 2019-12-17 15:58:09
问题 I want to run a script every 5 minutes on server. I have not any type of administrate privileges to do cron job etc. I am not good php programmer so this question may look strange, but if you understand please tell me a solution. 回答1: I use webcron.org wich is an affordable online service. Advantage for me is that I then have an overview of all scheduled tasks, on all servers. 回答2: Sounds like your only solution would be "Poor Man's Cron". What you do is create a script that you place on top

simulate backspace key with java.awt.Robot

纵饮孤独 提交于 2019-12-17 14:58:30
问题 There seems to be an issue simulating the backspace key with java.awt.Robot . This thread seems to confirm this but it does not propose a solution. This works: Robot rob = new Robot(); rob.keyPress(KeyEvent.VK_A); rob.keyRelease(KeyEvent.VK_A); This doesn't: Robot rob = new Robot(); rob.keyPress(KeyEvent.VK_BACK_SPACE); rob.keyRelease(KeyEvent.VK_BACK_SPACE); Any ideas? 回答1: It seems to work in this test. Addendum: Regarding the cited article, "Aside from those keys that are defined by the

PsExec Throws Error Messages, but works without any problems

巧了我就是萌 提交于 2019-12-17 12:20:35
问题 So we are using PsExec a lot in our automations to install virtual machines, as we can't use ps remote sessions with our windows 2003 machines. Everything works great and there are no Problems, but PsExec keeps throwing errors, even every command is being carried out without correctly. For example: D:\tools\pstools\psexec.exe $guestIP -u $global:default_user -p $global:default_pwd -d -i C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command "Enable-PSRemoting -Force" Enables the

How to automate saving webpages?

谁说胖子不能爱 提交于 2019-12-17 10:10:00
问题 I need to archive several hundred webpages in the style of what browsers call "Save as, complete", meaning they save an HTML file for the page itself along with a folder full of other files needed to render the page correctly, such as CSS, JS, and image files. This allows the pages to be viewed offline looking the same as when displayed online. Here are the methods I've tried and the problems with each: Manual process in Firefox : On the link for the next page, right click. Type "A" for "Save

IE11 Frame Notification Bar Save button

孤者浪人 提交于 2019-12-17 07:51:58
问题 On a 64-bit system with MS Excel 2010 and IE11 I'm using this code to automate download process from a website: hWnd = FindWindowEx(IE.hWnd, 0, "Frame Notification Bar", vbNullString) If hWnd Then hWnd = FindWindowEx(hWnd, 0&, "Button", "Save") End If If hWnd Then SetForegroundWindow (hWnd) Sleep 600 SendMessage hWnd, BM_CLICK, 0, 0 End If Everything goes OK until the Frame Notification Bar appears. I'm getting the HWND of this window, but can't get the HWND of the "Save" button, so that I

IE11 Frame Notification Bar Save button

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 07:51:05
问题 On a 64-bit system with MS Excel 2010 and IE11 I'm using this code to automate download process from a website: hWnd = FindWindowEx(IE.hWnd, 0, "Frame Notification Bar", vbNullString) If hWnd Then hWnd = FindWindowEx(hWnd, 0&, "Button", "Save") End If If hWnd Then SetForegroundWindow (hWnd) Sleep 600 SendMessage hWnd, BM_CLICK, 0, 0 End If Everything goes OK until the Frame Notification Bar appears. I'm getting the HWND of this window, but can't get the HWND of the "Save" button, so that I

How to make the Java.awt.Robot type unicode characters? (Is it possible?)

此生再无相见时 提交于 2019-12-17 06:51:32
问题 We have a user provided string that may contain unicode characters, and we want the robot to type that string. How do you convert a string into keyCodes that the robot will use? How do you do it so it is also java version independant (1.3 -> 1.6)? What we have working for "ascii" chars is //char c = nextChar(); //char c = 'a'; // this works, and so does 'A' char c = 'á'; // this doesn't, and neither does 'Ă' Robot robot = new Robot(); KeyStroke key = KeyStroke.getKeyStroke("pressed " +