It is currently June 15th, 2024, 7:56 am

Sound enable

Get help with creating, editing & fixing problems with skins
chems84
Posts: 1
Joined: November 30th, 2022, 12:57 pm

Sound enable

Post by chems84 »

hi! anyone can help me please. i create the logon system like and i want to enable to play sound file like "Soundfile1=Access Granted" or "Soundfile2=Access Denied". but end up play with soundfile1: my meter is here:

Code: Select all

[Variables]
Soundfile1=@music\Access Granted.wav
Soundfile2=@music\Access Denied.wav
Password=
DistanceLockInput=20
ShakeX = 0
FontSize=18
            


[BlurBehind]
 Measure=Plugin
 Plugin=FrostedGlass
 UpdateDivider=-1
 ;Default=1 Determines if the blur is enabled or not
 BlurEnabled=1


[MeterBlurredBackground]
 Meter=Image
 SolidColor=0,0,0,1
 W=#VSCREENAREAWIDTH#
 H=#SCREENAREAHEIGHT#
RightMouseUpAction=[]
MouseActionCursorName=..\..\..\..\..\..\..\..\Windows\Cursors\aero_arrow.cur

[ShakeAnim]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Wait 1|Repeat MoveLeft, 20, 3 | Wait 1 | Repeat MoveRight, 20, 6 | Wait 1 | Repeat MoveLeft, 20, 3
MoveLeft = [!SetVariable "ShakeX" "(CLAMP(#ShakeX# - 4, -10, 10))"][!Update][!Redraw]
MoveRight = [!SetVariable "ShakeX" "(CLAMP(#ShakeX# + 4, -10, 10))"][!Update][!Redraw]
ActionList2=Wait 500|OpenPasswordSetter
OpenPasswordSetter=[!CommandMeasure MeasureInput "ExecuteBatch 2"]
DynamicVariables=1


[MeterLock]
 Meter=Image
 ImageName=#@#lock-icon
 W=256
 H=256
 X=(#PWORKAREAWIDTH# / 2 - [MeterLock:W] / 2 + #ShakeX#)
 Y=([MeterBlurredBackground:H] / 2 - [MeterLock:H] / 2 - [InputBar:H] / 2 - #DistanceLockInput#)
 DynamicVariables=1
 LeftMouseUpAction=[!CommandMeasure MeasureInput "ExecuteBatch 1"]

 [InputBar]
 Meter=Image
 SolidColor=230, 230, 230
 X=([MeterLock:X])
 Y=([MeterLock:Y] + [MeterLock:H] + #DistanceLockInput#)
 W=256
 H=30
 DynamicVariables=1
 LeftMouseUpAction=[!CommandMeasure MeasureInput "ExecuteBatch 1"]

 [MeasureInput]
Measure=Plugin
Plugin=InputText
SolidColor=230,230,230
FontColor=0,0,0
FontFace=Seqoe UI
AntiAlias=1
FontSize=#FontSize#
X= ([InputBar:X] + 5)
Y=( [InputBar:Y])
H= [InputBar:H]
W= ([InputBar:W] - 10)
Command1=[!UpdateMeasure "MeasureInput"][!SetVariable "inputPass" "$UserInput$"][!UpdateMeasure "PasswordSetter"][play #Soundfile1#]
Command2=[!WriteKeyValue "Variables" "Password" "$UserInput$"][!HideFade][Refresh] DefaultValue="Create password" Password=0 [play #Soundfile2#][Stop #Soundfile1#]
 TopMost=1
 UpdateDivider=-1
IfMatch=(?=^1234$)(?=^[^\s]+$)
IfMatchAction=[!HideFade] [!UpdateMeasure MeasureInput][!SetVariable "Open" "1"]
IfNotMatchAction=
 DynamicVariables=1
 Password=1
FocusDismiss=0
OnDismissAction=[!UpdateMeasure PasswordSetter]

 [PasswordSetter]
 Measure=String
 String=#Password#
 IfMatch=^\s*$
 IfMatchAction=[!CommandMeasure ShakeAnim "Execute 2"]
 IfMatch2=(?=^#inputPass#$)
 IfNotMatchAction2=[!CommandMeasure ShakeAnim "Execute 1"]
 IfMatchMode=1
 DynamicVariables=1
 UpdateDivider=-1
Last edited by balala on December 14th, 2022, 5:00 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are posting codes. It's the </> button.
User avatar
CodeCode
Posts: 1370
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Sound enable

Post by CodeCode »

I am not positive this is the final solution but at first glance - in thjis section of code:

Code: Select all

[Variables]
Soundfile1=@music\Access Granted.wav
Soundfile2=@music\Access Denied.wav
Password=
DistanceLockInput=20
ShakeX = 0
FontSize=18
  
There is no such usage for a @Music folder. The idea you might have misunderstood is the @Resources folder can have a subfolder named music (no @ in it).
SO it should look like this:

Code: Select all

[Variables]
Soundfile1=#@#\music\Access Granted.wav
Soundfile2=#@#\music\Access Denied.wav
Password=
DistanceLockInput=20
ShakeX = 0
FontSize=18
  
The added \ after the #@# isnt really very needed but it doesnt bother anything either.

EDIT: the #@# is a shortcut to the @Resources directory - for files and other components that might need to be used would - when in the @resources folder the file is accessed like this #@#Image.png or for a folder #@#Music...\filename.flac
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5434
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Sound enable

Post by eclectic-tech »

Along with CodeCode suggestion to check the sound file paths, there are few other errors.

The [play #Soundfile#] bangs should have quotes " around those sound variables names (due to spaces in the values):
[Play "#Soundfile1#"].

[Stop ...] is not a valid bang, use [PlayStop "some/wav"].

In Command2 of [MesaureInput] you do not have an exclamation point in [Refresh], it should be [!Refresh] so the skin was not being refreshed after setting a new password.

The IfMatch test in [MesaureInput] now tests for the current password. The additional Perl controls (^ $ etc.) are not required in the IfMatch test you are using. I modified the test values.

I added options, you can consider adding to [MeasureInput], to limit the user inputs to only numbers (InputNumber=1) or a limited number of characters (InputLimit=4), if you want only 4-number passwords.

I would also suggest setting the skin position to "TopMost" [!ZPos +1] on load or refresh by adding that to a [Rainmeter] section.

Here is your code with those corrections and suggestions.
Let us know if you have any questions.

Code: Select all

[Rainmeter]
OnRefreshAction=[!ZPos 1]

[Variables]
Soundfile1=#@#music\Access Granted.wav
Soundfile2=#@#music\Access Denied.wav
; To creste a new password delete current password; e.g; 'Paswword=' and refresh the skin.
Password=1234
DistanceLockInput=20
ShakeX = 0
FontSize=18


[BlurBehind]
Measure=Plugin
Plugin=FrostedGlass
UpdateDivider=-1
;Default=1 Determines if the blur is enabled or not
BlurEnabled=1


[MeterBlurredBackground]
Meter=Image
SolidColor=0,0,0,1
W=#VSCREENAREAWIDTH#
H=#SCREENAREAHEIGHT#
RightMouseUpAction=[]
MouseActionCursorName=..\..\..\..\..\..\..\..\Windows\Cursors\aero_arrow.cur


[ShakeAnim]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Wait 1|Repeat MoveLeft, 20, 3 | Wait 1 | Repeat MoveRight, 20, 6 | Wait 1 | Repeat MoveLeft, 20, 3
MoveLeft = [!SetVariable "ShakeX" "(CLAMP(#ShakeX# - 4, -10, 10))"][!Update][!Redraw]
MoveRight = [!SetVariable "ShakeX" "(CLAMP(#ShakeX# + 4, -10, 10))"][!Update][!Redraw]

ActionList2=Wait 500 | OpenPasswordSetter
OpenPasswordSetter=[!CommandMeasure MeasureInput "ExecuteBatch 2"]
DynamicVariables=1


[MeterLock]
Meter=Image
ImageName=#@#Images\X
; #@#lock-icon
W=256
H=256
X=(#PWORKAREAWIDTH# / 2 - [MeterLock:W] / 2 + #ShakeX#)
Y=([MeterBlurredBackground:H] / 2 - [MeterLock:H] / 2 - [InputBar:H] / 2 - #DistanceLockInput#)
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureInput "ExecuteBatch 1"]

[InputBar]
Meter=Image
SolidColor=230, 230, 230
X=([MeterLock:X])
Y=([MeterLock:Y] + [MeterLock:H] + #DistanceLockInput#)
W=256
H=30
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureInput "ExecuteBatch 1"]

[MeasureInput]
Measure=Plugin
Plugin=InputText

; Optional limit as only numbers (negative sign and period options | Note: These count as characters)
; InputNumber=1

; Optional limit of number of characters
; InputLimit=4

SolidColor=230,230,230
FontColor=0,0,0
FontFace=Seqoe UI
AntiAlias=1
FontSize=#FontSize#
X= ([InputBar:X] + 5)
Y=( [InputBar:Y])
H= [InputBar:H]
W= ([InputBar:W] - 10)
Command1=[!UpdateMeasure "MeasureInput"][!SetVariable "inputPass" "$UserInput$"][!UpdateMeasure "PasswordSetter"]
Command2=[!WriteKeyValue "Variables" "Password" "$UserInput$"][!HideFade][!Refresh] DefaultValue="Create password" Password=0
TopMost=1
UpdateDivider=-1
IfMatch=#password#
; (?=^[^\s]+$)
IfMatchAction=[!HideFade][play "#Soundfile1#"][!UpdateMeasure MeasureInput][!SetVariable "Open" "1"]
IfNotMatchAction=
DynamicVariables=1
Password=1
FocusDismiss=0
OnDismissAction=[!UpdateMeasure PasswordSetter]

[PasswordSetter]
Measure=String
String=#Password#
IfMatch=^\s*$
IfMatchAction=[!CommandMeasure ShakeAnim "Execute 2"]
IfMatch2=^#inputPass#$
IfNotMatchAction2=[play "#Soundfile2#"][!CommandMeasure ShakeAnim "Execute 1"]
IfMatchMode=1
DynamicVariables=1
UpdateDivider=-1