-
April 30th, 2013, 05:04 AM
#1
C# IE toolbar button runs bat or PS script. works one time then doesn't anymore.
Hi,
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)
{
Process.Start("c:\\users\\ccormeni\\Documents\\scripts\\openoneinc.bat");
}Any help appreciated.
Clovis
-
April 30th, 2013, 09:06 AM
#2
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;
System.IO.File.WriteAllText(path, command);
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|