Rank: Advanced Member
Groups: Approved
Joined: 5/6/2019(UTC) Posts: 111 Thanks: 19 times Was thanked: 1 time(s) in 1 post(s)
|
Forgive my ignorance, I am not sure if this is a bug in S+. Because S+ always prompts errors:access denied, which is very distressing. The worst part is that I don't know what is wrong with my code, so I specifically come to ask friends.Thanks in advance everyone for your help
Code:
//Acrobat长按左键移动
//Acrobat长按左键250ms暂时按下空格键
if(click.Down
&& click.Window.Process.MainModule.ModuleName == "Acrobat.exe"){
if(!sp.GetStoredBool("HADN")){
sp.StorePoint("ClickStart", click.Point);
sp.DeleteStoredBool("HAND")
//Create timer that waits 300 milliseconds, then executes
sp.CreateTimer("LongPressTimer",
250,
0,
`//Get the start point/location where mouse down occurred
var startPoint = sp.GetStoredPoint("ClickStart");
//Get the current mouse location
var currPoint = sp.GetCurrentMousePoint();
//Calculate distance in pixels from the start of the click
var distance = Math.sqrt(Math.pow((currPoint.X- startPoint.X), 2.0) + Math.pow((currPoint.Y - startPoint.Y), 2.0));
//Only if the mouse has moved less than 10 pixels since click down
if (distance < 2){
sp.MouseClick(currPoint, MouseButtons.Left, false, true);
sp.SendVKeyDown(vk.SPACE);
}
sp.DeleteTimer("LongPressTimer");
`);
}else{
sp.StorePoint("ClickStart2", click.Point);
//Create timer that waits 300 milliseconds, then executes
sp.CreateTimer("LongPressTimer2",
250,
0,
`//Get the start point/location where mouse down occurred
var startPoint2 = sp.GetStoredPoint("ClickStart2");
//Get the current mouse location
var currPoint2 = sp.GetCurrentMousePoint();
//Calculate distance in pixels from the start of the click
var distance2 = Math.sqrt(Math.pow((currPoint2.X- startPoint2.X), 2.0) + Math.pow((currPoint2.Y - startPoint2.Y), 2.0));
//Only if the mouse has moved less than 10 pixels since click down
if (distance2 < 2){
sp.MouseClick(currPoint2, MouseButtons.Left, false, true);
sp.SendVKeyUp(vk.SPACE);
}
sp.DeleteTimer("LongPressTimer2");
`);
sp.StoreBool("HAND", true)
}
}else{
sp.DeleteTimer("LongPressTimer");
sp.DeleteTimer("LongPressTimer2");
}
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
Some processes may not be able to be accessed due to security. Are you running S+ installer, or are you running portable? If you're running portable, are you running as Administrator? If not, do you get the error if you run S+ as Administrator? Also, try replacing your filename check with this and see if it works any differently. Code://if(click.Down
// && click.Window.Process.MainModule.ModuleName == "Acrobat.exe"){
if(click.Down
&& sp.GetWindowMainModuleFileName(click.Window) == "Acrobat.exe"){
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 5/6/2019(UTC) Posts: 111 Thanks: 19 times Was thanked: 1 time(s) in 1 post(s)
|
thank you for your reply. Through your prompts, I first gave S+ administrator rights, but S+ will still appear the above prompt. Later, I only replaced part of the code you provided, the error type has changed, and the S+ prompt cannot enumerate the process module (the picture below prompts). Finally, I made the above two changes at the same time (giving administrator rights and replacing part of the code. So far, no problems have been found. I will continue to track this uncertain bug later.
|
|
|
|
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