RE: Re: !xStatsGraphShowPerformancePicker and setting evar
"Hale, Paul" <Paul.Hale-uv/[email protected]>
| Newsgroups | gmane.comp.windows.shells.litestep |
|---|---|
| Message-ID | <23DBD872E5D0B44E8296E93447E0F60705048A33@01ohday01n00005.ad.bls.com> |
> From: news [mailto:[email protected]] On Behalf Of Brian Wolven > Sent: Friday, June 22, 2007 3:18 PM > To: litestep-HzvBz7w1J3cIFlVeWT/[email protected] > Subject: [Litestep] Re: !xStatsGraphShowPerformancePicker and > setting evar > > Hale, Paul wrote: > > That being said, is there a way to write the contects of > the clipboard > > to a file on an event? If I create a button, click on it > and execute: > > !xStatsGraphShowPerformancePicker > > > > I want to it to: > > > > !xTextSaveEvar @$ConfigDir$\themevars.rc@ @ThemeVar@ > @perfmon string@ > > > > Can that be done? > > I thought there was an ls clipboard module, but can't find > anything ATM. The following script will do it, though. > Execute it as follows (assuming it's saved as updateThemeVar.vbs): > > !execute [wscript "full_path_to_updateThemeVar.vbs" > "your_theme_var_rc_file_path" evar_to_be_replaced] > > It'll give an error message if the file does not exist. If > the evar does not exist it won't do anything. > > Hopefully. > > Make backups. =) > Works like a charm! This paste the clipboard contect just as advertised. So now I am left with figuring out a way to fire this bang after the PerfMon string window is closed with an "OK". Is this the right path of thinking? : *Alias !SetMem !Execute [!xStatsGraphShowPerformancePicker /bang1: [wscript "$ConfigDir$\UpdateThemeVar.vbs" "$ConfigDir$\themevars.rc" MemString] This doesn't work, but I think it is close... > > > > Dim oFS,ArgC,oShell,oHtml > > ArgC = Wscript.Arguments.Count > > If ArgC = 2 Then > > Set oFS = WScript.CreateObject("Scripting.FileSystemObject") > Set oShell = WScript.CreateObject("WScript.Shell") > Set oHtml = WScript.CreateObject("htmlfile") > > File = Wscript.Arguments(0) > Key = oFS.GetFileName(Wscript.Arguments(1)) > ' Value = oFS.GetFileName(Wscript.Arguments(2)) > > '--- Grab contents of clipboard instead of using command line arg > > Value = oHtml.ParentWindow.ClipboardData.GetData("text") > > ReplaceLine File,Key,Value '--- function at the bottom of > this file > > Set oFS = Nothing > Set oShell = Nothing > Set oHtml = Nothing > > End If > > WScript.Quit > > '--- > > Function ReadTextFile(txtFile) > Const ForReading = 1 > Dim MyFile > > If (not oFS.FileExists(txtFile)) then > '--- If the file that we want to write to does not exist, > then pop up this > '--- msgbox with the critical icon > MsgBox txtFile & " file does not exist!" , 16 , > "updateThemeVar.vbs" > ReadTextFile = "" > WScript.Quit > Else > Set MyFile = oFS.OpenTextFile(txtFile,ForReading) > ReadTextFile = MyFile.ReadAll > MyFile.Close > Set MyFile = Nothing > End If > > End Function > > '--- > > Sub WriteTextFile(txtFile,text) > Const ForWriting = 2 > Dim fOutput > > Set fOutput = oFS.OpenTextFile(txtFile,ForWriting,True) > fOutput.Write text > fOutput.Close > Set fOutput = Nothing > > End Sub > > '--- > > Sub ReplaceLine(file,Key,value) > > filetext = ReadTextFile(file) > > With New RegExp > .Global = False > .IgnoreCase = True > .Multiline = True > .Pattern = "^[ \t]*" & key & "[ \t]+.+$" > filetext = .Replace( filetext , key & " """ & value & """" ) > End With > > WriteTextFile file,filetext > > End Sub > > > --------------------------------------------------------------------- > Can't Unsubscribe? Check http://desktopian.org/listunsub.html > LS List Homepage: http://wuzzle.org/list/litestep.php > Get the LS FAQ: http://lsfaq.shellfront.org > > > ------------------------------------------------------------------------------ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary and or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this email in error, please contact the sender and delete the material from all computers. This electronic mail message was sent from L. M. Berry & Company or Berry Network, Inc. Our primary business address is 3170 Kettering Blvd., Dayton, OH 45439. This message may constitute a commercial solicitation or advertisement as defined by the CAN-SPAM act of 2003. If you do not wish to receive future commercial electronic mail solicitations or advertisements from L. M. Berry & Company or Berry Network, Inc., please send a request to [email protected] ============================================================================== --------------------------------------------------------------------- Can't Unsubscribe? Check http://desktopian.org/listunsub.html LS List Homepage: http://wuzzle.org/list/litestep.php Get the LS FAQ: http://lsfaq.shellfront.org