Skype Tool Messages not sending - c#

I'm trying to code a Skype Tool in C# with the SKYPE4COMLib. It is showing me the messages in Skype, but they keep loading all the time. Any ideas how to fix that?
My Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SKYPE4COMLib;
namespace SkypeTool
{
public partial class mainmenu : Form
{
Skype skype = new Skype();
public mainmenu()
{
InitializeComponent();
}
private void connect_Click(object sender, EventArgs e)
{
skype.Attach(5, false);
status.Text = "connected";
}
private void button1_Click_1(object sender, EventArgs e)
{
skype.SendMessage("censored", "Test");
}
}
}

This is happening for almost everyone. I think it's because of the skype update. There is a way to "Fix It" you can use open message dialog in skype4com. It will look like this.
Skype.Client.OpenMessageDialog(name goes here, message goes here);
Skype.Client.Focus();
Sendkeys.Send("Key that u want to use to send message")
You Can Also See this here How To: Fix Skype4Com SendMessage Problem!

Related

Exchanging image between LabVIEW and c#

I am trying to pass a string my function in Windows Form Application in order to invoke InteropAssembly.dll from a LabVIEW script. The script takes a string for opening image and do some process and then return 2 different images. But I am getting the error The type 'LVBaseRefnum' is defined in an assembly that is not referenced. You must add a reference to assembly 'NationalInstruments.LabVIEW.RefnumTypes'. I have checked the forum and so and found this . But it was posted quite long time ago and still no valid answer. Have you ever encounter this error any solution? Thanks in advance and my code as follows:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using InteropAssembly;
namespace testLabview
{
public partial class Form1 : Form
{
private object img1;
private object img2;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.pictureBox1 = null;
this.pictureBox2 = null;
string text = this.textBox1.ToString();
LabVIEWExports.test(text, out Image img1, out Image img2);
this.pictureBox1.Image = img1;
this.pictureBox2.Image = img2;
}
}
}

cefSharp does not work after publication, how can I solve

the code is working perfectly but after publishing it just doesn't open.
I created a page to test graphics, however as the webbrowser C# does not work, as it starts in IE I tried to use Cefsharp but it is not going either,the error that appears to me is Cefsharp.Core.Runtime.dll, the version I am using of cefsharp is 94.4.11. but the problem is that when I use it by Visual Studio 2022 it works but when I do the compilation and I publish it to generate the executable it doesn't just give an error or it doesn't even open
using CefSharp;
using CefSharp.WinForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace cefteste
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
criarcef(panel1,p);
}
ChromiumWebBrowser p;
private void Form1_Load(object sender, EventArgs e)
{
}
private void criarcef(Panel panel, ChromiumWebBrowser chromium)
{
/*CefSettings settings = new CefSettings();
settings.CachePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/GPMDP";
settings.WindowlessRenderingEnabled = true;
settings.CefCommandLineArgs.Add("enable-smooth-scrolling", "1");
settings.CefCommandLineArgs.Add("enable-overlay-scrollbar", "1");
settings.CefCommandLineArgs.Add("enable-npapi", "1");
CefSharp.Cef.Initialize(settings);*/
chromium = new ChromiumWebBrowser("C:/Users/Bill/Downloads/index(1).html");
chromium.LoadingStateChanged += (sender, args) => {
if (args.IsLoading == false)
chromium.ExecuteScriptAsync("document.oncontextmenu = function() { return false; };");
};
panel.Controls.Add(chromium);
chromium.Dock = DockStyle.Fill;
}
}
}

OpenQA.Selenium.ElementNotInteractableException: 'element not interactable

I create a program for adding sales posts to the Facebook marketplace. I have a problem with adding a photo because it shows me an error like in the title. I am surprised but when I tried to add a picture in google graphics the same way (IWebElement and variable) it worked very well. I don't want to use the api.
Does anyone know how to solve it?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;
using System.Threading;
namespace MARKETPLACE_v2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string url = "https://www.facebook.com/";
ChromeDriver driver; Thread th;
private void Form1_Load(object sender, EventArgs e)
{
ChromeOptions options = new ChromeOptions();
options.AddArguments("--disable-notifications"); // to disable notification
driver = new ChromeDriver(options);
driver.Navigate().GoToUrl(url);
}
private void button1_Click(object sender, EventArgs e)
{
driver.FindElement(By.XPath("//button[normalize-space()='Akceptuj wszystkie']")).Click();
driver.FindElement(By.XPath("//input[#id='email']")).SendKeys("login");
driver.FindElement(By.XPath("//input[#id='pass']")).SendKeys("password");
driver.FindElement(By.XPath("//button[contains(text(),'Zaloguj się')]")).Click();
//login
driver.FindElement(By.XPath("//*[name()='path' and contains(#d,'M17.5 23.7')]")).Click(); Thread.Sleep(2000);
driver.FindElement(By.XPath("//div[#class='j83agx80 cbu4d94t d6urw2fd dp1hu0rb l9j0dhe7 du4w35lb']//span[#class='d2edcug0 hpfvmrgz qv66sw1b c1et5uql lr9zc1uh a8c37x1j keod5gw0 nxhoafnm aigsh9s9 d3f4x2em fe6kdd0r mau55g9w c8b282yb iv3no6db jq4qci2q a3bd9o3v lrazzd5p knomaqxo']//span[1]")).Click(); Thread.Sleep(3000);
driver.FindElement(By.XPath("//span[contains(text(),'Przedmiot na sprzedaż')]")).Click(); Thread.Sleep(3000);
IWebElement element = driver.FindElement(By.XPath("//div[#class='s45kfl79 emlxlaya bkmhp75w spb7xbtv bp9cbjyn rt8b4zig n8ej3o3l agehan2d sk4xxmp2 rq0escxv pq6dq46d taijpn5t l9j0dhe7 tdjehn4e qypqp5cg q676j6op']//i[#class='hu5pjgll lzf7d6o1']"));
element.SendKeys(#"C:\download\maciek.jpg");
}
}
}

Cannot play a note with NAudio.Midi

I read this answer and tried playing a single note with NAudio.Midi:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NAudio.Midi;
using System.Threading;
namespace SoundVision10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
//Thread.Sleep inside GUI is just for example
using (MidiOut midiOut = new MidiOut(0))
{
midiOut.Volume = 65535;
midiOut.Send(MidiMessage.StartNote(60, 127, 0).RawData);
MessageBox.Show("Sent");
Thread.Sleep(1000);
midiOut.Send(MidiMessage.StopNote(60, 0, 0).RawData);
Thread.Sleep(1000);
}
}
}
}
It displays "Sent" and nothing else happens.
Sound is turned on.
The name of the first Midi output device is "Microsoft Gs Wavetable Synth"
Did I forget something?
Change the channel number to 1 and it works.
midiOut.Send(MidiMessage.StartNote(60, 127, 1).RawData);
I replaced NAudio.dll 1.7.3.0 with NAudio.dll 1.3.8.0 and it fixed the issue.

C# OpenWebKitSharp .NET 4 - How to call javascript

I am trying to call javascript using OpenWebKitSharp from WinForms with .NET 4
Here is the code I am trying to use.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WebKit;
using WebKit.Interop;
using WebKit.JSCore;
using webkitForm.Properties;
namespace webkitForm
{
public partial class Form1 : Form
{
WebKitBrowser webKitSharpBrowser = new WebKitBrowser();
public Form1()
{
InitializeComponent();
this.Controls.Add(webKitSharpBrowser);
webKitSharpBrowser.Width = 600;
webKitSharpBrowser.Height = 400;
}
private void button1_Click(object sender, EventArgs e)
{
webKitSharpBrowser.Preferences.AllowPlugins = true;
webKitSharpBrowser.UseJavaScript = true;
webKitSharpBrowser.Navigate("http://sandbox.icontact.com");
webKitSharpBrowser.GetScriptManager.EvaluateScript("alert('An alert from C#!');"); //Call javascript?
}
}
}
I can't get javascript to fire for anything... there must be something that I am missing.
Thanks in advance.
Well, it seems like it can't be done the way you want to:
if you are using .NET 4, calling a function is possible by using:
<webkitbrowser>.GetScriptManager.CallFunction("name", new Object[] { arg1, arg2, ...});
If you want to use .NET 2 you can use:
<webkitbrowser>.StringByEvaluatingJavaScriptFromString("name(arguments)")
- Open Webkit Sharp Issues
I tested your code, it IS working, but calling the alert function only triggers an event (WebKitBrowser.ShowJavaScriptAlertPanel), you are responsible for handling that event and showing a message or updating a label, or anything else.
For example:
Browser.ShowJavaScriptAlertPanel += Browser_ShowJavaScriptAlertPanel;
and then handle the event:
private void Browser_ShowJavaScriptAlertPanel(object sender, WebKit.ShowJavaScriptAlertPanelEventArgs e)
{
MessageBox.Show(e.Message);
}

Categories