Help With dynamic scripting for Dervied Property
Hi,
I am trying to get the the list of child nodes and then loopthorugh those nodes to do some calculation in a derived propety using dynamic scripting. I tried with below script.
var childEnumerator = node.GetChildEnumerator();
while(childEnumerator.MoveNext())
var propValue = childEnumerator.GetCurrent().PropValue("Custom.Salary");
print(propValue);
While Evaluating this script I am getting below mentioned error. Any idea what i am missing here?
DRM-16008: There was an error calculating Script property Custom.TotalSalaryExp for EMP_Zone/Emp/PPD1: TypeError: 'GetChildEnumerator' is not a function
Please help me out. thanks fr your co-operation
Regards,
Sudipta
Try this instead...
var childEnumerator = node.GetChildEnumerator();
childEnumerator.MoveNext();
while(childEnumerator.GetCurrent() != null)
var propValue = childEnumerator.GetCurrent().PropValue("Custom.Salary");
print(propValue);
childEnumerator.MoveNext();
Similar Messages
-
Help with dynamic playlist for mpd
Hi guys,
I use mpd with sonata for playing my music, and after trying exaile there is one thing id really like for mpd, and that is the dynamic playlist function.
When you're playing a song in exaile with dynamic playlist enabled, it queries audioscrobbler and automatically adds similar artists/songs to your playlist (if you have them on your pc).
I dont want to use exaile as it just feels too big and slow and bloated (not KISS ), i know a little bit of python so i thought i'll try and make my own little script/program as Sonata has audioscrobbler support, but i dont think there is anyway to query similar artists.
I think im going to try and make this as a daemon type program that will run in the background adding songs to the playlist.
Ive found the code from the exaile source (audioscrobbler.py) which queries lastfm e.g.
>>> lips = AudioScrobblerQuery(artist='The Flaming Lips')
>>> for artist in lips.similar():
... print artist.name, artist.mbid
This will print a list of similar artists to the flaming lips.
I've not done much with python so i thought this would be a good way to try and improve.
Does anyone have any suggestions as to what the best way to go about searching and comparing the results to my mpd database, would the best way just to be to search the mpd.db?
And if anyone else has any ideas/comments id like to hear them.
Edit:
I just found this too, so i may only need to change some things to integrate it with mpd rather than amarok
http://www.kde-apps.org/content/show.php?content=31920
Thanks
Last edited by Kane (2008-06-05 13:24:33)well i just modified the patch into a little script, it does what i need
its here if anyone wants it
import audioscrobbler
import mpd
import random
import time
lastsong = {}
def timer_control():
get_similar()
time.sleep(10)
timer_control()
def get_similar():
audioscrobbler
client = mpd.MPDClient()
client.connect("localhost", 6600)
mpdstatus = client.status()
prevsonginfo = client.currentsong()
global lastsong
if mpdstatus['state'] == "stop": return
if prevsonginfo == lastsong: return
lastsong = prevsonginfo
similarartists = ""
song = prevsonginfo
#if not song: break #No song, do nothing
prevartist = song['artist']
# Is the info already cached?
similar_cache = {}
if similar_cache.has_key(prevartist):
similarartists = similar_cache[prevartist]
else:
#Not cached so fetch from Audioscrobbler
try:
similarartists = [artist.name for artist in audioscrobbler.AudioScrobblerQuery(artist=prevartist).similar()]
# Cache search results and save some time next search
similar_cache[prevartist] = similarartists
except audioscrobbler.AudioScrobblerError:
similar_cache[prevartist] = None # Empty cache
return # Do nothing!
if not similarartists: return # Empty list
# Split list in half and sort upper half
# this means good matches will have priority
# but makes sure artist A does not always result in artist B
half_idx = len(similarartists)/2
upperhalf = similarartists[:half_idx]
lowerhalf = similarartists[half_idx:]
random.shuffle(upperhalf)
artistlist = upperhalf
artistlist.extend(lowerhalf)
# Try each artist in order
for artist in artistlist:
try:
print "Trying:",artist
songs = client.search("artist", artist)
if not songs: continue
selected_song = random.sample(songs, 1)[0]
client.add(selected_song['file'])
print "Added", selected_song['title'],"by",selected_song['artist']
# Delete old song from playlist?
break
except mpd.MPDError, e:
print "MPDError", e.message
continue
except ValueError, e:
print "ValueError:",e.message
continue
timer_control()
Last edited by Kane (2008-06-06 16:22:49) -
NEED a java coder to help with a script for a programs of mine.
I play a game, very competitively, and need someone to make and compile a script for me. I am willing to pay upwards of 100 USD for this script made to MY standards. There will be a lot of work involved...Probably 12 hours studying my game and the purpose of the script(s). I will be buying 2-3 scripts, at roughly 50-100 USD each, depending on the quality. I will transfer the money via paypal, or other means if we can reach an agreement.
Please IM me at Chadtrapier on AIM or send an email to [email protected]
Or...Add me on MSN - [email protected]
We can reach an agreement with these scripts...
Thank you, I will also check this thread, so reply if you would like.
~ChadUmmm. Do you think that's a lot of money or something? Think in the range of 40-60 per hour. And if you're talking about warcraft I don't think they java hooks to make bots. I think you need to figure out what your problem is first and maybe learn to code them yourself.
-
Help with understanding script for rotating objects
Hi all
would some help me with this, I am trying to understand what part of AS3 script says loop through(create a continues 360 loop of objects) the images from an XML file, does this make any sense.
in my script I have this
for(var i:int = 0; i < images.length(); i++)
is this the part that says loop the images/objects
this is a little more to the script including the above to maybe understand better?
private function onXMLComplete(event:Event):void
// Create an XML Object from loaded data
var data:XML = new XML(xmlLoader.data);
// Now we can parse it
var images:XMLList = data.image;
for(var i:int = 0; i < images.length(); i++) <<<<<<<<FROM ABOVE /// {
// Get info from XML node
var imageName:String = images[i].@name;
var imagePath:String = images[i].@path;
var titles:String = images[i].@title;
var texts:String = images[i].@text;
any help would be greathi rob
ok I found this menu which rotates item around on a 360 wheel trying to see if I can use the same script on my menu,
link to example: http://art.clubworldgroup.com/menu/R...g_menu_AS3.zip
I have highlighted in blue what creates the loop of items
in my menu I do ot have anything like
var angleDifference:Number = Math.PI * (360 / NUMBER_OF_ITEMS) / 180;
which sest up the 360 circle of the item
//Save the center coordinates of the stage
var centerX:Number=stage.stageWidth/2;
var centerY:Number=stage.stageHeight/2;
//The number of items we will have (feel free to change!)
var NUMBER_OF_ITEMS:uint=15;
//Radius of the menu circle (horizontal and vertical)
var radiusX:Number=200;
var radiusY:Number=200;
//Angle difference between the items (in radians)
var angleDifference:Number = Math.PI * (360 / NUMBER_OF_ITEMS) / 180;
//How fast a single circle moves (we calculate the speed
//according to the mouse position later on...)
var angleSpeed:Number=0;
//Scaling speed of a single circle
var scaleSpeed:Number=0.0002;
//This vector holds all the items
//(this could also be an array...)
var itemVector:Vector.<Item>=new Vector.<Item>;
//This loop creates the items and positions them
//on the stage
for (var i:uint = 0; i < NUMBER_OF_ITEMS; i++) {
//Create a new menu item
var item:Item = new Item();
//Get the angle for the item (we space the items evenly)
var startingAngle:Number=angleDifference*i;
//Set the x and y coordinates
item.x=centerX+radiusX*Math.cos(startingAngle);
item.y=centerY+radiusY*Math.sin(startingAngle);
//Save the starting angle of the item.
//(We have declared the Item class to be dymamic. Therefore,
//we can create new properties dynamically.)
item.angle=startingAngle;
//Add an item number to the item's text field
item.itemText.text=i.toString();
//Allow no mouse children
item.mouseChildren=false;
//Add the item to the vector
itemVector.push(item);
//Add the item to the stage
addChild(item);
//We use ENTER_FRAME to animate the items
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
//This function is called in each frame
function enterFrameHandler(e:Event):void {
//Calculate the angle speed according to mouse position
angleSpeed = (mouseY - centerY) / 5000;
//Loop through the vector
for (var i:uint = 0; i < NUMBER_OF_ITEMS; i++) {
//Save the item to a local variable
var item:Item=itemVector[i];
//Update the angle
item.angle+=angleSpeed;
//Set the new coordinates
item.x=centerX+radiusX*Math.sin(item.angle);
item.y=centerY+radiusY*Math.cos(item.angle);
//Calculate the vertical distance from centerY to the item
var dx:Number=centerX-item.x;
//Scale the item according to vertical distance
//item.scaleX = (dx / radiusX);
//If we are above centerY, double the y scale
if (item.x<centerX) {
item.scaleX*=1;
//Set the x scale to be the same as y scale
item.scaleY=item.scaleX;
//Adjust the alpha according to y scale
item.alpha=item.scaleX+1.9; -
Need help with easy script for open / close app and move files
Hi,
I'm not a scripter.. never done anything special perhaps more complicated than /shutdown -s on cmd..
I actually learned ASCII C language on university but never used it in real.
I'm trying to create a basic script that perhaps you could help me or guide me how to do it..
The commands are
1) Close a running app (end task it or force kill it, I prefer end task it)
2) delete files from x location
3) run .exe app from y location
4) close that running app
5) move files from z to y
Perhaps adding few "wait few seconds" commands in between each, so the apps will launch successfully..
My first question will be whats the easiest script language to do that?
I tried VBScript but couldn't find commands for open or close apps.. also for controlling files..
And what commands can do that? I could google them up for better understanding no need for rough guide
And lastly, does it too hard? If it takes more than hour to make it (learn and process) than it ain't worth it..
Thanks alot ahead!
Jordan.hmm 2 questions:
1) taskkill.exe causing me access deny error.. I used "taskkill.exe /IM softwarename.exe"
how do I get permission or something to fix that?
2) on the "move" command..
First, its a "copy" instead.. but I easily figured that out..
but more important is that I want to copy a folder.. with unknown list of way too long files and sub folders..
and all I see is ability to move a file..
Is this possible?
Thanks -
Help with a script for elder friend
First off, with apologies, I am not a script familar person at all. I have an elderly friend who is switching to Mac for the first time. I wanted a way to close all open programs, with a prompt to save any open files and then run a Time Machine backup and shut down - preferably without restarting next day with any windows opening automatically. Time Machine is set to run every hour but she's a writer and could lose work if Time Machine doesn't run before shutting down for the night. So I searched and found some small scripts that I tried to put together. I think it works but after Time Machine runs it waits a very long time before shutting down. I'm wondering if some of you kind folks could refine this for me. (I do realize that automator has a quit all programs that I can save as an app but I'm trying to make this a one step 'app' process.)
So what I have is this:
tell application "System Events" to set the visible of every process to true
set white_list to {"Finder"}
try
tell application "Finder"
set process_list to the name of every process whose visible is true
end tell
repeat with i from 1 to (number of items in process_list)
set this_process to item i of the process_list
if this_process is not in white_list then
tell application this_process
quit
end tell
end if
end repeat
on error
tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
end try
do shell script "/bin/bash -c '/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper > /dev/null 2>&1 &'"
repeat
delay 5
if not IsProcRunning("backupd") then
ignoring application responses
tell application "Finder" to shut down
end ignoring
exit repeat
end if
end repeat
on IsProcRunning(theProc)
try
do shell script "ps auxc | grep \"" & theProc & "\""
return true
on error
return false
end try
end IsProcRunning
.... frankly I don't understand most of this in reality but it's a need I'd like to help her with on her Mac Mini.
Many Thanks,
BrendaFirst off, you're overthinking this. There's no reason why your friend would lose any data by not backing up prior to shutdown (unless she has a flaky hard drive that needs to be replaced). Assuming she's saving her work when she quits her apps, she should be fine.
Second, trying to auto-quit applications is dangerous. You don't check to see if any files need to be saved (there's no easy way to make that check anyway), and that in itself could cause data loss.
Third, time machine has its own command line utility: tmutil. There's no reason to script backupd.
Last, if I remember correctly, whether or not apps and windows reopen at startup can be set on a system-wide or per-application basis.
Give a clearer and more specific description of the goals you're trying to accomplish: what kind of apps are likely to be open, which of them will/might need to save data, what you want the machine to look like on restart, all with details. That would help a lot. -
Need help with configure script for audacious plugin
Hello. I have written a small plugin for audacious, that uses an Amarok script to retrieve song lyrics and displays them in a window. I'd like to make an AUR package of it, but I don't even know how to write a configure script. I used to compile it with audacious-plugins, but I suppose a package with all audacious plugins plus my own would be sort of a duplicate of the vanilla audacious-plugins.
Can anyone help me?btn1.addEventListener(MouseEvent.CLICK,f1):
function f1(e:MouseEvent){
nextFrame();
btn2.addEventListener(MouseEvent.CLICK,f2):
function f2(e:MouseEvent){
prevFrame(); -
Need help with python script for Deluge
I am using Deluge 1.3.2 with web server, and all works fine, I use this script in the Deluge settings to execute upon torrent completion:
#!/bin/bash
torrentid=$1
torrentname=$2
torrentpath=$3
torrenttimedelta=`/usr/bin/python2 /home/bobby/scripts/deluge/torrentTimeDelta.py $1`
subject="Started download new torrent!"
message="$torrentname to $torrentpath"
echo -e `date`"::Finished downloading torrent:$2 in: $3" with id:$torrentid >> ~/logs/scripts.log
echo -e `sendEmail -t [email protected] -f [email protected] -u "deluge server notification: torrent $torrentname is complete!" -m "$torrentname has completed downloading at: $torrentpath and took $torrenttimedelta to complete :)" -xu [email protected] -xp password -v -o tls=yes -s email.com` >> ~/logs/scripts.log
echo ---------------------------------------- >> ~/logs/scripts.log
This is to email me when a torrent is done and works. What I wanted to add to this email was the time taken to complete the torrent. I have gotten help from Deluge forum in this thread: http://forum.deluge-torrent.org/viewtop … =9&t=36989 However I think it's something with Python within Arch that is the obstacle, and so that helpful person can't do much more IMO. The python script I'm using is:
#!/usr/bin/python2
from deluge.ui.client import client
from twisted.internet import reactor
d = client.connect()
def on_connect_success(result):
print "Connection was successful!"
def on_get_torrent_value(value):
for torrent in value:
print "%s: %s" % (torrent, value[torrent]["name"])
client.disconnect()
reactor.stop()
client.core.get_torrents_status({}, ["name"]).addCallback(on_get_torrent_value)
d.addCallback(on_connect_success)
def on_connect_fail(result):
print "Connection failed!"
print "result:", result
d.addErrback(on_connect_fail)
reactor.run()
Now if I call this from shell directly, it works. However, including it with my email script at the top, Deluge itself freezes and no email is sent. I run ps aux | grep deluge and I can see that the script has run, but apparently died and all is just hanging. I kill the script process and Deluge resumes just fine, the email is sent. Kinda confused how to remedy this, appreciate any help Thanks
P.S. When I get the email, the part that says ""$torrentname has completed downloading at: $torrentpath and took $torrenttimedelta to complete "" shows nothing where $torrenttimedelta should be, it just says "and took to complete"[edit] Sorry, I don't use deluge and I messed up my test script. If the script is executable try `/home/bobby/scripts/deluge/torrentTimeDelta.py $1`
Are there any other errors? or try running bash with debug output to see if it will tell you something else
The problem you are having is bash doesn't recognize variables inside the tick marks.
Hope that helps
Last edited by rickeyski (2011-07-05 19:27:36) -
Help with apple script for Chapter Markers (on each edit)
Hi,
My goal:
Add for each edit in the sequence a chapter marker til the end of the sequence.
(Bonus track would be: Name the marker like the current clipname )
so far I could work it out, with a lot of googling.... but:
Not working: character "a" is not typed, no idea why ?
Not working: goto begin of sequnce at the beginning
And: I need something like a loop til the end of the sequence
help very appreciated !
thanks
P.S.: I work tith FCP 7
Here's my code so far:
tell application "Final Cut Pro"
activate
tell application "System Events"
delay 0.5
key code 34 using {shift down} #Go to Begin
delay 0.5
key code 125 # Arrow Down, next edit
delay 0.2
key code 46 #Create a marker
delay 0.2
key code 46 #Edit the marker title
delay 0.2
key code 48 # TAB
delay 0.2
key code 50 # <
delay 0.2
key code 8 using {shift down} # C
delay 0.2
key code 4 # h
delay 0.5
key code 128 # a
delay 0.2
key code 35 # p
delay 0.2
key code 17 # t
delay 0.2
key code 14 # e
delay 0.2
key code 15 # r
delay 0.2
key code 50 using {shift down} # >
delay 0.5
key code 76 #Enter, Get out of marker window
delay 0.5
key code 125 # Arrow Down
end tell
end tellUse Automator. It's great for repetitious tasks (like the one you've described), and it's very user-friendly. Open Automator, create a new workflow that executes the action you want, and you can apply that action to the resources you wish to edit.
Good resource here:
http://bit.ly/ -
Help with Automator Script for QuickTime Pro Movie Conversion from Vado
All my videos from my Creative Vado do not show up in iMovie 09 initially on import. By trial and error, I have discovered that the old version of QuickTime Pro 7 ($29.95) will convert them to .mov files that can be seen by iMovie 09 once the converted videos are imported back into iPhoto.
I am (very) new to mac things, and it looks like in theory I could use Automator to handle to conversion process, and perhaps even the re-import into iPhoto. Does anyone have any suggestions on how to go about this? Where would be a good site to post this as a project that I could pay some one to help me, provide an automator script/workflow?
Are any other solutions available? Buy Final Cut etc?
PS (Rant): One of the reasons I bought a MacBook Pro and iLife was to take advantage of what I thought was supposed to be Apple's superior multimedia handling. It seems ludicrous to me that with a MacBook Pro running the latest software (10.6.4), and using the latest versions of iLife, I'd have to buy an old version of QuickTime to convert my videos so that I could manipulate them in iMovie. Sigh.MPeg Stram clip will export files which are compatible with iMovie '09. It (iMovie )can import the following.
DV
AIC
Motion-JPEG
Photo-JPEG
MPEG-4 (Supported profiles)
H.264 (Supported profiles)
Apple Animation (Movie '09 only)
Apple Video (iMovie '09 only)
iMovie '08/'09 will not accept files containing extraneous data tracks such as:
'Tween
Text
Chapter
Closed Caption
Secondary audio such as AC3
etc.
iMovie '08/'09 Will not accept files that rely on proprietary/third-party components such as
DivX
WMV
XviD
etc. -
Help with the script for fullname
Hello
I am trying to write a script on my form for a fullname field. For eg:" someone enters fullname as abc l xyz then i want it to be like Abc L Xyz
i tried writing a script but i am messing up somewhere. Can anyone help me please, its urgent
ThanksHi Jasmin
I am trying to put a jAVAScript into the script window and got the following script it works otherwise but when inserted into form it doesn't work
I am doing it on exit event
var FormName = "7158.pdf";
var FieldName = "FullName2";
function CapitalizeNames() {
var ValueString = new String();
eval('ValueString=document.'+FormName+'.'+FieldName+'.value');
ValueString = ValueString.replace(/ +/g,' ');
var names = ValueString.split(' ');
for(var i = 0; i < names.length; i++) {
if(names[i].length > 1) {
names[i] = names[i].toLowerCase();
letters = names[i].split('');
letters[0] = letters[0].toUpperCase();
names[i] = letters.join('');
} else { names[i] = names[i].toUpperCase(); }
ValueString = names.join(' ');
eval('document.'+FormName+'.'+FieldName+'.value=ValueString');
return true; -
Need help with a script for moving bulk users to another OU and removing/assigning groups
I've never used PowerShell before and have been asked to track down a script that can move bulk users from one OU to another, and remove and assign new group membership. I've been googling it for about 30 minutes and haven't really gotten anywhere. If
somebody can point me in the right direction or give some tips I'd greatly appreciate it. I'm sure this kind of task has been done by several people in similar environments I just haven't been able to find those people/examples.Here's what I've got so far...
Moving to new OU
CSV constructed like below...
DN
TargetOU
“CN=John R, OU=BB,OU=ES,OU=Students,OU=OSD,DC=usd233,=DC=local”
"OU=PRT,OU=MS,OU=Students,OU=OSD,DC=usd233,DC=local"
Import-Module activedirectory
$UserList = Import-Csv "c:\yourCSVhere.csv"
foreach ($User in $UserList) {
$User.DN
$User.TargetOU
Move-ADObject -Identity $User.DN -TargetPath $User.TargetOU
Would this work? I also need to remove the user from two groups and add them to two different groups as well. Would I need to use the addUsertoGroups and removeUserfromGroups commands? -
Help with a script for checking processes
hello,
I have the following script
while :
do
date
ps -ef |grep f60runm | wc -l
sleep 60
done
I would like this script to also add to a txt file so that I can see the activity overnight.
rgds
AlanWell, if the commands are in a script:
script.sh >> /path/to/logfile.log
or you could do this inside the script:
LOGFILE="/path/to/logfile.log"
while :
do
date >> $LOGFILE
ps -ef |grep f60runm | wc -l >> $LOGFILE
sleep 60
done -
Need Help with EEM script for monitoring Rx and Tx load on Link
Hello,
I'm trying to implement a script, which monitors the Tx and Rx Load on the Link and sends a syslog in case the load is exceeded 200 mark (i.e If Rx or Tx load > 200)
I have implemented the following script. But it is not giving the required results.
event manager applet test
event interface name Tunnel111 parameter rxload entry-val 200 entry-op gt entry-val-is-increment true poll-interval 5000
action 1.0 syslog msg "Increase Load On the Link"
I'm trying to monitor the load on Tunnel 111 which is mapped to WAN interface.
Router (Cisco 2821) has following IOS
c2800nm-advipservicesk9-mz.124-25g.binHello Joseph,
As per your suggestion, we made some changes in our script and the following script is working fine. Its giving the required syslogs when the load is exceeded.
event manager applet test
event interface name Tunnel111 parameter txload entry-val 200 entry-op gt entry-val-is-increment false poll-interval 5
action 1.0 syslog msg "Increased Load On the Link"
Your prompt assistance is really appriciated. -
SAVE AS BUTTON WITH JAVA SCRIPT FOR MOUSE UP EVENT
Please any one help with complete code for "SAVE AS" button to auto save the acrobat form in a user specified path
with unique name or incremental name.Please post only full script for MOUSE UP event.Thanks George but i need an example.my actual need is
i have created a SAVE INVOICE button.i have set the action"Mouse up" to run a Java script.
Now i need a scriprt for the same.
If i press that SAVE INVOICE button.the fie should save on "C:\Users\MUNNA\Desktop" automatically
with unique name and the name should not remain same for next Save.because it overwrites the previous
file so please post an example pdf with same.
Maybe you are looking for
-
Error while GR against a Purchase Order
Hi; I need to post stock into QI status after GR for this,In material master Purchasing view i have post to inspection stock activated and the QM view does not exist.and while doing GR against a purchase order using MIGO i am getting a message "stock
-
How to get a 'when others' exception raised.
the 'when others' exception is raised usualy after a error occurs, but when does this actually occur? could some1 give an example?? usually some error occurs and then a inbuilt exception is raised. but 'others' exception never seems to take place?
-
Lenovo Ideapad U410: part of screen is white
I have a Lenovo Ideapad U410 and the left part of my screen is uniformly white after turning on the laptop. It's a rectangle about 1 inch long, from top of the screen to the bottom. I got this suddenly pretty much a month after buying the laptop (it
-
hi, I am using the badi DPR_EVENTS (and implemented it in a class) to get the changes of the project definition (dpo) in cprojects. it workes fine for the on_change event but how can I find out which field of the project description has changed (e. g
-
Hi, I have just updated to iTunes 11, once I opened itunes I noticed all my music, books, programs and app's had disapeared. Luckily for me I have everything backed up, except for my playlists. Is there a way to save /transfer the playlist from my iP