April 30th, 2013, 05:04 AM
C# IE toolbar button runs bat or PS script. works one time then doesn't anymore.
I have an IE toolbar with a button that runs a bat script with Process.Start. I tried also with a PS script.
When I open IE, the button works. As soon as I navigate to another address or open a new tab, it fails running the script.
I think it has to do with the toolbar restarting each time I navigate to a new address or open a new tab.
private void assign_Click(object sender, EventArgs e)
}Any help appreciated.
April 30th, 2013, 09:06 AM
Re: C# IE toolbar button runs bat or PS script. works one time then doesn't anymore.
I have to say the bat script gets generated first because it needs the handle of the internet explorer instance in it.
I placed it in the Onconnect event, but I think this is what causes the problem. I tried placing it in other events, etc.. but it stilll doesn't work.
public static void write_bat(int hwnd)
string path = scripts + "\\openoneinc.bat";
string command = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -STA " + scripts + "\\finalie.ps1 openoneinc " + hwnd;
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.