Reply
Logi Nu
Smaster77
Posts: 3
Registered: 01-14-2011
0
Accepted Solution

How to program central scroll button on G13

Hi all! I've just bought a G13 for CAD drawing and it's amazing.

 

though, in programs such as AutoCad the central scroll Button it's used to move the view, and i would like to add it on a button in my g13. The problem is that I can't do that , it won't allow me neither with the "MR" button or with the software (not even with a macro).

 

Does any of you know how to do that?

 

Thanks a lot!

Logi Journeyman
h0rse
Posts: 349
Registered: 08-13-2010
0

Re: How to program central scroll button on G13

hi,

are you talking about the mouse-wheel or the page-up page-down button? (i think the mouse-wheel is zoom in/out in autocad).

anyway, here is a script that would do the following stuff:

 

G 7 => PageUp

G14=> PageDown

 

G26=> ScrollUp (Thumbstick Up)

G28=> ScrollDown (Thumbstick Down)

 

adjustment:

- now you can change the keys if you want to, just set the arg=1 for G1 or arg=2 for G2 ...

- if the scroll-speed is too fast try to increase the variable in the ScrollUp/Down function (bottom of script) where it says: RepeatFunction(10,family): change 10 to a higher value

i dont have acad installed here so i cant test it.

 

first time using script?

1) Key-Profiler -> Edit -> Script Editor -> Copy the code below and paste it into the script editor (overwriting)

2) Key-Profiler -> G7/14/26/28 -> left-click -> assign script

3) if you want to use these functions not only for acad do this: Key-Profiler -> Settings/Properties -> Profiler -> Profile -> check 2nd checkbox "lock profile"

 

code:

function OnEvent(event, arg, family)
    --OutputLogMessage("event = %s, arg = %s\n", event, arg);
    if event=="PROFILE_ACTIVATED" then 
        ClearLog(); OutputLogMessage("Script Started!\n")
        toggle = 0
    end
    if event=="M_PRESSED" and toggle~=0 then
        StartFunction(current)
    end
    if event=="G_PRESSED" then
        if arg==7 then PressKey("pageup")                       -- G7 = Page Up
        elseif arg==14 then PressKey("pagedown")                -- G14= Page Down
        elseif arg==26 then                                     -- G26= Scroll Up (Thumbstick UP)
            if toggle == 0 then 
                toggle = arg
                current = "ScrollUp"
                StartFunction(current)
            end
        elseif arg==28 then                                     -- G28= Scroll Down (Thumbstick DOWN)
            if toggle == 0 then 
                toggle = arg
                current = "ScrollDown"
                StartFunction(current)
            end
        end
    elseif event=="G_RELEASED" then
        if arg==7 then ReleaseKey("pageup")                     -- G7 = Page Up
        elseif arg==14 then ReleaseKey("pagedown")              -- G14= Page Down
        elseif arg==26 then                                     -- G26= Scroll Up (Thumbstick UP)
            if toggle == arg then 
                toggle = 0
            end
        elseif arg==28 then                                     -- G28= Scroll Down (Thumbstick DOWN)
            if toggle == arg then 
                toggle = 0
            end
        end
    end
end

function StartFunction(name)                                -- Handler Function 
    str=name.."()"
    return assert(loadstring(str))()
end

function RepeatFunction(delay, family)                      -- Handler Function
    if delay==nil then delay=0 end
    Sleep(delay)
    if family==nil then SetMKeyState(GetMKeyState())
    else SetMKeyState(GetMKeyState(family),family)
    end
end

function ScrollUp()
    MoveMouseWheel(1)
    RepeatFunction(10,family)
end

function ScrollDown()
    MoveMouseWheel(-1)
    RepeatFunction(10,family)
end

 

hope this is what you need?! gimme feedback!

 

Logi Nu
Smaster77
Posts: 3
Registered: 01-14-2011
0

Re: How to program central scroll button on G13

I'm not English, and I guess I din't explain myself correctly, I apologise! :smileyhappy:

 

What I meant is how to add this: pushing un the scroll wheel in the mouse, in a botton of the g13

 

 

When pushing the wheel, in autocad you can move sideways (not zooming) in the drawing, is that called "pan" ? And the wheel in my G9 it's pretty hard, so I wanted to add this function in the G13 but I don't know how to do that cause the program does not recognize it.

 

Can this be done with a script?

 

Thanks a lot :smileyvery-happy:

Logi Guru
kgober
Posts: 2,053
Registered: 05-28-2009
0

Re: How to program central scroll button on G13

I think clicking the wheel button usually counts as mouse button #3.

 

so PressAndReleaseMouseButton(3) or something like that?

 

-ken

________________________________
I do not work for Logitech. I'm just a user.
Logi Visitor
Bohi2_OGU
Posts: 22
Registered: 12-09-2010
0

Re: How to program central scroll button on G13

[ Edited ]

Click 1 time (left mouse button) on the button of the g13 where you want to add/ use the command for it.

Choose the Macro Manager from the drop down menu.

Choose new on the left down window and add a name for it, like; mouse wheel press.

Then press "start the recording" in the right section of the same window.

Then with your mouse, right click,  in the blanco recording section  and choose from the drop menu the option what you like or want by mouse action's its all there.

To be precise its named add a mouseaction, anyway i use not the english version of the software but dutch so i hope i translate well for you. Otherwise follow the action by action.

 

Option what can be chosen there are 3 ...up, down, press.. and for the following buttons;

 

Left button, middle button, right button, wheel and a extra button

 

 

Logi Journeyman
h0rse
Posts: 349
Registered: 08-13-2010
0

Re: How to program central scroll button on G13

[ Edited ]

aaaaahh okay.

a scroll wheel click is PressAndReleaseMouseButton(2) in scripting

see G-seriesLuaAPI.pdf page 20

but as said above you can do it with makros too.

Logi Nu
Smaster77
Posts: 3
Registered: 01-14-2011
0

Re: How to program central scroll button on G13

Excelent man! Thanks a lot! :smileyvery-happy: Finally got it!

Logi Visitor
Bohi2_OGU
Posts: 22
Registered: 12-09-2010
0

Re: How to program central scroll button on G13

Yeah that's OK man, its no trouble at all its nice that people,as your selfs, give some feedback when it works out (-or not).

That's for people the spirit to give and (atleast for me)  help around when and where we can, so a thanks is enough and appreciated.