StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
2014218866  
#1 Posted : Sunday, March 22, 2020 4:47:10 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 71
China

Thanks: 10 times
Hello Rob.
S + can't achieve the function I want in AutoCAD. Can you help me find out the reason?
Below is my script. The scroll wheel key is my modifier key.
Code:

var exeName =action.Window.Process.MainModule.ModuleName;

if ( exeName ==  "chrome.exe"||exeName =="Acrobat.exe"){
sp.SendModifiedVKeys([vk.LCONTROL,vk.LSHIFT], [vk.TAB]);
}else if(exeName == "WINWORD.EXE"||exeName =="EXCEL.EXE" ){
sp.SendVKey(vk.BACK);
}else if(exeName == "acad.exe" ){
sp.SendVKey(vk.F3);
}     


UserPostedImage
Rob  
#2 Posted : Sunday, March 22, 2020 9:26:33 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 602
United States

Thanks: 5 times
Was thanked: 134 time(s) in 120 post(s)
Okay, well let's start with some basic troubleshooting to determine if S+ is seeing that it's AutoCAD or not.

This adds an else to show two message boxes, one for the EXE name and another for the window title.

Edit: Also added a message box in the acad.exe match as well

Code:
var exeName =action.Window.Process.MainModule.ModuleName;

if ( exeName ==  "chrome.exe"||exeName =="Acrobat.exe")
{
    sp.SendModifiedVKeys([vk.LCONTROL,vk.LSHIFT], [vk.TAB]);
}
else if(exeName == "WINWORD.EXE"||exeName =="EXCEL.EXE" )
{
    sp.SendVKey(vk.BACK);
}
else if(exeName == "acad.exe" )
{
    sp.SendVKey(vk.F3);
    sp.MessageBox("Found AutoCAD", "Match");
}  
else
{
    //No match, show EXE name and window title
    sp.MessageBox("exeName: " + exeName, "exeName");
    sp.MessageBox("Title: " + action.Window.Title, "Title");
}

Edited by user Sunday, March 22, 2020 9:28:11 AM(UTC)  | Reason: Not specified

2014218866  
#3 Posted : Monday, March 23, 2020 5:59:38 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 71
China

Thanks: 10 times
UserPostedImage
Thank you for your reply, using the screenshot below. I don't know why, my mouse button doesn't work after using this script.
One thing I want to remind you is that after the mouse wheel is pressed, the function originally used in CAD is the hand (that is, the function of moving graphics)
Rob  
#4 Posted : Monday, March 23, 2020 7:34:37 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 602
United States

Thanks: 5 times
Was thanked: 134 time(s) in 120 post(s)
Okay, so you can remove the sp.MessageBox lines, we know S+ is finding it as acad.exe.

So it would seem the issue is AutoCAD not accepting or receiving the input; that is a bit more challenging to find the cause.

Can you try other keystrokes to see if anything works? Maybe something like sp.SendModifiedVKeys([vk.LMENU], [vk.SPACE]); to see if the main window menu appears.

Do you have Spy++ to be able to watch messages received by AutoCAD?

Are you running the portable or installer version of S+?
2014218866  
#5 Posted : Monday, March 23, 2020 7:56:11 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 71
China

Thanks: 10 times
Well, I have tried other gestures, and they all work normally in CAD (including the scroll wheel drawing z to perform the undo function). S + gestures can't perform the corresponding functions normally when the scroll wheel is used as a modifier key (the settings of S + are shown in the figure above). So I guess it might be caused by that modifier key. I am running the portable version.
2014218866  
#6 Posted : Monday, March 23, 2020 8:11:30 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 71
China

Thanks: 10 times
UserPostedImage

With the above S + settings, Such a setup cannot execute any scripts in CAD, so is the installed version of S +.
Rob  
#7 Posted : Monday, March 23, 2020 8:45:07 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 602
United States

Thanks: 5 times
Was thanked: 134 time(s) in 120 post(s)
I see you have the use secondary gesture button checked, what is your secondary button set to?
2014218866  
#8 Posted : Monday, March 23, 2020 4:50:17 PM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 71
China

Thanks: 10 times
The right mouse button is the main gesture key, and the scroll wheel is the second gesture key. The settings on the picture are to execute a certain script function when the scroll wheel is pressed and the scroll wheel is scrolled up.
Rob  
#9 Posted : Tuesday, March 24, 2020 8:11:54 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 602
United States

Thanks: 5 times
Was thanked: 134 time(s) in 120 post(s)
Okay, so I set my middle button as secondary, then created an action just like yours. I executed it in Notepad and the F3 key is sent without issue each scroll.

I do have this checked Options > Advanced > 启用对鼠标滚轮的识别

But that only enables each wheel tick to execute, otherwise you would have to hold wheel button, scroll wheel up, then release to send F3.

So I'm not sure why it wouldn't be working on AutoCAD.

Does sp.SendVKey(vk.F3); work in AutoCAD if you just make a regular right button gesture?
2014218866  
#10 Posted : Tuesday, March 24, 2020 8:31:20 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 71
China

Thanks: 10 times
UserPostedImage

UserPostedImage

Yes, S + works fine, maybe I'm sure it's the problem caused by the scroll wheel up. The configuration of S + in the first image can execute F3 or other scripts. But when I select the scroll wheel up, S + cannot execute the same script as above
2014218866  
#11 Posted : Tuesday, March 24, 2020 8:37:12 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 71
China

Thanks: 10 times
Maybe it is the problem of S + or it may be the problem of CAD itself. Of course, it would be an exaggeration to ask you to find an AUTO CAD software for experiments, so my feedback can end here. Thank you for your reply, Rob. Don't worry about this.
Users browsing this topic
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.