Jump to content
Sign in to follow this  
willichan

Start ObjectDock on Default Tab

Recommended Posts

willichan

Posted ImageI have been frustrated because of ObjectDock's lack of a default tab option. It always wants to open the last used tab, so I naturally turned to AutoIt to remedy the situation.

Run this script instead of running ObjectDock directly. It will set the history to point to the first tab (tab 0) for all tabbed docks, then launch ObjectDock.

Currently, it only supports ObjectDock Plus 2 (the version I have). If anyone with other versions would like to provide me with paths and registry entries for their version, I will update the script to handle those versions as well. Updating the code to accommodate your version should be simple and strait-forward.

* Thanks to 69255 for waking me up to the INI file.

#cs ----------------------------------------------------------------------------
Project Name: ObjectDockLauncher
Description: Sets all OD tab docks to open with the first tab selected, then launches OD
Creation Date: 2/21/2012
AutoIt Version: v3.3.8.1
Author: willichan
Company: Options Integrated
#ce ----------------------------------------------------------------------------
#include "inc_config.au3"
;;; Close if can't find INI file
If Not FileExists(ODIniPath()) Then Exit
;;; Close if OD is already running
If ProcessExists("ObjectDock.exe") Then Exit
LoopAll()
Run(ODPath())
Exit
Func ODPath()
;;; This function should eventually become version aware.
;;; For now, change the registry path according to your version of OD
Local $path
$path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ObjectDock Plus 2", "InstallLocation")
If @error Then Return ""
If StringRight($path, 1) <> "\" Then $path = $path & "\"
$path = $path & "ObjectDock.exe"
Return $path
EndFunc   ;==>ODPath
Func ODIniPath()
;;; This function should eventually become version aware.
;;; For now, change the path according to your version of OD
Return @UserProfileDir & "\Local Settings\Application Data\Stardock\ObjectDockPlus\CurrentTheme.ini"
EndFunc   ;==>ODIniPath
Func LoopAll()
;;; Checks for the existance of a [SettingsX] section counting sequentially
;;; until a non-extant section is encountered.
;;; Calls ZeroIt for each section found to exist.
Local $path = ODIniPath()
Local $res
Local $i = 0
Do
  $i += 1
  $res = IniReadSection($path, "Settings" & $i)
  If @error Then
   $res = -1
  Else
   ZeroIt("Settings" & $i)
  EndIf
Until $res = -1
EndFunc   ;==>LoopAll
Func ZeroIt($section)
;;; Checks to see if there is a "lastSelected" value (it is a tab dock)
;;; if found, sets it to "0".
Local $path = ODIniPath()
Local $res = IniRead($path, $section, "lastSelected", "")
If $res <> "" Then IniWrite($path, $section, "lastSelected", "0")
EndFunc   ;==>ZeroIt

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×