Changing Scrolling Speed with Applescript - Problem

Discussion in 'Mac Programming' started by Jolly Jimmy, Aug 11, 2010.

  1. Jolly Jimmy macrumors 65816

    Jolly Jimmy

    Joined:
    Dec 13, 2007
    #1
    I'm trying to write an applescript to set the scrolling speed in the trackpad preferences. The script works for setting the tracking and double-click speed but for some reason it won't for the scrolling speed.

    Here's what I've got :

    ----------

    tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.trackpad"
    end tell
    tell application "System Events"
    set value of slider "Scrolling Speed" of window "Trackpad" of process "System Preferences" to 2
    end tell

    ----------

    Out of the three sliders in the trackpad preferences, "Scrolling speed" is the only one that the script won't work on.

    Any help is much appreciated.

    Running OS X 10.6.4 on a non-unibody MacBook.
     
  2. jake jilg macrumors newbie

    Joined:
    Dec 8, 2011
    #2
    I hate to bump an old thread, but I too was having the same problem. I came across this page on Google looking for the solution. I played around with your script and have solved it through guessing the value of the slider.

    tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.trackpad"
    end tell
    tell application "System Events"
    set value of slider 3 of window "Trackpad" of process "System Preferences" to 2
    end tell

    For some reason it is the third slider and not the second.
     
  3. Partron22, Dec 8, 2011
    Last edited: Dec 8, 2011

    Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #3
    You missed a tab group.
    This works for me:
    Code:
    set value of slider "Tracking Speed" of tab group 1 of window "Trackpad" of application process "System Preferences" to 2
    Oh, 10.6.4.
    My answer was for Lion.

    The easiest way I've found to get the correct phrasing for a line like that is to get it from a script like this one:
    Code:
    -- Entire Contents Demo - mini
    -- BP ages ago or so
    
    -- This'll get all the controls and structures associated with an App's window and menus
    -- In a form which is easily pasteable into your own scripts
    -- and show them in the result pane below.
    --
    -- Copy that into a text editor and change commas to returns to get an easily  readable list.
    --
    -- The script can take a long time if there are LOTS of window items, such as
    -- in the "music" pane of iTunes. It may even time out if you have a huge iTunes library
    -- The script'll process most App's UI structures in under a minute
    
    set appname to "System Preferences" -------------------------- Set this to the App you want to look at
    
    set winstuff to "defaultval"
    set menustuff to "defaultval"
    
    tell application appname
    	activate
    end tell
    
    tell application "System Events"
    	tell process appname
    		set winstuff to entire contents of front window
    		set menustuff to entire contents of menu bar 1
    	end tell
    end tell
    --return winstuff & "\r\r\r\r" & menustuff -- comment this out to get just winstuff
    return winstuff -- comment this out too to get just menustuff
    --return menustuff
     

Share This Page