Selenium C# Interact with Chrome Microphone Window [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have an application that when initiated, I receive the popup that "https://example.com wants to:"
"Use your microphone"
I have looked at autoit but it has not been helping. I was trying to use an x/y coordinate but no luck. The autoit window info gives me a name and a class but button info is not there.
Anyone have a way around this issue?

Works perfectly:
$WinTitle = "[CLASS:Chrome_WidgetWin_1]"
WinWait($WinTitle)
WinActivate($WinTitle)
ControlSend($WinTitle, "", "", "{TAB}{ENTER}")

Here is how I got around it using AutoIT. Remove one of the Send("+{TAB}") to set it to Block. I tried removing both of these and just using the enter for Allow but it did not work.
Allow Microphone for Chrome:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=chromeClickAllow.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Sleep(2000)
WinActivate("Tabs Outliner")
WinWait("[CLASS:Chrome_WidgetWin_1]")
Sleep(500)
WinActivate("[CLASS:Chrome_WidgetWin_1]")
Send("+{TAB}")
Send("+{TAB}")
Send("{ENTER}")

Related

Creation of log file on user choice [closed]

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 7 years ago.
Improve this question
We have a console application name JetIDR. Where we are using log4net for logging log . THis application are currently creating 2 log file JetIDR-INFO.LOG and JetIDR-Debug.LOG .We want to enhance out application to support flexibility on creating log file as below.
Command line parameter should be named as -log
Valid parameter for -loglevel are 1 and 2 only
When parameter 1 is used with -loglevel JetIDR-INFO.LOG file should get created
When parameter 2 is used with -loglevel then JetIDR-INFO.LOG & JetIDR-DEBUG.LOG file should get created
We need to do it in C#.
Your question is effectively "how do I conditionally suppress output to an appender?", where the condition is "If the -loglevel is 1, don't write to the debug logs."
The code would then look like this:
if (logLevel == 1)
{
// assuming appender name is DebugAppender and it is a FileAppender
var appender = log4net.LogManager.GetRepository()
.GetAppenders()
.OfType<FileAppender>()
.SingleOrDefault(a => a.Name == "DebugAppender");
if (appender != null)
{
// Disable the appender
appender.Threshold = Level.Off;
appender.ActivateOptions();
}
}
Note however that if the appender is defined in configuration, the log file is created when log4net is configured: this code thus cannot stop the file from being created, but it will suppress logging to the file.

C# library to generate ICal (ics) files [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Is there any API that I can use and post event data to (for example with querystrings) and get back a file that the visitor can download and add to his calender?
I can of course write the script myself, but if there is a open API I could save some time.
You could use iCal4j
You asked for a webservice of some sort, and I do not know of one, but if you are using .NET, you can create your own using this library:
http://www.codeproject.com/KB/vb/vcalendar.aspx
Maybe it's an option for you to generate and send an e-mail to the user containing the appointments you want the to add. By doing this you:
Haven't jo use any API
Use the build in auto-parsing feature of Apple Mail (Mac OS & iOS)
Stay compatible to other users which might not use iCal
I just used DDay.iCal which works fine for C#. You can see some documentation here on how to read/parse from an .ics file, and this is what i used to create a new file, checked it works on Outlook and on the iOS email application:
public static string GetCalendarAsString(string subject, DateTime start, DateTime end,
string location, string timeZoneName)
{
var calendar = new iCalendar();
var timeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneName);
calendar.AddTimeZone(iCalTimeZone.FromSystemTimeZone(timeZone));
var evt = new Event
{
Start = new iCalDateTime(start),
End = new iCalDateTime(end),
Location = location,
Summary = subject,
IsAllDay = false
};
calendar.Events.Add(evt);
var serializer = new iCalendarSerializer();
return serializer.SerializeToString(calendar);
}
you can use several other properties, although I only needed these
You can download iCal4J using http://sourceforge.net/projects/ical4j/files/iCal4j/1.0/ical4j-1.0.zip/download

C# Color coding for windows 8.1 (tablet) in visual studio 2013 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
May I know how should I write the color code for
grid-background / textblock-foreground
if(Condition ==true)
{
gridName.Backgroud = //How to set color here
}
in visual studio 2013? (For Windows 8.1 tablet (surfaceRT) )
you can try these options
if(Contition == true)
{
// you can try this
grid.Background = new SolidColorBurush(Colors.Green);
// you can try this too
grid.Background = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0);
}
If you having Error that Colors or Color does not exists or you are missing some assembly.
so just right Click on Colors/Color and choose Resolve Option. it is all done :)
Hope this helps :)
For ex
if(something == true)
{
grid.Background = new SolidColorBurush(Windows.UI.Colors.Red);
}

How to create an application that automatically run after i insert smartphone into computer [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I want to create an application that automatically runs after I insert a smartphone ( portable device ) into a computer. I has a big problem in creating an event handler to run my application. Can anyone help me on how I can do it on C# or registry of windows?
solved
64 bit :
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\Test Device]
"Action"="Import pictures"
"DefaultIcon"="C:\\Test Devices\\Resource\\icon.ico,0"
"Provider"="Test Devices"
"InitCmdLine"="C:\\Test Devices\\AutoPlay.exe"
"ProgID"="Shell.HWEventHandlerShellExecute"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\Source\{80E170D2-1055-4A3E-B952-82CC4F8A8689}]
"Test Device"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\VideoSource]
"Test Device"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\ImageSource]
"Test Device"=""
32 bit :
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\Test Device]
"Action"="Import pictures"
"DefaultIcon"="C:\\Test Devices\\Resource\\icon.ico,0"
"Provider"="Test Devices"
"InitCmdLine"="C:\\Test Devices\\AutoPlay.exe"
"ProgID"="Shell.HWEventHandlerShellExecute"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\Source\{80E170D2-1055-4A3E-B952-82CC4F8A8689}]
"Test Device"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\VideoSource]
"Test Device"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\ImageSource]
"Test Device"=""

How can I load kongregate chat in my webbrowser? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have a simple program, and I am trying to load the kongregate chat into a WebBrowser, but it is not working...
When I first start it up, it navigates to a game, and then it gives me 4 Script Error, and the chat just sits there saying: "Joining room...". I don't think it is a problem with the browser settings, because it works on internet explorer. Is there something that is messed up with my WebBrowser? I have let it sit there for a few minutes, and it still does not work. I have set the suppressScriptErrors to true and false, and it still does not fix it.
FYI: I am not doing anything bad with my program, like cheating, or spamming, or anything like that, I just want the webpage to show up, and sometimes I like to be able to have things copied, so I put a few TextBoxes to the right of it, so I can paste it into chat, if I won't to post a few things...
This article has the solution to your problem. It appears that the WebBrowser control in Visual Studio launches in IE7 mode by default. That's why you get javescript errors with the control but, not in your browser. I highly suggest you read the article linked that the top. Luckily, there is a fix. The following code was taken from another stackoverflow answer to a question that indirectly addresses your issue. Here is that link, and here is the code.
string installkey = #"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION";
string entryLabel = Path.GetFileName(Application.ExecutablePath);
System.OperatingSystem osInfo = System.Environment.OSVersion;
string version = osInfo.Version.Major.ToString() + '.' + osInfo.Version.Minor.ToString();
uint editFlag = (uint)((version == "6.2") ? 0x2710 : 0x2328); // 6.2 = Windows 8 and therefore IE10
RegistryKey existingSubKey = Registry.LocalMachine.OpenSubKey(installkey, false); // readonly key
if (existingSubKey == null) {
existingSubKey = Registry.LocalMachine.CreateSubKey(installkey, RegistryKeyPermissionCheck.Default); // readonly key
}
if (existingSubKey.GetValue(entryLabel) == null) {
existingSubKey = Registry.LocalMachine.OpenSubKey(installkey, true); // writable key
existingSubKey.SetValue(entryLabel, unchecked((int)editFlag), RegistryValueKind.DWord);
}
Also, the article I mentioned up top says that you should create an entry for the VS host process for your app too or it won't work in debug mode. Good luck and I hope this solves your issue!

Categories

Resources