It is currently May 1st, 2024, 4:17 am

How to center my dock easily

Get help with creating, editing & fixing problems with skins
0waska0
Posts: 5
Joined: November 6th, 2011, 1:18 pm

How to center my dock easily

Post by 0waska0 »

Hello,
First, I want to say I am French, so my explanation will be little confused.

I make a dock to open applications, it's centered by

Code: Select all

[Variables]
a=((#SCREENAREAWIDTH#/2)-376)
And I would when I open a specific application (Dimension of the icon: 64x64), the dock remains centered.
I use this

Code: Select all

[Box1]
Measure=Plugin
Plugin=Process
ProcessName=iexplore.exe
IfAboveValue=0
IfAboveAction=!Execute [!RainmeterShowMeter IE][!SetVariable a (#a#-34)][!RainmeterRedraw]
IfBelowValue=0
IfBelowAction=
DynamicVariables=1

[IE]
Meter=IMAGE
x=0R
y=0
ImageName=C:\Users\Admin\Documents\Rainmeter\Skins\Dock\IE.png
hidden=1
It works fine but when I open and then close the application the dock was moved of 34 pixels to the left.

The problem is how to make my dock is always centered

Thank for reading and please help me!

The code of all my skin:

Code: Select all

[Rainmeter]
Author=0Waska0
Skin Name=Dock
Update=1000
UpdateDivider=1
[Variables]
a=((#SCREENAREAWIDTH#/2)-376)

[Photos]
Meter=IMAGE
x=0
y=0
ImageName=C:\Users\Admin\Documents\Rainmeter\Skins\Dock\Photos.png
LeftMouseUpAction=!Execute ["C:\Users\%username%\Photos"]


[iTunes]
Meter=IMAGE
x=2R
y=0
ImageName=C:\Users\Admin\Documents\Rainmeter\Skins\Dock\iTunes.png
LeftMouseUpAction=!Execute ["C:\Program Files\iTunes\iTunes.exe"]

[Safari]
Meter=IMAGE
x=2R
y=0
ImageName=C:\Users\Admin\Documents\Rainmeter\Skins\Dock\Safari.png
LeftMouseUpAction=!Execute ["C:\Program Files\Safari\Safari.exe"]

[Notepad]
Meter=IMAGE
x=2R
y=0
ImageName=C:\Users\Admin\Documents\Rainmeter\Skins\Dock\Notepad.png
LeftMouseUpAction=!Execute ["C:\Windows\System32\notepad.exe"]

[Skype]
Meter=IMAGE
x=2R
y=0
ImageName=C:\Users\Admin\Documents\Rainmeter\Skins\Dock\Skype.png
LeftMouseUpAction=!Execute ["C:\Program Files\Skype\Skype.exe]

[Box1]
Measure=Plugin
Plugin=Process
ProcessName=iexplore.exe
IfAboveValue=0
IfAboveAction=!Execute [!RainmeterShowMeter IE][!SetVariable a (#a#-34)][!RainmeterRedraw]
IfBelowValue=0
IfBelowAction=
DynamicVariables=1

[IE]
Meter=IMAGE
x=0R
y=0
ImageName=C:\Users\BenJ\Desktop\Bureau\iRain\Icons\Color\AllApps\IE.png
LeftMouseUpAction=!Execute ["www.gmail.com"]
hidden=1

[Separator2]
Meter=IMAGE
x=-3R
y=8
ImageName=Separator.png

[Mail]
Meter=IMAGE
x=-1R
y=0
ImageName=C:\Users\BenJ\Desktop\Bureau\iRain\Icons\Color\AllApps\Mail.png
LeftMouseUpAction=!Execute ["www.gmail.com"]

[Google]
Meter=IMAGE
x=2R
y=0
ImageName=C:\Users\BenJ\Desktop\Bureau\iRain\Icons\Color\AllApps\Google.png
LeftMouseUpAction=!Execute ["www.google.com"]
Last edited by 0waska0 on August 28th, 2012, 11:26 pm, edited 1 time in total.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: How to move and center if a process run

Post by eclectic-tech »

I haven't check this but:

In your [Box1] Measure you subtracted 34 when you activated IE but never added it back when it is not active; (Plugin=Process returns '1' when active, '-1' when inactive)...

Try adding this to your [Box1] measure:

Code: Select all

IfBelowValue=0
IfBelowAction=!Execute [!RainmeterHideMeter IE][!SetVariable a (#a#+34)][!RainmeterRedraw]
This should reset your 'a' variable to it's previous value...

Note: If you update Rainmeter to the latest version, you can save a lot of keystrokes;
you do not need '!Execute' or 'Rainmeter' in the actions ...

With the latest version this much shorter line works:
IfBelowAction=[!HideMeter IE][!SetVariable a (#a#+34)][!Redraw]

Hope this helps :)
0waska0
Posts: 5
Joined: November 6th, 2011, 1:18 pm

Re: How to move and center if a process run

Post by 0waska0 »

First thank you for answer me,
I tested what you recommended me but now all the time my dock was move to the right (34 pixels).
When I turn on my computer IE (internet explorer) is not opened and rainmeter thinks that he owes moved the dock towards the right, what I wish is when IE is opened he moves the dock towards the right and he show my icon (the icon of internet explorer) and when the aplication closes re-move the dock towards the left, or re-center it.

PS: thank for infos about, shorter line, and news version :)
0waska0
Posts: 5
Joined: November 6th, 2011, 1:18 pm

Re: How to center my dock easily

Post by 0waska0 »

It's possible to detected if an application in summer opened and is now closed? Or an option to center automatically my theme (skin) on my screen?
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: How to center my dock easily

Post by MerlinTheRed »

With the new section variables you could do something like this to center a meter on the screen:

!SetOption MeterName X "#SCREENAREAWIDTH#-[MeterName:H]/2"

The meter or measure you use this bang on likely has to have DynamicVariables=1. Now you only have to find out when exactly to trigger this Bang.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!