It is currently September 29th, 2024, 5:25 am

Display echo from VBScript

General topics related to Rainmeter.
Bugmenot
Posts: 25
Joined: October 7th, 2016, 9:38 am

Display echo from VBScript

Post by Bugmenot »

Hi,

can you tell me how I can display the output from a .vbs file in Rainmeter?

Here is the .vbs i want to display:

Code: Select all

'==========================================================================
'
' NAME: PasswordExpares.vbs
'
' AUTHOR: Michael Blizniuk 
' DATE  : 02.04.2016
' V.1.1
'
' COMMENT: 
'	Get User Password expares date
'
'==========================================================================
ON Error Resume Next
Const SEC_IN_DAY = 86400
Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const NeverExp = "Never"
Const NoInfo = "No Info"
Const strComputer = "."
' Const Savekey = "Identities"
Const Savekey = ""


Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
    strComputer & "\root\default:StdRegProv")


Set objUser = Createobject("ADSystemInfo") 
Set CurrentUser = GetObject("LDAP://" & objUser.UserName) 
intCurrentValue = CurrentUser.userAccountControl
If intCurrentValue = 0 Then 
	oReg.GetDWORDValue HKEY_CURRENT_USER,Savekey,"DELuserAccountControl",intCurrentValue
	If intCurrentValue =0 Then 
		PasswordExpares = NoInfo
	Else
		If intCurrentValue And ADS_UF_DONT_EXPIRE_PASSWD Then
	  		PasswordExpares = NeverExp
	  	Else

			oReg.GetStringValue HKEY_CURRENT_USER,Savekey,"DELMaxPasswordAge",StrValue
			intMaxPwdAge=CDbl( StrValue)
			If intMaxPwdAge < 0 and Now > PolycyStartDate Then
		      		PasswordExpares = NeverExp
		  	Else
		  		oReg.GetStringValue HKEY_CURRENT_USER,Savekey,"DELPasswordLastChanged",StrValue
				dtmValue=cdate(StrValue)
		   		intMaxPwdAge = (intMaxPwdAge/SEC_IN_DAY)
'		    	PasswordExpares = FormatDateTime(cdate(dtmValue + intMaxPwdAge),2) & " " & Replace(FormatDateTime(dtmValue,4), "0", "",1, 1, 1)
		    	PasswordExpares = FormatDateTime(cdate(dtmValue + intMaxPwdAge),2) & " " & _
		    		Replace(left(FormatDateTime(dtmValue,4) ,1), "0", "",1, 1, 1) & _
		    	 	Right(FormatDateTime(dtmValue,4),4)

		  	End If
		 End if
	End if
Else
	oReg.SetDWORDValue HKEY_CURRENT_USER,Savekey,"DELuserAccountControl",intCurrentValue
	If intCurrentValue and ADS_UF_DONT_EXPIRE_PASSWD Then
	  PasswordExpares = NeverExp
	Else
	  dtmValue = CurrentUser.PasswordLastChanged
	  oReg.SetStringValue HKEY_CURRENT_USER,Savekey,"DELPasswordLastChanged",cSTR(dtmValue)
'	  oReg.GetStringValue HKEY_CURRENT_USER,"Volatile Environment","USERDOMAIN",Domain
  
	  Set objDomainNT = GetObject("WinNT://" & objUser.DomainShortName)
	  intMaxPwdAge = objDomainNT.Get("MaxPasswordAge")
	intMaxPwdAge = 5184000
	  oReg.SetStringValue HKEY_CURRENT_USER,Savekey,"DELMaxPasswordAge",cstr(intMaxPwdAge)
	  If intMaxPwdAge < 0  Then
	      PasswordExpares = NeverExp
	  Else
	    intMaxPwdAge = (intMaxPwdAge/SEC_IN_DAY)
	    'PasswordExpares = FormatDateTime(dtmValue + intMaxPwdAge,2) & " " & Replace(FormatDateTime(dtmValue + intMaxPwdAge,4), "0", "",1, 1, 1) 
		PasswordExpares = FormatDateTime(dtmValue + intMaxPwdAge,2) & " " & _ 
			Replace(left(FormatDateTime(dtmValue + intMaxPwdAge,4) ,1), "0", "",1, 1, 1) & _
			Right(FormatDateTime(dtmValue + intMaxPwdAge,4),4)
	  End If
	End If
End If
Echo PasswordExpares 
Bugmenot
Posts: 25
Joined: October 7th, 2016, 9:38 am

Re: Display echo from VBScript

Post by Bugmenot »

Ok, found the problem. Rainmeter can not execute the vbs script from an Network Share :-(
Bugmenot
Posts: 25
Joined: October 7th, 2016, 9:38 am

Re: Display echo from VBScript

Post by Bugmenot »

I hope someone does read this, because i could need a Tip or something.

I can execute the VBScript with Rainmeter and its working but i got an extra " in front of the output, any Ideas why and how i get rid of it?
User avatar
balala
Rainmeter Sage
Posts: 16602
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Display echo from VBScript

Post by balala »

Bugmenot wrote:I can execute the VBScript with Rainmeter and its working but i got an extra " in front of the output, any Ideas why and how i get rid of it?
I'm not very sure, but I'd say that the RunCommand plugin could help. If you don't know how to use it, please post the code you have so far.
Bugmenot
Posts: 25
Joined: October 7th, 2016, 9:38 am

Re: Display echo from VBScript

Post by Bugmenot »

I should have said that i come a bit further since my first post. Iam already using the RunCommand Plugin and its working almost fine, except the " character in front of the output.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Display echo from VBScript

Post by FreeRaider »

Out of curiosity, is it possible to have the entire skin (including images, fonts, etc.)?
Bugmenot
Posts: 25
Joined: October 7th, 2016, 9:38 am

Re: Display echo from VBScript

Post by Bugmenot »

The Skin is the default skin with this Password Ini and the vbs Script above:

Code: Select all

[Rainmeter]
Update=1000
Background=#@#Background.png
DynamicWindowSize=1
AccurateText=1
BackgroundMode=3
BackgroundMargins=0,34,0,14
; RightMouseDownAction=[!Toggle "illustro\Password"]

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=cscript //nologo #@#Scripts\passwordExpires.vbs
State=Hide
OutputType=ANSI
; RegExpSubstitute=1
; Substitute="Name.*#CRLF#":"","#CRLF#":""

[MeterRun]
UpdateDivider=-1
Meter=String
FontSize=12
FontColor=255,255,255,255
AntiAlias=1
OutputType=Unicode
Text=Password expires:
X=65
Y=12
W=190
H=18
OnUpdateAction=[!CommandMeasure MeasureRun "Run"]

[MeterResult]
Meter=String
MeasureName=MeasureRun
Y=7R
FontSize=12
FontColor=255,255,255,255
X=20
Y=12
W=190
H=18
AntiAlias=1
User avatar
balala
Rainmeter Sage
Posts: 16602
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Display echo from VBScript

Post by balala »

The code of the skin is not enough. Also post please the code of the vbs file.
Bugmenot
Posts: 25
Joined: October 7th, 2016, 9:38 am

Re: Display echo from VBScript

Post by Bugmenot »

What else do you need? When you create a new Folder with this ini File in the Skins Folder you got everything you need. Its the default Skin you get after installation. And the .vbs file is in my First Post.
User avatar
jsmorley
Developer
Posts: 22783
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Display echo from VBScript

Post by jsmorley »

People...

If you want help on a skin, nobody can help you if they don't have the entire skin you are using, so they can test solutions.

If it is a skin you downloaded from somewhere like deviantART and are using it "as is", just provide a link to the skin.

If it is a skin you have written, or that you have modified from the original, provide the ENTIRE skin and all external files like images, addons, fonts, anything else that can impact the functionality and appearance of the skin.

The best way to do this is to create a .rmskin of what you have following this guide:

https://docs.rainmeter.net/manual/publishing-skins/

Short of that you can at least .zip up the entire root config folder of the skin and everything under it.

In either case, just attach the .rmskin or .zip file to your post.

You have to help us to help you...