Dear rob, thank you for your hard work. It's a good function, but in my script, I don't know how to turn the area where "sp.mousewheel (wheel. Point, false, wheel. Delta)" is located into this exclusion zone, which is difficult for me.
var exeName = wheel.Window.Process.MainModule.ModuleName;
//is the mouse along the right side of the window?
if(wheel.X >= (parseInt(wheel.Window.Rectangle.Right) - 30)) {
wheel.Window.BringToFront();
if(wheel.Delta > 0){//滚轮向上
if(wheel.Y <= parseInt(wheel.Window.Screen.WorkingArea.Height *1/2)) {//上1/2窗口
ScreenBrightness.Adjust("1+")}
else if(wheel.Y >= parseInt(wheel.Window.Screen.WorkingArea.Height *19/20)) {//下1/20窗口
sp.SendVKey(vk.VOLUME_MUTE)}
else{//下1/2窗口
sp.SendVKey(vk.VOLUME_UP)}
}else{//滚轮向下
if(wheel.Y <= parseInt(wheel.Window.Screen.WorkingArea.Height *1/2)) {
ScreenBrightness.Adjust("20-") }
else if(wheel.Y >= parseInt(wheel.Window.Screen.WorkingArea.Height *19/20)) {
sp.SendVKey(vk.VOLUME_MUTE)}
else{
sp.SendVKey(vk.VOLUME_DOWN)}
}
}else if(wheel.X >= (parseInt(wheel.Window.Rectangle.Right) - 80)) {
wheel.Window.BringToFront();
if( wheel.Delta > 0){
if(exeName == "Acrobat.exe" ){
if(wheel.Y <= parseInt(wheel.Window.Screen.WorkingArea.Height *1/2)) {
//查找上一个
sp.SendKeys("^+g")}
else{
sp.SendModifiedVKeys([vk.LMENU], [vk.LEFT])}}
else if(exeName == "WINWORD.EXE" ){
//查找上一个
sp.SendModifiedVKeys([vk.LCONTROL], [vk.PRIOR])}
else{
sp.MouseWheel(wheel.Point, false, wheel.Delta)}
}else{ //滚轮向下
if(exeName == "Acrobat.exe" ){
if(wheel.Y <= parseInt(wheel.Window.Screen.WorkingArea.Height *1/2)) {
//查找上一个
sp.SendKeys("^g")}
else{
sp.SendModifiedVKeys([vk.LMENU], [vk.RIGHT])}}
else if(exeName == "WINWORD.EXE" ){
//查找上一个
sp.SendModifiedVKeys([vk.LCONTROL], [vk.NEXT])}
else{
sp.MouseWheel(wheel.Point, false, wheel.Delta)}
}
}
//is the mouse along the left side of the window?
else if(wheel.X <= (parseInt(wheel.Window.Rectangle.Left) + 30)) {
wheel.Window.BringToFront();
if(wheel.Delta > 0){
if(wheel.Y <= parseInt(wheel.Window.Screen.WorkingArea.Height *1/2)) {
sp.SendModifiedVKeys([vk.LCONTROL], [vk.HOME]);
}else{
sp.SendControlDown();
sp.MouseWheel(wheel.Point, false, +120);
sp.SendControlUp()}
}else{
if(wheel.Y <= parseInt(wheel.Window.Screen.WorkingArea.Height *1/2)) {
sp.SendModifiedVKeys([vk.LCONTROL], [vk.END])
}else{
sp.SendControlDown();
sp.MouseWheel(wheel.Point, false, -120);
sp.SendControlUp()
}
}
}
//is the mouse along the Top side of the window?
else if(parseInt(wheel.Y) <= (parseInt(wheel.Window.Rectangle.Top) + 170)){
wheel.Window.BringToFront();
if(wheel.Delta > 0){
if ( exeName == "WINWORD.EXE"||exeName == "Acrobat.exe"||exeName =="MindManager.exe"){
sp.SendKeys("^z")}
else if ( exeName == "chrome.exe"){
sp.SendKeys("^+{TAB}")}
else{
sp.MouseWheel(wheel.Point, false, wheel.Delta);}
}else{
if(exeName == "WINWORD.EXE"||exeName =="MindManager.exe"){
sp.SendKeys("^y")}
else if ( exeName == "Acrobat.exe"){
sp.SendKeys("^+z")}
else if ( exeName == "chrome.exe"){
sp.SendKeys("^{TAB}")}
else{
sp.MouseWheel(wheel.Point, false, wheel.Delta)}
}
}
//is the mouse along the Bottom side of the window?
else if(parseInt(wheel.Y) >= (parseInt(wheel.Window.Rectangle.Bottom) - 30)) {
wheel.Window.BringToFront();
if(wheel.Delta > 0) {
if ( exeName == "StormPlayer.exe"){
sp.SendKeys("{left}")}
else if ( exeName == "Acrobat.exe"){
sp.SendModifiedVKeys([vk.LCONTROL], [vk.ADD])}
else{
sp.SendControlDown();
sp.MouseWheel(wheel.Point, false, +120);
sp.SendControlUp()
}
}else{
if ( exeName == "StormPlayer.exe"){
sp.SendKeys("{right}")}
else if ( exeName == "Acrobat.exe"){
sp.SendModifiedVKeys([vk.LCONTROL], [vk.SUBTRACT])}
else{
sp.SendControlDown();
sp.MouseWheel(wheel.Point, false, -120);
sp.SendControlUp()}
}
}
//is the mouse along the Bottom side of the window?
else if(parseInt(wheel.Y) >= parseInt(wheel.Window.Screen.WorkingArea.Height *2/3)) {//下1/3窗口
wheel.Window.BringToFront();
if(wheel.Delta > 0) {
if ( exeName == "StormPlayer.exe"){
sp.SendKeys("{left}")}
else{
sp.MouseWheel(wheel.Point, false, wheel.Delta);
}
}else{
if ( exeName == "StormPlayer.exe"){
sp.SendKeys("{right}")}
else{
sp.MouseWheel(wheel.Point, false, wheel.Delta)}
}
}
//is the mouse along the other area of the window?
else{
sp.MouseWheel(wheel.Point, false, wheel.Delta);
}