Jump to content

Mouse Scroll Wheel Inverted - Using Mac Automator - My Fix


You may need some basic understanding of Mac Automator, to understand this post. I can't type everything so if you have questions just ask. 

 

Like this poster above ^
So I noticed that with my system, I have to invert the mouse wheel direction in system preferences before launching Warthunder, and then back to normal when I am not playing Warthunder. I often forget this and then in battle my scroll is reversed and then I die since we don't have time for mistakes..lol
You may have gotten used to the inverted mouse wheel playing on a Mac, and if you have, don't bother with any of the following;

But I decided to create an Automator Application with an inserted AppleScript which toggles this mouse direction button in system preferences. Then the next action in Automator opens warthunder. I can now launch Warthunder every time with this app and it inverts my mouse and then opens warthunder. 

Then I saved it as an Automator Application and gave it a cool icon. 

My personal Automator Workflow Application is called "Open Warthunder" and does the following; You can modify yours as you see fit. 

1. Quits all applications on my mac

2. Runs the AppleScript to toggle the mouse wheel direction
4. Launches Application Warthunder

Then you will still need to click play in their client window.
Then it will take you to the login screen to play, where you can  type your password and login.

The script to toggle the mouse is below, (this is the one you would insert into Automator; You will need to add system preferences to you dock. 



 

-- Click “System Preferences” in the Dock.

delay 0.3

set timeoutSeconds to 2.0

set uiScript to "click UI Element \"System Preferences\" of list 1 of application process \"Dock\""

my doWithTimeout(uiScript, timeoutSeconds)

 

-- Click the “Mouse” button.

delay 0.5

set timeoutSeconds to 2.0

set uiScript to "click UI Element \"Mouse\" of scroll area 1 of window \"System Preferences\" of application process \"System Preferences\""

my doWithTimeout(uiScript, timeoutSeconds)

 

-- Click the “Scroll direction: Natural” tick box.

delay 0.5

set timeoutSeconds to 2.0

set uiScript to "click checkbox \"Scroll direction: Natural\" of window \"Mouse\" of application process \"System Preferences\""

my doWithTimeout(uiScript, timeoutSeconds)

 

-- Click the “<fill in title>” button.

delay 0.4

set timeoutSeconds to 2.0

set uiScript to "click UI Element 1 of group 1 of group 1 of tool bar 1 of window \"Mouse\" of application process \"System Preferences\""

my doWithTimeout(uiScript, timeoutSeconds)

 

-- Click the “System Preferences” menu.

delay 0.4

set timeoutSeconds to 2.0

set uiScript to "click menu bar item \"System Preferences\" of menu bar 1 of application process \"System Preferences\""

my doWithTimeout(uiScript, timeoutSeconds)

 

-- Quit System Preferences

delay 0.3

set timeoutSeconds to 2.0

set uiScript to "click menu item \"Quit System Preferences\" of menu 1 of menu bar item \"System Preferences\" of menu bar 1 of application process \"System Preferences\""

my doWithTimeout(uiScript, timeoutSeconds)

 

on doWithTimeout(uiScript, timeoutSeconds)

set endDate to (current date) + timeoutSeconds

repeat

try

run script "tell application \"System Events\"

" & uiScript & "

end tell"

exit repeat

on error errorMessage

if ((current date) > endDate) then

error "Can not " & uiScript

end if

end try

end repeat

end doWithTimeout

 

Disclaimer; I am not a programmer. This works on my system, and there was a lot of learning and trial and error to get it to work on my system. 

Different delay times in the script may be needed for slower computers than mine. But I doubt it since these are very simple commands.

If it doesn't work on your system and you still want to make this, learn how to "record watch me do actions in automator" "convert watch me do actions from automator to AppleScript" "Test AppleScript" "Insert AppleScript into Automator" etc.. You will get there. 

To get all this to work, , you will need to give Automator, AppleScript, and this app you are making access to the computer in Security Settings. Its in Security Settings / Accessibility..Click the lock and allow these apps to access the computer with the + symbol. 

As for the Warthunder Icon, its not necessary, the Automator Robot Icon is fine..
But I made I made a .icns set. If you want to change the default Automator App Icon to a icon you made, this is pretty easy to do. Just make a .icns first. (This would be a seperate tutorial, but still very easy)
Then right click your new app, click "get info" then drag the .icns file onto the icon file at the top of the get info window. Remember that pretty much every edit you make to the app, you will probably need to keep going back into security, and re-granting it access to the computer.  

When you finish playing and close warthunder, your mouse will still be inverted to Warthunder direction. If you want you can make another application just with the toggle script in it. I called mine "Toggle Mouse Wheel" and you can see it next to the "Open Warthunder" application in the video. Its just the same script, but without the open warthunder part. 

The application in Action 

 

Edited by Tin_Foil_Armour
medal

Share this post


Link to post
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...