5$ for simple snippet , help ))

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43
Need a script to return false if letter "A" pressed on the keyboard and True if letter "B" is pressed on the keyboard, please help
:(
C#:
 System.Windows.Forms.Form F = new System.Windows.Forms.Form ();

F.KeyDown + = new System.Windows.Forms.KeyPressEventHandler (delegate (object sender, System.Windows.Forms.KeyEventArgs e) {



   if (e.KeyCode == Keys.Escape)

    {

       Console.Beep (800, 500); // signal frequency and duration, ms

    }



});
 

TwistDanceR

Client
Регистрация
30.05.2019
Сообщения
479
Благодарностей
200
Баллы
43
up. trying to help. Want to see a decision if I cant find it myself.
 
  • Спасибо
Реакции: myndeswx

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43
Original poster of this snippet was [USER = 7494] @Radzhab [/ USER], maybe he would shine some light :dm:
 

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43
Need a C # guru here : ar:
 

Vvafel

Client
Регистрация
24.12.2017
Сообщения
80
Благодарностей
35
Баллы
18
I don't know what exactly you mean but I've been doing something similar for myself, give it a try, it should work fine

C#:
//FORM
System.Windows.Forms.Form F = new System.Windows.Forms.Form();
F.Text= "A OR B" ;
F.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
F.Width=380;  
F.Height=160;  
F.TopMost = true;
//TEXTBOX
System.Windows.Forms.TextBox textb = new System.Windows.Forms.TextBox();
textb.Location = new System.Drawing.Point(20,20);
textb.Width=310;
F.Controls.Add(textb);
string decision = "";
textb.KeyDown+= delegate(object sender, System.Windows.Forms.KeyEventArgs e)
{
    if (e.KeyCode == System.Windows.Forms.Keys.A) {decision = "A"; F.Close();}
    else if (e.KeyCode == System.Windows.Forms.Keys.B) {decision = "B"; F.Close();}
};
//LABEL
System.Windows.Forms.GroupBox grbox1 = new System.Windows.Forms.GroupBox();
grbox1.Text = "Please enter A or B";
grbox1.Location = new System.Drawing.Point(10,10);
grbox1.AutoSize=true;
grbox1.Controls.Add(textb);
F.Controls.Add(grbox1);
F.ShowDialog();
if(decision == "A"){throw new Exception("bla bla bla");}
 
Последнее редактирование:
  • Спасибо
Реакции: TwistDanceR и myndeswx

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43
I don't know what exactly you mean but I've been doing something similar for myself, give it a try, it should work fine

C#:
//FORM
System.Windows.Forms.Form F = new System.Windows.Forms.Form();
F.Text= "A OR B" ;
F.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
F.Width=380; 
F.Height=160; 
F.TopMost = true;
//TEXTBOX
System.Windows.Forms.TextBox textb = new System.Windows.Forms.TextBox();
textb.Location = new System.Drawing.Point(20,20);
textb.Width=310;
F.Controls.Add(textb);
string decision = "";
textb.KeyDown+= delegate(object sender, System.Windows.Forms.KeyEventArgs e)
{
    if (e.KeyCode == System.Windows.Forms.Keys.A) {decision = "A"; F.Close();}
    else if (e.KeyCode == System.Windows.Forms.Keys.B) {decision = "B"; F.Close();}
};
//LABEL
System.Windows.Forms.GroupBox grbox1 = new System.Windows.Forms.GroupBox();
grbox1.Text = "Please enter A or B";
grbox1.Location = new System.Drawing.Point(10,10);
grbox1.AutoSize=true;
grbox1.Controls.Add(textb);
F.Controls.Add(grbox1);
F.ShowDialog();
if(decision == "A"){throw new Exception("bla bla bla");}
Thank you, works like a charm!!! :dm:
I need it because I have to do some manual filtering (with help of zenno of course)
Takes page from a list > opens it > I inspect it and if I like it I press A and it gets added to list - if not - discarded.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)