[SOLVED] (Perl) Help Modifying Conky Weather Script

I'm using buttons' excellent Conky weather script, but it has more information than I need. It displays both the current weather condition and the temperature:
[condition]:[temperature]F
so right now it's
Clear: 46F
All I need is for it to display the temperature, without the current condition, colon, and letter 'F' (for Fahrenheit).
the script:
METRIC=0 #Should be 0 or 1; 0 for F, 1 for C
if [ -z $1 ]; then
echo
echo "USAGE: weather.sh <locationcode>"
echo
exit 0;
fi
curl -s http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=$1 | perl -ne 'if (/Currently/) {chomp;/\<title\>Currently: (.*)?\<\/title\>/; print "$1"; }'
In Conky:
{execi 300 /home/hex/.conky/weather.sh <zip code>}
I'm not familiar with Perl yet so any help is much appreciated
Last edited by Olson (2011-02-17 07:06:10)

Try this
curl ... | perl -ne 'if (/Currently/) {chomp;/\<title\>.*: (\d*).\<\/title\>/; print "$1"; }'

Similar Messages

  • [solved]Need help with a bash script for MOC conky artwork.

    I need some help with a bash script for displaying artwork from MOC.
    Music folders have a file called 'front.jpg' in them, so I need to pull the current directory from MOCP and then display the 'front.jpg' file in conky.
    mocp -Q %file
    gives me the current file playing, but I need the directory (perhaps some way to use only everything after the last  '/'?)
    A point in the right direction would be appreciated.
    thanks, d
    Last edited by dgz (2013-08-29 21:24:28)

    Xyne wrote:
    You should also quote the variables and output in double quotes to make the code robust, e.g.
    filename="$(mocp -Q %file)"
    dirname="${filename%/*}"
    cp "$dirname"/front.jpg ~/backup/art.jpg
    Without the quotes, whitespace will break the code. Even if you don't expect whitespace in any of the paths, it's still good coding practice to include the quotes imo.
    thanks for the tip.
    here it is, anyhow:
    #!/bin/bash
    filename=$(mocp -Q %file)
    dirname=${filename%/*}
    cp ${dirname}/front.jpg ~/backup/art.jpg
    then in conky:
    $alignr${execi 30 ~/bin/artc}${image ~/backup/art.jpg -s 100x100 -p -3,60}
    thanks for the help.
    Last edited by dgz (2013-08-29 21:26:32)

  • Help for a Conky weather script

    Hi,
    I was trying to write a Conky script to display weather forecast for the current day in my Conky, using <tempmin>, <tempmax> and <descr> on this page http://www.tv5.org/TV5Site/widget/meteo … lle_id=474.
    I'm a complete newbie to bash/perl/whatever, and I couldn't manage to do much. Could anyone explain me how to proceed?
    Please don't RTFM me :(

    You need xmlstarlet to run it.
    It simply parses that xml file and extracts the info you want.
    I wanted to add newlines, so I just wrapped it all in 'echo -e $(...)' and called it a day. There's probably a better way to do it.
    Also, note that the index on 'descr' is one higher than on 'tempmin' and 'tempmax', because there's already a 'descr' earlier in the file:
    <weather>
    <data>
    <ville>Paris</ville>
    <pays>FRANCE</pays>
    <date>Observation le vendredi 22 à 13:00 (heure locale)</date>
    <temp>4°C</temp>
    <descr>couvert </descr>
    You don't want the value of this 'descr', but of the one a bit lower (the second one) -
    <descr>très nuageux </descr>
    thus '//descr[2]'.

  • SOLVED Need help with conky please.

    Hello,
    1.)  I am trying to change the size for the font just for the time in my conky  how can i do this.  I ctried to just change the size in the time part that goes ${font monospace:size=25}  but this also changes my CPU font size and it doesnt look right.
    #avoid flicker
    double_buffer yes
    #own window to run simultanious 2 or more conkys
    own_window yes
    own_window_transparent yes
    own_window_type normal
    own_window_hints undecorate,sticky,skip_taskbar,skip_pager
    #borders
    draw_borders no
    border_margin 1
    #shades
    draw_shades no
    #position
    gap_x 0
    gap_y 7
    alignment top_left
    #behaviour
    update_interval 1
    #colour
    default_color 000000
    #default_shade_color 000000
    own_window_colour 262626
    #font
    use_xft yes
    xftfont bauhaus:pixelsize=10
    #to prevent window from moving
    use_spacer none
    minimum_size 1268 0
    #mpd
    mpd_host nathan-gamer
    mpd_port 6600
    #${color} ${color e0e0e0}${upspeed eth0} Kb/s ${color} ${totalup eth0} uploaded${color}
    TEXT
    ${font monospace:size=25}${alignr 5}${color #000000}${time %H:%M} | ${voffset -1} Cpu: ${color e0e0e0}${font}${cpu}% ${color} Mem: ${color e0e0e0}${font}${mem} ${color} | ${color} Up: ${color e0e0e0}${font}${uptime_short}${color} | ${color} Net: ${color e0e0e0}${font}${downspeed eth0} Kb/s ${color} ${totaldown eth0} downloaded${color} | ${color}Root: ${color e0e0e0}${font}${fs_free /} ${color} Home: ${color e0e0e0}${font}${fs_free /home} ${color} Backup: ${color e0e0e0}${font}${fs_free /home/nathan/Backup} ${color} Mp3&Tv: ${color e0e0e0}${font}${fs_free /home/nathan/Mp3z_and_Tv} ${color} Vidz: ${color e0e0e0}${font}${fs_free /home/nathan/Vidz} ${color} | ${color} Arch-pkg: ${color e0e0e0}${font}${execi 300 perl ~/scripts/conky-updates.pl}${color} | Email: ${color e0e0e0}${execi 300 python ~/scripts/gmail.py} | ${color} Weather: ${color e0e0e0} ${execi 1800 weatherget -f ~/scripts/.conkyweatherrc --station-id=USNC0234 --standard } ${color} | ${color} Mpd: ${color e0e0e0}${font}${mpd_smart}
    Last edited by nmodlin (2009-07-05 21:18:28)

    Just use ${font) were you want your regular font to resume
    Example: ${font monospaced=12}5:15pm${font) something in the regular font

  • Ideas for a conky weather script ...

    Here are the 2 best sources for weather updates for me :
    http://www.google.ca/search?sourceid=ch … chicoutimi (google)
    or
    http://www.meteomedia.com/weather/CAQC0107 (most known weather website/tv-channel of my country)
    What would be the best grep ou curl ? Got ideas to build that script ?
    Google seem limited but I could show pictures on my desktop directly maybe,
    Meteomedia as less nice GUI for that ...

    Meskarune wrote:check out the conky forcast package in aur
    If you install the package you'll find a conkyrc/template file example in /usr/share/conkyforecast/example
    Also have a look at the conky hardcore website, it details quite a lot user setups for this script, a good example is here: http://conky.linux-hardcore.com/?page_id=2487
    Cheers

  • Help modifying a powershell script

    Hello,
    I have recently been given a task to write/find a script that is capable of performing Full and Incremental backups. I found a script that does exactly what I need, however, it requires user input. I need this to be a scheduled task and therefore I need
    the input to be a static path. Here is the script I am talking about:
    #region Params
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$true)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})] 
    [System.String]
    $SourceDir,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})] 
    [System.String]
    $DestDir,
    [Parameter(Position=2, Mandatory=$false,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})] 
    [System.String]
    $HashPath,
    [Parameter(Position=3, Mandatory=$false,ValueFromPipeline=$false)]
    [ValidateSet("Full","Incremental","Differential")] 
    [System.String]
    $BackupType="Full",
    [Parameter(Position=4, Mandatory=$false,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()]  
    [System.String]
    $LogFile=".\Backup-Files.log",
    [Parameter(Position=5, Mandatory=$false,ValueFromPipeline=$false)]
    [System.Management.Automation.SwitchParameter]
    $SwitchToFull
    #endregion 
    begin{
    function Write-Log
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$true)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $Message,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$true)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $LogFile
    #endregion
    try{
    Write-Host $Message
    Out-File -InputObject $Message -Append $LogFile
    catch {throw $_}
    function Get-Hash 
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$true)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $HashTarget,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateSet("File","String")]
    [System.String]
    $HashType
    #endregion
    begin{
    try{ $objGetHashMD5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider } 
    catch {throw $_ }
    process{
    try {
    #Checking hash target is file or just string
    switch($HashType){
    "String" {
    $objGetHashUtf8 = New-Object -TypeName System.Text.UTF8Encoding
    $arrayGetHashHash = $objGetHashMD5.ComputeHash($objGetHashUtf8.GetBytes($HashTarget.ToUpper()))
    break
    "File" {
    $arrayGetHashHash = $objGetHashMD5.ComputeHash([System.IO.File]::ReadAllBytes($HashTarget))
    break
    #Return hash
    Write-Output $([System.Convert]::ToBase64String($arrayGetHashHash))
    catch { throw $_ }
    function Copy-File
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Any'})] 
    [System.String]
    $SourceFile,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()] 
    [System.String]
    $DestFile
    #endregion
    try{
    #The script fails when folder being copied to file. So the item will be removed to avoid the error.
    if(Test-Path -LiteralPath $DestFile -PathType Any){
    Remove-Item -LiteralPath $DestFile -Force -Recurse
    #Creating destination if doesn't exist. It's required because Copy-Item doesn't create destination folder
    if(Test-Path -LiteralPath $SourceFile -PathType Leaf){
    New-Item -ItemType "File" -Path $DestFile -Force
    #Copying file to destination directory
    Copy-Item -LiteralPath $SourceFile -Destination $DestFile -Force
    catch{ throw $_ }
    function Backup-Files
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})] 
    [System.String]
    $SourceDir,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()] 
    [System.String]
    $DestDir,
    [Parameter(Position=2, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNull()] 
    [System.Collections.Hashtable]
    $HashTable
    #endregion
    try{
    $xmlBackupFilesHashFile = $HashTable
    Write-Host "Backup started" 
    Get-ChildItem -Recurse -Path $SourceDir|ForEach-Object{
    $currentBackupFilesItem = $_
    #Full path to source and destination item
    $strBackupFilesSourceFullPath = $currentBackupFilesItem.FullName
    $strBackupFilesDestFullPath = $currentBackupFilesItem.FullName.Replace($SourceDir,$DestDir)
    #Checking that the current item is file and not directory. True - the item is file. 
    $bBackupFilesFile = $($($currentBackupFilesItem.Attributes -band [System.IO.FileAttributes]::Directory) -ne [System.IO.FileAttributes]::Directory)
    Write-Host -NoNewline ">>>Processing item $strBackupFilesSourceFullPath..."
    #Generating path hash
    $hashBackupFilesPath = $(Get-Hash -HashTarget $strBackupFilesSourceFullPath -HashType "String")
    $hashBackupFilesFile = "d"
    #If the item is file then generate hash for file content
    if($bBackupFilesFile){
    $hashBackupFilesFile = $(Get-Hash -HashTarget $strBackupFilesSourceFullPath -HashType "File")
    #Checking that the file has been copied
    if($xmlBackupFilesHashFile[$hashBackupFilesPath] -ne $hashBackupFilesFile){
    Write-Host -NoNewline $("hash changed=>$hashBackupFilesFile...")
    Copy-File -SourceFile $strBackupFilesSourceFullPath $strBackupFilesDestFullPath|Out-Null
    #Returning result
    Write-Output @{$hashBackupFilesPath=$hashBackupFilesFile}
    else{
    Write-Host -NoNewline "not changed..."
    Write-Host "done"
    Write-Host "Backup completed"
    catch { throw $_ }
    function Backup-Full
    [CmdletBinding()]
    [OutputType([System.String])]
    #region Params
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})] 
    [System.String]
    $SourceDir,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()] 
    [System.String]
    $DestDir,
    [Parameter(Position=2, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()] 
    [System.String]
    $HashFile,
    [Parameter(Position=3, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()]  
    [System.String]
    $ChainKey
    #endregion
    try{
    #Creating an empty hash table
    $xmlBackupFullHashFile = @{}
    #Starting directory lookup 
    $uintBackupFullCount = 0
    Backup-Files -SourceDir $SourceDir -DestDir $("$DestDir\$ChainKey\Full_" + $(Get-Date -Format "ddMMyyyy")) -HashTable $xmlBackupFullHashFile|`
    ForEach-Object{ 
    $xmlBackupFullHashFile.Add([string]$_.Keys,[string]$_.Values) 
    $uintBackupFullCount++
    #Saving chain key.
    $xmlBackupFullHashFile.Add("ChainKey",$ChainKey)
    Write-Host -NoNewline "Saving XML file to $HashFile..."
    Export-Clixml -Path $HashFile -InputObject $xmlBackupFullHashFile -Force
    Write-Host "done"
    Write-Output $uintBackupFullCount
    catch { throw $_ }
    function Backup-Diff
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})] 
    [System.String]
    $SourceDir,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()] 
    [System.String]
    $DestDir,
    [Parameter(Position=2, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'leaf'})]
    [System.String]
    $HashFile
    #endregion
    try{
    #Loading hash table
    $xmlBackupDiffHashFile = Import-Clixml $HashFile
    $chainKeyBackupDiffDifferential = $xmlBackupDiffHashFile["ChainKey"]
    $uintBackupDiffCount = 0
    #Starting directory lookup 
    Backup-Files -SourceDir $SourceDir -DestDir $("$DestDir\$chainKeyBackupDiffDifferential\Differential_" + $(Get-Date -Format "ddMMyyyy.HHmm")) -HashTable $xmlBackupDiffHashFile|`
    ForEach-Object{ $uintBackupDiffCount++ }
    Write-Output $uintBackupDiffCount
    catch { throw $_ }
    function Backup-Inc
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})] 
    [System.String]
    $SourceDir,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()] 
    [System.String]
    $DestDir,
    [Parameter(Position=2, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'leaf'})]
    [System.String]
    $HashFile
    #endregion
    try{
    #Loading hash table
    $xmlBackupIncHashFile = Import-Clixml $HashFile
    $chainKeyBackupIncIncremental = $xmlBackupIncHashFile["ChainKey"]
    $uintBackupIncCount = 0
    #Starting directory lookup 
    Backup-Files -SourceDir $SourceDir -DestDir $("$DestDir\$chainKeyBackupIncIncremental\Incremental_" + $(Get-Date -Format "ddMMyyyy.HHmm")) -HashTable $xmlBackupIncHashFile|`
    ForEach-Object{ 
    $xmlBackupIncHashFile[[string]$_.Keys]=[string]$_.Values
    $uintBackupIncCount++
    Write-Host -NoNewline "Saving XML file to $HashFile..."
    Export-Clixml -Path $HashFile -InputObject $xmlBackupIncHashFile -Force
    Write-Host "Done"
    Write-Output $uintBackupIncCount
    catch { throw $_ }
    #0 - is OK. 1 - some error
    $exitValue=0
    process{
    try{
    $filesCopied=0
    $strSourceFolderName = $(Get-Item $SourceDir).Name
    $strHasFile = $("$HashPath\Hash_$strSourceFolderName.xml")
    $strMessage = $($(Get-Date -Format "HH:mm_dd.MM.yyyy;") + "$BackupType backup of $SourceDir started")
    #Automatically switch to full backup
    $bSwitch = $(!$(Test-Path -LiteralPath $strHasFile -PathType "Leaf") -and $SwitchToFull)
    Write-Log -Message $strMessage -LogFile $LogFile
    switch($true){
    $($BackupType -eq "Full" -or $bSwitch) {
    $filesCopied = Backup-Full -SourceDir $SourceDir -DestDir $DestDir -HashFile $strHasFile -ChainKey $("Backup_$strSourceFolderName" + "_" + $(Get-Date -Format "ddMMyyyy"))
    break
    $($BackupType -eq "Incremental") {
    $filesCopied = Backup-Inc -SourceDir $SourceDir -DestDir $DestDir -HashFile $strHasFile 
    break
    $($BackupType -eq "Differential") {
    $filesCopied = Backup-Diff -SourceDir $SourceDir -DestDir $DestDir -HashFile $strHasFile 
    break
    $strMessage = $($(Get-Date -Format "HH:mm_dd.MM.yyyy;") + "$BackupType backup of $SourceDir completed successfully. $filesCopied items were copied.")
    Write-Log -Message $strMessage -LogFile $LogFile
    Write-Output $filesCopied
    catch { 
    $strMessage = $($(Get-Date -Format "HH:mm_dd.MM.yyyy;") + "$BackupType backup of $SourceDir failed:" + $_)
    Write-Log -Message $strMessage -LogFile $LogFile
    $exitValue = 1
    end{exit $exitValue}
    I have some experience writing Powershell scripts,but I am lost at how this script prompts for Source and Destination paths. I tried modifying the Param section, but this didnt work and up until now I thought the only way you could get a prompt was with
    "read-host". Any and all education on this matter would be greatly appreciated. (Side note: I have posted this question  on the forum in which I found it and have not got an answer yet).
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$true)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})]
    [System.String]
    $SourceDir,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})]
    [System.String]
    $DestDir,
    [Parameter(Position=2, Mandatory=$false,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})]
    [System.String]
    $HashPath,
    [Parameter(Position=3, Mandatory=$false,ValueFromPipeline=$false)]
    [ValidateSet("Full","Incremental","Differential")]
    [System.String]
    $BackupType="Full",
    [Parameter(Position=4, Mandatory=$false,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $LogFile=".\Backup-Files.log",
    [Parameter(Position=5, Mandatory=$false,ValueFromPipeline=$false)]
    [System.Management.Automation.SwitchParameter]
    $SwitchToFull
    #endregion
    begin{
    function Write-Log
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$true)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $Message,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$true)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $LogFile
    #endregion
    try{
    Write-Host $Message
    Out-File -InputObject $Message -Append $LogFile
    catch {throw $_}
    function Get-Hash
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$true)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $HashTarget,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateSet("File","String")]
    [System.String]
    $HashType
    #endregion
    begin{
    try{ $objGetHashMD5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
    catch {throw $_ }
    process{
    try {
    #Checking hash target is file or just string
    switch($HashType){
    "String" {
    $objGetHashUtf8 = New-Object -TypeName System.Text.UTF8Encoding
    $arrayGetHashHash = $objGetHashMD5.ComputeHash($objGetHashUtf8.GetBytes($HashTarget.ToUpper()))
    break
    "File" {
    $arrayGetHashHash = $objGetHashMD5.ComputeHash([System.IO.File]::ReadAllBytes($HashTarget))
    break
    #Return hash
    Write-Output $([System.Convert]::ToBase64String($arrayGetHashHash))
    catch { throw $_ }
    function Copy-File
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Any'})]
    [System.String]
    $SourceFile,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $DestFile
    #endregion
    try{
    #The script fails when folder being copied to file. So the item will be removed to avoid the error.
    if(Test-Path -LiteralPath $DestFile -PathType Any){
    Remove-Item -LiteralPath $DestFile -Force -Recurse
    #Creating destination if doesn't exist. It's required because Copy-Item doesn't create destination folder
    if(Test-Path -LiteralPath $SourceFile -PathType Leaf){
    New-Item -ItemType "File" -Path $DestFile -Force
    #Copying file to destination directory
    Copy-Item -LiteralPath $SourceFile -Destination $DestFile -Force
    catch{ throw $_ }
    function Backup-Files
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})]
    [System.String]
    $SourceDir,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $DestDir,
    [Parameter(Position=2, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNull()]
    [System.Collections.Hashtable]
    $HashTable
    #endregion
    try{
    $xmlBackupFilesHashFile = $HashTable
    Write-Host "Backup started"
    Get-ChildItem -Recurse -Path $SourceDir|ForEach-Object{
    $currentBackupFilesItem = $_
    #Full path to source and destination item
    $strBackupFilesSourceFullPath = $currentBackupFilesItem.FullName
    $strBackupFilesDestFullPath = $currentBackupFilesItem.FullName.Replace($SourceDir,$DestDir)
    #Checking that the current item is file and not directory. True - the item is file.
    $bBackupFilesFile = $($($currentBackupFilesItem.Attributes -band [System.IO.FileAttributes]::Directory) -ne [System.IO.FileAttributes]::Directory)
    Write-Host -NoNewline ">>>Processing item $strBackupFilesSourceFullPath..."
    #Generating path hash
    $hashBackupFilesPath = $(Get-Hash -HashTarget $strBackupFilesSourceFullPath -HashType "String")
    $hashBackupFilesFile = "d"
    #If the item is file then generate hash for file content
    if($bBackupFilesFile){
    $hashBackupFilesFile = $(Get-Hash -HashTarget $strBackupFilesSourceFullPath -HashType "File")
    #Checking that the file has been copied
    if($xmlBackupFilesHashFile[$hashBackupFilesPath] -ne $hashBackupFilesFile){
    Write-Host -NoNewline $("hash changed=>$hashBackupFilesFile...")
    Copy-File -SourceFile $strBackupFilesSourceFullPath $strBackupFilesDestFullPath|Out-Null
    #Returning result
    Write-Output @{$hashBackupFilesPath=$hashBackupFilesFile}
    else{
    Write-Host -NoNewline "not changed..."
    Write-Host "done"
    Write-Host "Backup completed"
    catch { throw $_ }
    function Backup-Full
    [CmdletBinding()]
    [OutputType([System.String])]
    #region Params
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})]
    [System.String]
    $SourceDir,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $DestDir,
    [Parameter(Position=2, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $HashFile,
    [Parameter(Position=3, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $ChainKey
    #endregion
    try{
    #Creating an empty hash table
    $xmlBackupFullHashFile = @{}
    #Starting directory lookup
    $uintBackupFullCount = 0
    Backup-Files -SourceDir $SourceDir -DestDir $("$DestDir\$ChainKey\Full_" + $(Get-Date -Format "ddMMyyyy")) -HashTable $xmlBackupFullHashFile|`
    ForEach-Object{
    $xmlBackupFullHashFile.Add([string]$_.Keys,[string]$_.Values)
    $uintBackupFullCount++
    #Saving chain key.
    $xmlBackupFullHashFile.Add("ChainKey",$ChainKey)
    Write-Host -NoNewline "Saving XML file to $HashFile..."
    Export-Clixml -Path $HashFile -InputObject $xmlBackupFullHashFile -Force
    Write-Host "done"
    Write-Output $uintBackupFullCount
    catch { throw $_ }
    function Backup-Diff
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})]
    [System.String]
    $SourceDir,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $DestDir,
    [Parameter(Position=2, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'leaf'})]
    [System.String]
    $HashFile
    #endregion
    try{
    #Loading hash table
    $xmlBackupDiffHashFile = Import-Clixml $HashFile
    $chainKeyBackupDiffDifferential = $xmlBackupDiffHashFile["ChainKey"]
    $uintBackupDiffCount = 0
    #Starting directory lookup
    Backup-Files -SourceDir $SourceDir -DestDir $("$DestDir\$chainKeyBackupDiffDifferential\Differential_" + $(Get-Date -Format "ddMMyyyy.HHmm")) -HashTable $xmlBackupDiffHashFile|`
    ForEach-Object{ $uintBackupDiffCount++ }
    Write-Output $uintBackupDiffCount
    catch { throw $_ }
    function Backup-Inc
    #region Params
    [CmdletBinding()]
    [OutputType([System.String])]
    param(
    [Parameter(Position=0, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'Container'})]
    [System.String]
    $SourceDir,
    [Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $DestDir,
    [Parameter(Position=2, Mandatory=$true,ValueFromPipeline=$false)]
    [ValidateScript({Test-Path -LiteralPath $_ -PathType 'leaf'})]
    [System.String]
    $HashFile
    #endregion
    try{
    #Loading hash table
    $xmlBackupIncHashFile = Import-Clixml $HashFile
    $chainKeyBackupIncIncremental = $xmlBackupIncHashFile["ChainKey"]
    $uintBackupIncCount = 0
    #Starting directory lookup
    Backup-Files -SourceDir $SourceDir -DestDir $("$DestDir\$chainKeyBackupIncIncremental\Incremental_" + $(Get-Date -Format "ddMMyyyy.HHmm")) -HashTable $xmlBackupIncHashFile|`
    ForEach-Object{
    $xmlBackupIncHashFile[[string]$_.Keys]=[string]$_.Values
    $uintBackupIncCount++
    Write-Host -NoNewline "Saving XML file to $HashFile..."
    Export-Clixml -Path $HashFile -InputObject $xmlBackupIncHashFile -Force
    Write-Host "Done"
    Write-Output $uintBackupIncCount
    catch { throw $_ }
    #0 - is OK. 1 - some error
    $exitValue=0
    process{
    try{
    $filesCopied=0
    $strSourceFolderName = $(Get-Item $SourceDir).Name
    $strHasFile = $("$HashPath\Hash_$strSourceFolderName.xml")
    $strMessage = $($(Get-Date -Format "HH:mm_dd.MM.yyyy;") + "$BackupType backup of $SourceDir started")
    #Automatically switch to full backup
    $bSwitch = $(!$(Test-Path -LiteralPath $strHasFile -PathType "Leaf") -and $SwitchToFull)
    Write-Log -Message $strMessage -LogFile $LogFile
    switch($true){
    $($BackupType -eq "Full" -or $bSwitch) {
    $filesCopied = Backup-Full -SourceDir $SourceDir -DestDir $DestDir -HashFile $strHasFile -ChainKey $("Backup_$strSourceFolderName" + "_" + $(Get-Date -Format "ddMMyyyy"))
    break
    $($BackupType -eq "Incremental") {
    $filesCopied = Backup-Inc -SourceDir $SourceDir -DestDir $DestDir -HashFile $strHasFile
    break
    $($BackupType -eq "Differential") {
    $filesCopied = Backup-Diff -SourceDir $SourceDir -DestDir $DestDir -HashFile $strHasFile
    break
    $strMessage = $($(Get-Date -Format "HH:mm_dd.MM.yyyy;") + "$BackupType backup of $SourceDir completed successfully. $filesCopied items were copied.")
    Write-Log -Message $strMessage -LogFile $LogFile
    Write-Output $filesCopied
    catch {
    $strMessage = $($(Get-Date -Format "HH:mm_dd.MM.yyyy;") + "$BackupType backup of $SourceDir failed:" + $_)
    Write-Log -Message $strMessage -LogFile $LogFile
    $exitValue = 1
    end{exit $exitValue}

    Hi Ryan Blaeholder,
    Thanks for your posting.
    To schedule a powershell script with input value, instead of modifying the script above, you can also try to add the input during creating a scheduled task like this:(save the script above as D:\backup.ps1)
    -command "& 'D:\backup.ps1' 'input1' 'input2'"
    For more detailed information, please refer to this article to complete:
    Schedule PowerShell Scripts that Require Input Values:
    http://blogs.technet.com/b/heyscriptingguy/archive/2011/01/12/schedule-powershell-scripts-that-require-input-values.aspx
    I hope this helps.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • [SOLVED] Need help with simple a script.

    Hello, Iam searching for a small script that sorts my folders in alphabetical order.
    I want the script to create folder from A to Z and then move every folder that begins with A into the A folder etc etc..
    I really hope anyone understands what im searching for here.
    Last edited by nikihr (2009-09-01 20:25:33)

    scragar wrote:
    brisbin33 wrote:
    be careful, mv $I* will pick up your freshly created directory too;
    i'd `mkdir ./sorted/$I` instead, then `mv ./sorted/* ./ && rm -r ./sorted` at the end.
    you could also use
    find ./ -maxdepth 1 -iname "$I*" -exec mv {} ./sorted/ \;
    to do the actual move*
    *note: untested .
    While my `mv` code will throw an error the error will not stop the moving of the files, you'll just get 26 messages about being unable to move the directory to itself. I could probably find a way to avoid this that doesn't require the use of find(which I personally dislike) or a second dir, probably just using a file prefix like "_" or something. It would only be a small edit:
    #!/bin/bash
    for I in {a..z}; do
    echo "Moving $I";
    mkdir "_$I";
    echo "mv $I* \"$(echo $I | tr [:lower:] [:upper:])\"* _$I/";
    # mv $I* "$(echo $I | tr [:lower:] [:upper:])"* "_$I/";
    mv "_$I" $I
    done
    well, i have to politely disagree:  one, invoking find once is much better IMHO than mv with tr in a subshell.  and two, my ./sorted/ idea adds one additional mv command and one additional rm command where you're _$I suggestion added 26 additional mv commands....  just sayin'
    but we could also paint the bikeshed blue. .
    anyways, i think the OP's got more than he bargained for, hopefully we'll see a [SOLVED] on this one soon.

  • [solved] "what's my linux doing?" conky-bar + script?

    Hi!
    I'm searching for and/or am trying to figure out a conky config + script that lets me "sort of see what my pc is doing atm", just a little peek, something that "helps guess" and "blends in". Couldn't find anything that lets me see some random details like that, so I did this for now:
    stuff.bash:
    #!/bin/bash
    touch stuff.1 stuff.2
    ps -A -o "cmd" > stuff.x
    #pstree -U > stuff.x
    if [ "$(diff -q stuff.x stuff.1)" = "" ]; then
    cat stuff.diff
    else
    mv -b stuff.1 stuff.2
    mv -b stuff.x stuff.1
    diff --suppress-common-lines -d stuff.1 stuff.2 | grep \< | tr '\n' ' ' | sed "s/^[0-9a-f ]*//" > stuff.diff
    cat stuff.diff
    fi
    which I'm using in that conky bar:
    own_window yes
    own_window_type dock
    own_window_title conky
    own_window_colour 555577
    background yes
    double_buffer true
    use_xft yes
    xftfont DejaVu Sans Mono:style=Bold:size=12
    alignment top_middle
    border_width 0
    gap_x 0
    gap_y 0
    minimum_size 1950 20
    maximum_width 1950 20
    use_spacer left
    color0 aa8888
    color1 white
    color2 grey
    draw_borders no
    draw_outline no
    draw_shades no
    short_units yes
    top_name_width 8
    pad_percents 2
    cpu_avg_samples 12
    net_avg_samples 12
    update_interval 1
    TEXT
    ${color0}${font impact}CPU:${font} ${color1}${cpu cpu1}% / ${cpu cpu2}% \
    ${color2}(${TOP name 1} | ${TOP name 2} | ${TOP name 3}) \
    ${color0}${font impact}MEM:${font} ${color1}${memperc}% \
    ${color2}(${TOP_mem name 1} | ${TOP_mem name 2} | ${TOP_mem name 3}) \
    ${color0}${font impact}DO:${font} ${color1}${downspeed wlan0} ${color0}${font impact}UP:${font} ${color1}${upspeed wlan0} \
    ${color0}${font impact}LAST: ${color2}${font} ${scroll 92 3 ${exec "~/stuff.bash"}}\
    ${alignr}\
    ${color1}${time %A, %Y-%m-%d - %H:%M:%S Uhr}\
    So... that gives me a sort of nice conky bar with some random "what's being done" - now p.e. It tells me that yaourt is calling wget and pacman... and cmake has been started... and for some reason firefox is calling itsself... and some strange python script in /tmp/... with my home directory written behind it as parameters... mmmh... well.... maybe I should check on that later, so back to the topic - what I'm sort of missing is more or less...:
    (edit: [solved] / -I would rather have done something like this with lsof, but I didn't manage to get rid of some of the constantly changing columns of lsof output - those lead to way too many reoccurring info's and doesn't give me the feeling of "a little peek behind the curtains" like it's supposed to be )
    - There must be an overall better ways to do something like that, right? Any ideas for a smart little script that gets a few lines of "chaotic random backgrund info" with a good: "ooooh, I seeee"-ratio and not too much spam?
    (edit: [solved] - "network stuff"! I can't see enough network stuff!!! So if anyone knows an easy (easy as in "call-it-once-per-5-seconds-with-concy"-easy) to show what processes are meddling around on the network most atm, that would be great... maybe I'll try netstat again for just that... )
    - Also the whole rest of that config & script are far from perfect...
    So: Any hints & stuff? Thanks!
    Last edited by whoops (2009-07-19 11:12:24)

    Ooooh, that explains it.
    Thanks, but I'm looking for (see example) a single line or something for a conky bar and something a lot less "systematic"... hard to explain... something to "see stuff fly by"... the "strange small line where I can recognize stuff from time to time"... like at the moment it's telling me "kjournal2d  < n/usr/libhistory < bla bla bla < www.archlinux.org < ninotify < npipe < npipe < /bin/bash ./stuff.bash < /dev/input event....." and its going on an on and on which does not make thaaat much sense for but I like seeing it...
    That's my "best one" so far:
    stuff.bash:
    #!/bin/bash
    touch stuff.1 stuff.2
    ps -A -o "cmd" > stuff.x
    lsof -F cn | grep -v -E "p[0-9][0-9]|proc|stuff|lsof|grep|conky| sed " | sed "s/^.//g" >> stuff.x
    diff -BEbw --suppress-common-lines stuff.x stuff.1 | grep \< | tr '\n' ' ' | sed "s/^[0-9a-f ]*\|IPv4//g" | sed "s/ */ /g" > stuff.diffx
    if [ "$(diff stuff.diffx stuff.diff | grep \<)" = "" ]; then
    cat stuff.diff
    else
    mv -b stuff.1 stuff.2
    mv -b stuff.x stuff.1
    mv -b stuff.diffx stuff.diff
    cat stuff.diff
    fi
    ... just I think it might suck a little too much CPU... and I didn't manage to filter out all the stuff this script generates itself without loosing too many unrelated info... and some stuff that keeps showing up every few seconds. Somehow I'd like it mostly to show "stuff that doesn't happen all the time".
    Last edited by whoops (2009-07-19 11:09:23)

  • Help to modify MultiCurrencyTrans.LGL script

    We are working on this budgeting scenario:
    For the input schedules, SKUs are budgeted per Entities. Budgeted sales price per SKU could be in any currency (currencies are chosen by the end user based on agreement with the sales department). Sample data are the following:
    ENTITY 1
    SKU 1
    USD (or any currency chosen by the end user)
    ENTITY 1
    SKU 2
    JPY (or any currency chosen by the end user)
    ENTITY 2
    SKU 1
    EURO (or any currency chosen by the end user)
    ENTITY 2
    SKU 2
    SGD (or any currency chosen by the end user)
    Report output should have the budgeted original currencies per SKU per Entity as well as translated currencies into EURO.
    In the SAP BPC MultiCurrencyTrans.LGL script, the currency translation works for a single LC to multiple currencies. However, in the scenario above, it works the other way around, i.e. data are in “multiple LCs” (i.e. sales price) to be translated to a single currency (i.e. EURO).
    Can you help me in modifying the LGL script to meet the requirement described above?

    One other thought that's a blend of the two above and would probably do what you're looking for is:
    1.  I would do this as a separate application from any financial reporting applications you my have and push the LC over if needed for reporting.
    2. Keep the currency translation dimension on the entity dimension with the correct currency property to identify what it's LC currency is.
    3. Create the application with a standalone currency dimension (not used in other apps) that has all the members from the InputCurrency dimension in your rate application + add in LC.
    4. Have users select the specifc currency that they're entering to (never LC).  So they'd pick Entity1, SKU1, JPY as an input point.
    5. Write a custom FXTrans process that converts from the input currency to LC based on the entity.  I'd run this as part of default logic.
    6.  Use the standard FXTrans process then to convert from LC into your reporting currency of EURO.  If this is the only reporting currency then the single currency FXTrans would work.  You'd want to make sure the code ONLY goes from LC to EURO.
    So, users would enter JPY which would translate back to the LC of the entity and write the value to LC.  Then you'd translate from LC to EURO for reporting.  In cases where the  data entry is done in EURO, you'd go from EURO > LC > EURO but that shouldn't matter as long as you don't make any changes to the translation rates between the two processes.  HOWEVER, you need to be certain that if you change translation rates after data entry has occured that the process to go from input currency to LC is run so the LC values are correctly calculated or you would get different results when going to your reporting currency.

  • Help (again) with Average Script

    Hi Everyone:
    I have problems again with a script in calculation manager:
    I need to calculate the average of a member in one account across the year. For example, for Jan the average of Count_1 is equal to the value of Count_2 in Jan; for Feb Count_1 is equal to the sum of values of Jan and Feb from Count_2 divided for 2; for Mar Count_1 is equal to the sum of values of Jan, Feb and Mar from Count_2 divided for 3 and so on.
    I'm using the follow script:
    *"Count_1"=@AVGRANGE(SKIPNONE,"Count_2",@CURRMBRRANGE("YearTotal",LEV,0, ,0));*
    But this script is averaging bad, because what it does for January is to take the January value and divide by two, to sum the values in February January and February and divide by 3, to sum the values in March, January, February and March and divided by 4 and so on.
    How i can solve this problem and make a script that works?
    Thanks for your help again.

    Please, someone can help me???

  • How to modify the standard script in scripts?

    how to modify the standard script in scripts?

    Nagaraju,
    Standard scripts cant be modified.
    Only thing is you need to copy it to z-form and have to do modifications as per ur requirements.
    Here is the procedure to copy standard form to z-form.
    goto SE71 t-code, then select the menu path : <b>Utilities -> Copy from Client</b>
    then it will take to another screen, give the form name as Standard form name, if u r copying a stadard invoice means, type RVINVOICE01 and target form, ZRVINVOICE01. Now press execute button, it will copy the form into 25 languages. Now come back to se71, enter Z-form name and do the required changes.
    Hope this hint may help you, Pls close the thread if u met with correct answer.
    Regards,
    Sujatha.

  • Can anyone help me write a script that would click "get info" and then "enter" on each movie in my itunes library? I am asking because my itunes 11 repeatedly loses the artwork to my movies in my itunes library.

    Can anyone help me write a script that would click "get info" and then "enter" on each movie in my itunes library? I am asking because my itunes 11 repeatedly loses the artwork to my movies in my itunes library. I can restore the artwork (and make my apple tv see the movie exists as well) by going into the movie library and clicking on each movie by hand, slecting get info, and then selecting enter. Now doing this 10 times in 20 days was fun and all BUT I would really like to automate the process so everytime itunes screws it up I can fix it easier.
    I saw this example of an itunes script that restores artwork for music
    tell application "iTunes" set theSelection to selection repeat with i from 1 to count of theSelection tell (item i of theSelection) set artworkCount to count of artwork repeat artworkCount times set theArtwork to data of artwork 1 delete artwork 1 set data of artwork artworkCount to theArtwork end repeat end tell end repeat end tell
    but I need to tweak this to fit my needs for simply clicking the "get info" button and "enter" in the movie library rather than all the stuff this guy has listed. Any ideas or help on writing this? Thanks.

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • Help with first Adobe Script for AE?

    Hey,
    I'm trying to create a script that will allow me to set a certain number of layer markers at an even interval to mark out a song. Could someone help me troubleshoot this script? I've been working on it for ages now, and I'm about to snap. I've basically gone from HTML and CSS, to javascript and Adobe scripting in the past few hours, and I cannot figure this out for the life of me.
    I want to create a dialog with two fields, the number of markers to place, and the tempo of the song. Tempo is pretty simple, its just the number of beats per minute. The script is meant to start at a marker that I have already placed, and set a new marker at incrementing times. Its mainly to help me see what I'm trying to animate too, even if the beat is a little hard to pick up every once in a while.
    Also, is there a better way to do this? This script will help me in the long run because I will need to do this pretty often, but I'm wondering if there was something that I could not find online that would have saved me these hours of brain-jumbling?
    Thank you very much for any help you can offer.
        // Neo_Add_MultiMarkers.jsx
        //jasondrey13
        //2009-10-26
        //Adds multiple markers to the selected layer.
        // This script prompts for a certain number of layer markers to add to the selected audio layer,
        //and an optional "frames between" to set the number of frames that should be skipped before placing the next marker
        // It presents a UI with two text entry areas: a Markers box for the
        // number of markers to add and a Frames Between box for the number of frames to space between added markers.
        // When the user clicks the Add Markers button,
        // A button labeled "?" provides a brief explanation.
        function Neo_Add_MultiMarkers(thisObj)
            // set vars
            var scriptName = "Neoarx: Add Multiple Markers";
            var numberOfMarkers = "0";
            var tempo = "0";
            // This function is called when the Find All button is clicked.
            // It changes which layers are selected by deselecting layers that are not text layers
            // or do not contain the Find Text string. Only text layers containing the Find Text string
            // will remain selected.
            function onAddMarkers()
                // Start an undo group.  By using this with an endUndoGroup(), you
                // allow users to undo the whole script with one undo operation.
                app.beginUndoGroup("Add Multiple Markers");
                // Get the active composition.
                var activeItem = app.project.activeItem;
                if (activeItem != null && (activeItem instanceof CompItem)){
                    // Check each selected layer in the active composition.
                    var activeComp = activeItem;
                    var layers = activeComp.selectedLayers;
                    var markers = layers.property("marker");
                    //parse ints
                    numberOfMarkers = parseInt (numberOfMarkers);
                    tempo = parseInt (tempo);
                    // Show a message and return if there is no value specified in the Markers box.
                    if (numberOfMarkers < 1 || tempo < 1) {
                    alert("Each box can take only positive values over 1. The selection was not changed.", scriptName);
                    return;
                    if (markers.numKeys < 1)
                    alert('Please set a marker where you would like me to begin.');
                    return;
                    var beginTime = markers.keyTime( 1 );
                    var count = 1;
                    var currentTime = beginTime;
                    var addPer = tempo/60;
                    while(numberOfMarkers < count)
                    markers.setValueAtTime(currentTime, MarkerValue(count));
                    currentTime = currentTime + addPer;
                    if (count==numberOfMarkers) {
                        alert('finished!');
                        return;
                    else{
                        count++;
                app.endUndoGroup();
        // Called when the Markers Text string is edited
            function onMarkersStringChanged()
                numberOfMarkers = this.text;
            // Called when the Frames Text string is edited
            function onFramesStringChanged()
                tempo = this.text;
            // Called when the "?" button is clicked
            function onShowHelp()
                alert(scriptName + ":\n" +
                "This script displays a palette with controls for adding a given number of markers starting at a pre-placed marker, each separated by an amount of time determined from the inputted Beats Per Minute (Tempo).\n" +
                "It is designed to mark out the even beat of a song for easier editing.\n" +
                "\n" +
                "Type the number of Markers you would like to add to the currently selected layer. Type the tempo of your song (beats per minute).\n" +           
                "\n" +
                "Note: This version of the script requires After Effects CS3 or later. It can be used as a dockable panel by placing the script in a ScriptUI Panels subfolder of the Scripts folder, and then choosing this script from the Window menu.\n", scriptName);
            // main:
            if (parseFloat(app.version) < 8)
                alert("This script requires After Effects CS3 or later.", scriptName);
                return;
            else
                // Create and show a floating palette
                var my_palette = (thisObj instanceof Panel) ? thisObj : new Window("palette", scriptName, undefined, {resizeable:true});
                if (my_palette != null)
                    var res =
                    "group { \
                        orientation:'column', alignment:['fill','fill'], alignChildren:['left','top'], spacing:5, margins:[0,0,0,0], \
                        markersRow: Group { \
                            alignment:['fill','top'], \
                            markersStr: StaticText { text:'Markers:', alignment:['left','center'] }, \
                            markersEditText: EditText { text:'0', characters:10, alignment:['fill','center'] }, \
                        FramesRow: Group { \
                            alignment:['fill','top'], \
                            FramesStr: StaticText { text:'Tempo:', alignment:['left','center'] }, \
                            FramesEditText: EditText { text:'140', characters:10, alignment:['fill','center'] }, \
                        cmds: Group { \
                            alignment:['fill','top'], \
                            addMarkersButton: Button { text:'Add Markers', alignment:['fill','center'] }, \
                            helpButton: Button { text:'?', alignment:['right','center'], preferredSize:[25,20] }, \
                    my_palette.margins = [10,10,10,10];
                    my_palette.grp = my_palette.add(res);
                    // Workaround to ensure the editext text color is black, even at darker UI brightness levels
                    var winGfx = my_palette.graphics;
                    var darkColorBrush = winGfx.newPen(winGfx.BrushType.SOLID_COLOR, [0,0,0], 1);
                    my_palette.grp.markersRow.markersEditText.graphics.foregroundColor = darkColorBrush;
                    my_palette.grp.FramesRow.FramesEditText.graphics.foregroundColor = darkColorBrush;
                    my_palette.grp.markersRow.markersStr.preferredSize.width = my_palette.grp.FramesRow.FramesStr.preferredSize.width;
                    my_palette.grp.markersRow.markersEditText.onChange = my_palette.grp.markersRow.markersEditText.onChanging = onMarkersStringChanged;
                    my_palette.grp.FramesRow.FramesEditText.onChange = my_palette.grp.FramesRow.FramesEditText.onChanging = onFramesStringChanged;
                    my_palette.grp.cmds.addMarkersButton.onClick    = onAddMarkers;
                    my_palette.grp.cmds.helpButton.onClick    = onShowHelp;
                    my_palette.layout.layout(true);
                    my_palette.layout.resize();
                    my_palette.onResizing = my_palette.onResize = function () {this.layout.resize();}
                    if (my_palette instanceof Window) {
                        my_palette.center();
                        my_palette.show();
                    } else {
                        my_palette.layout.layout(true);
                else {
                    alert("Could not open the user interface.", scriptName);
        Neo_Add_MultiMarkers(this);

    You should ask such questions over at AEnhancers. I had a quick look at your code but could not find anything obvious, so it may relate to where and when you execute certain functions and how they are nested, I just don't have the time to do a deeper study.
    Mylenium

  • Help modifying example that sets screen resolution programmatically

    Hello,
    I'm wondering if anyone could help modify the following example: http://www.ni.com/example/27650/en/. Currently, it sets different screen parameters (ie: resolution, pixel depth and refresh rate) for a default screen. I'd like to use it with two monitors. I found the function calls needed to do this; unfortunately, I'm unable to piece it together due to lack of function prototype translation knowhow.
    You'll quickly notice that the first CLF would change from EnumDisplaySettingsA to EnumDisplaySettingsExA (http://msdn.microsoft.com/en-us/library/dd162612(v=vs.85).aspx).
    The second CLF changes from ChangeDisplaySettingsA to ChangeDisplaySettingsExA (http://msdn.microsoft.com/en-us/library/dd183413(v=vs.85).aspx). The key implementation I'm after is the C++ example code shown almost at the bottom of this MSDN page - it first enters the desired resolutions for both monitors and then sets both simultaneously.
    Any help anyone can offer is greatly appreciated. The final example, of course, can be made available for the community to benefit from.
    Jorge

    Well, unfortunately this isn't as simple as it seems.
    If your example code works properly, all you should need to do is reference system.windows.forms.screen in .net. Using property nodes you can get all screens, then use the device name property within a for-loop to come up with an array of the actual device names.
    Then you just need to feed those device names in to the example code, but encased in a for-loop so that they displays are accessed individually. 
    Unfortunately, I'm currently getting a complete crash when I do this. I think it's due to a problem with changes in the EnumDisplaySetttingsA function since this code was originally written (which was quite some time ago). 
    Either way, this is not a recommended procedure for most situations. I would recommend consulting the MSDN documentation you referenced and pursuing this further if it's something that you really need to do.
    Christopher S. | Applications Engineer
    Certified LabVIEW Developer
    "If in doubt... flat out." - Colin McRae

  • Help needed on UCCX Script

    Hi All,
    I am adding one new script on IPCCX 7.0. Can some help to understand the function of the following:
    DateList=Create File Decument "C:\Program Files\wfavvid\Documents\user\en_US\" + calendar + ".xml")
    When I run reactive bedug I can see the following error output:
    Can some please help me how this script work.
    Apprecaite your quick response.
    Regards,
    Nirmal

    Hi Brian,
    This seems to be I am missing Calender string value. If I set this to business, now look good.
    Once again thanks for your support.
    Regards,
    Nirmal

Maybe you are looking for

  • ASSINING COMPANY CODE TO CONTROLLING AREA

    hi,    iam trying to assign the company code to the controlling area but there is field <b>C Ctr Hierarchy</b> which i need to fill up, how can i do that one before i assign company code to controlling area

  • Tracing of client's part request's with OO4O

    any sugestions about subj ? (like as OracleMonitor for DOA does) thanks

  • Embedding Ovi Shared Files in Flash

    How do I embed my shared media in a flash website. The embed html code isn't supporte inside of flash and when I try to load the swf into my flash web site I get an error with the OviShare() fundtion. Is there a way?

  • Update two table in receiver jdbc

    Dear all; i have one issue sync update as below; stmt1. one table(TB10) and has key is  MATNR  and  value AAA,   i am trying to update  key value AAA. then stmt1_response return to update_count 1. stmt2. sencond table(TB20) and has key is  MATNR  and

  • Targus comfort bluetooth mouse won't connect

    Hi, just bought Targus bluetooth mouse: http://www.targus.com/us/productdetail.aspx?sku=AMB09US However, my computer is not able to recognize it. When I try to connect it to the different computers, it works without problems so the problem must be on