Rank: Member
Groups: Approved
Joined: 3/31/2024(UTC) Posts: 12
Thanks: 1 times Was thanked: 1 time(s) in 1 post(s)
|
inspired by this topic https://forum.strokesplu...gestures-is-to-detect-thcopy Code:
// Create a DisplayTextInfo object once
var info = new DisplayTextInfo();
info.MessageAlignment = 'top';
info.Duration = 300;
info.Opacity = 0.7;
info.MessageFont = new Font('Segoe UI Semibold', 20);
info.BackColor = 'black';
info.ForeColor = 'white';
info.Padding = 15;
info.FadeSteps = 18;
info.UsePrimaryScreen = true;
// Get clipboard content before copying
var clip1 = clip.GetText();
sp.SendModifiedVKeys([vk.LCONTROL], [vk.VK_C]);
sp.Sleep(100);
// Check if clipboard content changed after copying
if (clip1 != clip.GetText()) {
info.Message = 'Copy';
} else {
var distance = parseInt(Math.sqrt(Math.pow((action.End.X - action.Start.X), 2.0) + Math.pow((action.End.Y - action.Start.Y), 2.0)));
var currentMousePosition = sp.GetCurrentMousePoint();
if (distance < 120) {
sp.MouseWheel(currentMousePosition, false, -260);
info.Message = '<120';
} else if (distance < 220) {
sp.MouseWheel(currentMousePosition, false, -380);
info.Message = '<220';
} else {
sp.SendModifiedVKeys([vk.LCONTROL], [vk.END]);
info.Message = 'Down';
}
}
// Set the position for displaying the message at the end of the gesture
// Add a small offset so that the message doesn't overlap with the cursor
var offsetX = 10;
var offsetY = 10;
info.Location = `${action.End.X + offsetX},${action.End.Y + offsetY}`;
// Display the message
sp.DisplayText(info);
paste Code:
// Create a DisplayTextInfo object once
var info = new DisplayTextInfo();
info.MessageAlignment = 'top';
info.Duration = 300;
info.Opacity = 0.7;
info.MessageFont = new Font('Segoe UI Semibold', 20);
info.BackColor = 'black';
info.ForeColor = 'white';
info.Padding = 15;
info.FadeSteps = 18;
info.UsePrimaryScreen = true;
var distance = parseInt(Math.sqrt(Math.pow((action.End.X - action.Start.X), 2.0) + Math.pow((action.End.Y - action.Start.Y), 2.0)));
if (distance < 200) {
// If distance is less than 200, paste text
sp.SendModifiedVKeys([vk.LCONTROL], [vk.VK_V]);
info.Message = 'Paste';
} else {
// If distance is 200 or more, perform Ctrl+Home
sp.SendModifiedVKeys([vk.LCONTROL], [vk.HOME]);
info.Message = 'UP';
}
// Set the position for displaying the message at the end of the gesture
// Add a small offset so that the message doesn't overlap with the cursor
var offsetX = 10;
var offsetY = 10;
info.Location = `${action.End.X + offsetX},${action.End.Y + offsetY}`;
// Display the message
sp.DisplayText(info);
|
![thanks](/Themes/BlueGrey/heart_small.png) 1 user thanked 00001 for this useful post.
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close