It is currently September 29th, 2024, 1:20 pm

Change folder path after it becomes inaccessable

General topics related to Rainmeter.
finalfantasyaddict
Posts: 6
Joined: August 2nd, 2014, 11:04 am

Change folder path after it becomes inaccessable

Post by finalfantasyaddict »

I am trying to find a way to link to the Local Folder in the case that the current folder path becomes inaccessible (owing to a network disconnection, HDD removal etc.).

To put it somewhat visually...

[UTILITIES]
This button when pressed (current code is below) usually heads to the 「HDD I:\」 Drive's 「[Utilities]」 folder but assuming the HDD is taken offline/removed etc. I would like the path to instead point to (for example) C:\Users\User\Desktop\[Utilities].



The current code below, only attests to having access to the location. I am unsure as to the correct IF - coupling needed or the particular condition needed to take, if that is what I need to do at all.

----------
Meter=STRING
MeterStyle=styleTitle
X=100
Y=210
W=190
H=18
Text="Utilities"
LeftMouseUpAction=["I:\[Utilities]"]
----------
Last edited by finalfantasyaddict on August 27th, 2014, 1:52 pm, edited 1 time in total.
User avatar
killall-q
Posts: 307
Joined: August 14th, 2009, 8:04 am

Re: Change folder path after it becomes inaccessable

Post by killall-q »

Code: Select all

[MeasureIDrive]
Measure=FreeDiskSpace
Drive=I:
Type=1
IgnoreRemovable=0
IfAboveValue=2
IfAboveAction=!SetOption Utilities LeftMouseUpAction ["I:\[Utilities]"]
IfBelowValue=2
IfBelowAction=!SetOption Utilities LeftMouseUpAction ["C:\Users\User\Desktop\[Utilities]"]
finalfantasyaddict
Posts: 6
Joined: August 2nd, 2014, 11:04 am

Re: Change folder path after it becomes inaccessable

Post by finalfantasyaddict »

Thank you for the quick reply but your code doesn't seem to have fixed the problem.
Although I am able to see what should be happening, the filepath when removed (which is correct) does not resolve leaving to pressing the meter and nothing happening.

Is there any ideas / a bit more explanation as to other things that need to be done?
User avatar
killall-q
Posts: 307
Joined: August 14th, 2009, 8:04 am

Re: Change folder path after it becomes inaccessable

Post by killall-q »

Is the folder name literally [Utilities]? I thought that was a little odd. Corrections to the path you should be able to do yourself.
finalfantasyaddict
Posts: 6
Joined: August 2nd, 2014, 11:04 am

Re: Change folder path after it becomes inaccessable

Post by finalfantasyaddict »

The Folder name literally is [Utilities].

The problem is that using the code you gave me, the folder on the external HDD opens when the device is plugged in (the I:\ Drive) as it should. However, when disconnected the Local Folder [Utilities] does not open. My last post was meant to say that I had checked that all file paths were correct and they were however when the external HDD is removed the meter when clicked does not open any folder at all.
User avatar
jsmorley
Developer
Posts: 22790
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Change folder path after it becomes inaccessable

Post by jsmorley »

You may want to escape that as [*Utilities*] in the bang(s), so they don't try to treat it as a Rainmeter [SectionName]. Particularly since you actually have a section in the skin named [Utilities].
finalfantasyaddict
Posts: 6
Joined: August 2nd, 2014, 11:04 am

Re: Change folder path after it becomes inaccessable

Post by finalfantasyaddict »

I had thought that I may be causing a problem with the square brackets so I tried renaming the folder without the [] but it still wouldn't change the folder path when the HDD went offline.
finalfantasyaddict
Posts: 6
Joined: August 2nd, 2014, 11:04 am

Re: Change folder path after it becomes inaccessable

Post by finalfantasyaddict »

Well it turns out I got it working by telling it to change meters depending on the measure rather than trying to change the filepath (still doesn't seem to work even with no square brackets). I ended up pulling a trick with the !ShowMeter / !Hide Meter bangs if anyone is interested. An example code (using mostly illustro variables and styles) is below.

Thanks to killall-q for the hint with the FreeDiskSpace value. I was looking for something similar that I thought was in a different section.

Thanks to jsmorley for the escaping variables hint. Rainmeter seems to have decided that it is a valid filepath without them though if it won't resolve the filepath in the future I will find if this is the cause first off.


*************************

[Variables]
; Variables declared here can be used later on between two # characters (e.g. #MyVariable#).
fontName=Trebuchet MS
textSize=8
colorBar=235,170,0,255
colorText=255,255,255,205

;-----------------------------------Styles-----------------------------------

[styleTitle]
StringAlign=CENTER
StringCase=UPPER
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1

;-----------------------------------Measures-----------------------------------

[MeasureUtilities]
Measure=FreeDiskSpace
Drive=Y:
Type=1
IgnoreRemovable=0
IfAboveValue=2
IfAboveAction=[!ShowMeter meterUtilitiesON] [!HideMeter meterUtilitiesOFF]
;Finds if the HDD is online and changes the meter to the display the External HDD Utilities folder meter
IfBelowValue=2
IfBelowAction=[!ShowMeter meterUtilitiesOFF] [!HideMeter meterUtilitiesON]
;Finds if the HDD is offline and changes the meter to the display the Local HDD Utilities folder meter

;-----------------------------------Meters-----------------------------------

[meterUtilitiesON]
Meter=STRING
MeterStyle=styleTitle
MeasureName=MeasureUtilities
X=100
;Make the ON and OFF meters identical in positioning
Y=12
;Make the ON and OFF meters identical in positioning
W=190
H=18
Hidden=1
Text="Utilities"
;This text can be changed to read "HDD Utilities" or equivalent to express the state of the External HDD.
LeftMouseUpAction=["Y:\[Utilities]"]
; Left-clicking this meter will launch the [Utilities] folder in the External Y:\ Drive.

[meterUtilitiesOFF]
Meter=STRING
MeterStyle=styleTitle
MeasureName=MeasureUtilities
X=100
;Make the ON and OFF meters identical in positioning
Y=12
;Make the ON and OFF meters identical in positioning
W=190
H=18
Hidden=1
Text="Utilities"
;This text can be changed to read "Local Utilities" or equivalent to express the state of the External HDD.
LeftMouseUpAction=["C:\Users\User\Desktop\[Utilities]"]
; Left-clicking this meter will launch the local [Utilities] Folder.

;-----------------------------------OPTIONAL-----------------------------------
;;Delete the semi-colons in the front of all lines of the following to display the status of the External Drive Y:/ as text (REMOVED or FIXED)

;[meterYTest]
;Meter=STRING
;MeterStyle=styleTitle
;MeasureName=MeasureUtilities
;X=100
;Y=30
;;Shows this meter below the [Utilities] folder text meter
;W=190
;H=18
;Text="%1"