Random Delete tool with Scriptographer

Hi, I am trying to refine the RandomTools created for Scriptographer so that it suits my preference, but I can't figure it out in Javascript. Not knowing a lot of Javascript don't help me either!
Here is the script, simplified to conserv only the Delete part. What I would like to do is to enter a percentage, and then this would be the percentage of selected object removed.
If anyone would point me to a direction with that, It would be really great.
*  randomDelete 0.4
*  Base on
*  Ken Frederick
[email protected]
*  http://cargocollective.com/kenfrederick/
*  http://kenfrederick.blogspot.com/
*  Modified by Jolin Masson
*  http://jolinmasson.com/
*          this script uses stuff borrowed from keegan's "rando-color.js"
*          as well as from some other things i had written in processing
script.coordinateSystem = 'bottom-up';
script.angleUnits = 'radians';
var sel;
var values = {
          b_delete: true,
          val_deleteAmt: 2,
// gui components
var components = {
          b_delete: {
                    onChange: function(value) {
                              components.val_deleteAmt.enabled = value;
          val_deleteAmt: {
                    type: 'number',
                    fullSize: true,
                    enabled: true
          deleteRule: {
                    type: 'ruler',
                    fullSize: true,
          submit: {
                    type: 'button',
                    value: 'Apply',
                    onClick: function() {
                              Main();
// Setup
function Setup() {
          // initialize the palette window
          var palette = new Palette('Random Delete 0.5', components, values);
// Update
function Update() {
// Main
function Main() {
          // document properties
          sel = activeDocument.getItems( { type: Item, selected: true } );
          //adjust delete range values based on selection number
          components.val_deleteAmt.range = [0, sel.length-1];
          // loop through selected items
          for ( i in sel ) {
                    var object = sel[i];
                    if( object.isValid() ) {
                              // delete
                              if ( values.b_delete ) {
                                        rand = parseInt( Math.random()*values.val_deleteAmt );
                                        if (rand == 0) object.remove();
                    } //end isValid()
} //end Main()
// methods
function random(minr, maxr) {
          return minr + Math.random() * (maxr - minr);
// execution
Setup();
Update();
Thanks

I will do that, but I don't know if the community is still very active there…
And here is the file, if someone want to give it a try!
Right now, the script will delete a random number of items, depending of the number you give in the dialog box, and the number is somehow in relation with the quantity of items selected.
I would like it to delete a given percentage of the items, no matter how much are selected.

Similar Messages

  • Songs that are imported manually from cds or flash drives are randomly deleting from my iphone 5. Sometimes I get an error -54 message first. Sometimes not. What could be causing this and how can I fix it?

    I have an iPhone 5 16g ios 8.2 and it keeps randomly deleting the songs I manually put on from cds or flash drives. The songs I purchased from iTunes don't delete just the ones I manually add. It has happened three times, once after I added 399 songs, once after I added 27 songs and once when I added 45 songs. Sometimes an error (-54) pops up but not always, it's just in an instant all the songs I put on are suddenly gone. I have uninstalled and reinstalled iTunes three times, reset all the settings on my phone and also restored my phone to factory settings. Nothing has worked. I have a 4th generation iPod and I have never had this problem. Any and all suggestions/help would be greatly appreciated. Thank you.

    x0SiN0x:
    Welcome to Apple Discussions..
    My first suggestion is to Repair Disk. Here's how:
    Insert Installer disk and Restart, holding down the "C" key.
    Go to Installer menu (Panther and earlier) or Utilities menu (Tiger) and launch Disk Utility.
    Select your HDD (manufacturer ID) in the left panel.
    Select First Aid in the Main panel.
    (Check S.M.A.R.T Status of HDD at the bottom of right panel, and report)
    Click Repair Disk on the bottom right.
    If DU reports disk does not need repairs quit DU and restart.
    If DU reports errors Repair again and again until DU reports disk is repaired.
    If DU reports errors it cannot repair you will need to use a utility like Tech Tool Pro or Disk Warrior
    Please post back and let me know how that goes.
    Here are a few links that may help you to identify the issues:
    Resolving Disk, Permission, and Cache Corruption
    Tuning Mac OS X Performance
    Mac OS X System Maintenance
    Please don't hesitate to post back should you have further questions or comments, or with update.
    Good luck.
    cornelius

  • Songs are randomly deleting off my iphone but are still on my itunes library on my computer...and wont sync to my phone even though they are selected to..HELP!

    I only have a portion of songs from my itunes library selected to synch to my iphone 5 (35 songs from one artist).  They have always been on my phone without issue, even after updating to the ios7.  Just last night however, about half of those songs randomly deleted.....now only 15 of those songs are appearing on my iphone.  I tried deselecting that artist when synching my phone to itunes to wipe the songs off completely, and then reselecting that artist's songs to synch to my phone, but again only the 15 songs would show up after the synch.  Long story short, all 35 songs are still available in my itunes library, yet only 15 of the songs will synch with my phone.  I have never had this problem, even after synching new songs from that artist to my phone when synching it with itunes.  Dont know if this has something to do with ios7.....if somebody could help me out I would greatly appreciate it!

    I forgot to mention that when I look at the playlist that has been tranferred to the iPhone all the ones that won't play and are greyed out have a sync symbol next to the check mark.

  • ITunes randomly deleting content - the "!" shows beside them, but they are not where iTunes says they are

    Hi - I find that iTunes has been randomly deleting some content (movies or songs) from my library.  I'll go to play something and it will have an exclamation point beside it.  Sometimes if I "Get Info" and locate the file, it will be there, and then play fine.  But sometimes it is completely gone from the library (still listed with an exclamation point, but not in the file folder it was stored in).  In that case, the location in the "get info" window shows as:
    file://localhost/Users/Username/.Trash/iTunes Media/Movies/Movie Title/Movie Title.m4v
    Even if I view hidden files, I cannot find that folder location to move the content.  The content is also not in the Trash, nor on the extrernal hard drive any more.
    NO idea why this is happening, and can't figure out a pattern.  Is anyone else having this issue, and/or found a solution?
    As background, I'm on a MacBook Pro (2011), running OSX Lion.  I sync an iPhone and an iPad2 to the iTunes library.  iTunes is set to manage files automatically.  The library is stored on an external hard drive accessed through a Time Machine.
    Thanks to anyone that can help!

    file://localhost/Users/Username/.Trash/iTunes Media/Movies/Movie Title/Movie Title.m4v
    But that file location is your System Trash -  you seem to have a problem with the permissions on your Trashes, either in your system Trash or the hidden Trash bin on your external drive.
    See if any hints in this document help to locate the trash on your external drive:
         Solving Trash Problems: http://thexlab.com/faqs/trash.html
    The library is stored on an external hard drive accessed through a Time Machine.
    Do you mean your Library is stored on a network volume (Time Capsule)? Then network problems may be the reason for your dead tracks.
    Regards
    Léonie

  • Apple delete tool?

    Does Apple have an Itunes delete tool I can download and use? I tried to install the new version of itunes but the icon turned read and came back with an error stating that it was not installed correctly when I tried to click on it.
    I have tried to follow the steps to reinstall correctly where I have removed the programs from control panel in the correct order. It then states I have to manually delete the folders from my pc but when I try it wont let me because they say they are in use.
    What do I do next?

    Back up all data. Rebuild the mailbox. Try to delete the message again.

  • ITunes randomly deletes music

    I have a Windows Vista computer with iTunes 8.0.1.11.
    I have noticed that iTunes randomly deletes music from my computer, i know this because, i have a mac with the same music library and there is music on my mac which is gone from my windows computer.
    The file is not in the music folder, and it doesn't appear anywhere on iTunes. There isn't a notice that says, file cannot be found, it is just completley gone. I do the same updates on both computers, so it can't be that.
    Why is iTunes deleting music ?
    Thanks

    This has been happening to my wife's itunes library as well. First I had it set to use the existing folders of music on her laptop. Then it started deleting the original music files at random. Some were songs that she had for a long time and are nearly irreplacable. So I smartened up since Itunes is kind of a crappy software and had it just copy all imported songs into the itunes folder (keeping the itunes library seperate from the original files). Even though this is basicly using twice the space, it is a sacrifice that I must make in order to compensate for really bad coding.
    Now, everything was fine for a while. Last night she updated to the 2.1 itouch software and everything seemed to go fine. This morning, she added a few more folders to the itunes library (again it should be copying the music to the itunes folder). But low and behold, she starts itunes and it deleted a bunch of music from her library. Thank gawd I had it not manage her original files as I would be throwing the ipod through the wall if it had.
    This is very frustrating (among other issues which I will post in a new thread). Apple needs to give us an answer as to why itunes is behaving like this.

  • Contacts randomly deleting themselves throughout the day ios7

    With the new update of iOS 7.0.3 it worked fine for a few days than one day it just randomly deleted my contacts and when i went to settings i saw my icloud had my settings turned off and i flipped it on and they all came back. this happened a few times and than it started to only delete the contacts that are over 5 or 6 months old or older (only keeping my recent contacts) than all my old ones would just randomly pop back up. Now its starting to delete them all and i could go to settings click icloud turn off my contacts switch and turn it back on and they would come back in a few minutes. Now they are just all gone, all my text messages and conversations are still there and instead of the name above the convo its just their number. I logged onto my icloud from my laptop and my contacts are still there they just wont sync back up with my phone. I dont understand why they would delete themselves in the first place. I'm out of ideas on this anyone else have any input?

    I'm syncing to iCloud. I've experienced the bug where iCloud will turn itself off in settings and it will appear that you've lost all of your contacts until you turn it back on, but this is different. Several times a week for the last 3 weeks or so I'll receive an iMessage from someone who is a contact and regularly messages me, and their message will show up as coming from a phone number.

  • CS5 Extended. Is there a way to delete tools I don't use

    Mac OS 10.6.8. CS5 Extended Photoshop. Is there a way to delete tools I don't use? I use the dotted square and dotted elipse (2nd tool down) but never use that skinny dotted one (vertical or horizontal) and too often I am trying to get the square or the elipse and accidently end up with the skinny one. Is there a way to get rid of tools I never use? Thanks.

      these 2 tools = can they or others be deleted from my program?

  • My iTunes keeps randomly deleting songs.

    I know it isn't because it's full, I don't have enough for that to be the problem, but over time I go to look for a song I know I purchased and it's missing from my library. When I go to the store to find the song or album, it asks me to buy it again as if i never had. It's driving me crazy and I don't want to keep paying for music twice. Help!

    I estimate iTunes really randomly deleting files and the iTunes Store really completely forgetting you ever purchased an item at about my chances as winning the lottery (for which I never buy tickets).
    Do you have more than one AppleID?  You cannot merge AppleIDs and items purchased with one will remain permanently associated with that ID, thereby not appearing in the Store as purchased if you log on with a different ID.

  • IPhoto randomly deleting photos, leaving empty events behind.

    Hi. My iPhoto will randomly delete photos from entire events, leaving behind only an empty event. What is happening? Are the photos still on my computer somewhere? How do I make is stop?
    I have read it could be a corrupt library? Is that possible? Any help is greatly appreciated.

    Super! Thanks for the guidline for providing better detail.
    I'm running iPhoto '11 (version 9.4.2)
    -on OSX Mountain Lion 10.8.4
    - There doesn't seem to be a trend to what photos are deleted and when. It has started within the past 5-6 months. All I observe is when I open my iPhoto, on occasion there will be an empty event. It never deletes partial events and it never deletes the event itself (that I have noticed) There are absolutley no other problems with iPhoto itself. It speaks to my iPhone and iPad just fine, iCloud syncs the Photo Stream well. I am fairly certain that the only photos deleted came from my iPhone. (I have an iPhone 5)
    In addition to deleting photos, it seems that iPhoto is misplacing events. For example, I have an event with only 3 photos in it taken on 12 April. It has been moved to the top of the list of events for no apparent reason.
    - I can't say how long this has been going on. Maybe 5-6 months tops. I did move to Indonesia from America in that time. I can't imagine that would do anything. Before I left, I replaced my hard drive (upgraded to 1TB from 500GB). I restored off of the old hard drive with no problem. I also got more memory installed so I'm running with 8GB instead of 4GB. I have not installed anything or made any other noticeable changes since the problem began. Although replacing a hard drive is no small thing...
    - I have tried to reveal the photos in Finder to see if the original files are still in the source library. They are not. The organization now skips a number where my photos ought to be. Other than that I'm not sure how to fix it. I don't really have a backup from which I can restore.
    - There is nothing unusual about the setup, it's a standard Mac OS and I only use iPhoto with my iPhone and iPad.
    I hope that helps give some information?

  • ITunes randomly deletes folders from my iTunes system directory

    I am running iTunes v7, "I have the box Let iTunes manage folders" unchecked, I have no folders in my iTunes list. I select "Add folder to library". At this point iTunes imports the majority of the albums contained in the iTunes directory on my disk, those that it doesn't it DELETES from my system. This has happened on two different systems so now I have a copy elsewhere on the disk of all the albums in a directory structure. However, how can I stop iTunes from randomly deleting these albums - I have checked to see whether iTunes has just moved them somewhere else, it does not, they are deleted.
    Any suggestions would be appreciated.
    Ray

    I have an Intel based PC with XP Pro. I have had the same problem as the rest of you for 5 years. I have e-mailed Apple 3 times sans response. I searched the Internet for solutions. I have done what several of the suggest but still the problem persists. I had almost 13000 titles of music and old radio shows. Some I uploaded from personal CD's. Some were downloaded via an online music service. I can play a piece one day and the next that line has an exclamation point in front of it. I have lost entire works by one artist due to this problem. I am fed up with reloading the music and losing it. iTunes either has no answer or does not care. I asked about any limitations on the database manger, no answer. I asked about database limitations, no answer. I saw a post two years ago from a husband wife team that had 18,000 titles and had now lost many of them.
    If there are complaints, there must be a problem. If there is a problem, there must be a solution. I spent too many years testing software professionally to think otherwise. If I do not receive a response from iTunes in the near future I will find another database to move my music too.

  • My iPhone 5S randomly deleted all my messages. I have IOS 7.1

    My iPhone 5S randomly deleted all my messages. I don't use iCloud & I have IOS 7.1. Is there any way I can get all my messages back?

    My iTunes got updated with iOS 7.1.1. However, my iPhone still shows error (17) during recovery process. I use Windows 7

  • Apple TV Randomly Deletes Entire Content After Restart

    So I just plugged in my Apple TV to power and noticed that the first 30 seconds after the main menu is presented, browsing through the menu was very sluggish. I then proceeded to watch streamed content, and after the movie was done, I noticed that the Apple TV was resyncing everything I had synced to the Apple TV.
    This isn't the first time this has happened to me. All I know is that the Apple TV remains linked to my iTunes library but, randomly, deletes content once in a blue moon after unplugging it from power and plugging it back in. Don't know if this is a bug in the system or if I am doing something wrong but, all in all, I'd like to know if any of you know what the heck I'm talking about.

    That does not matter. If it does then Apple logic is incorrect (and I am saying this as software engineer and designer with quite alot of expereince in numer of large companies). The software is supposed to be transferred into "buffer" fully before it shows up in system structure. If it overrides the existing data then it HAS TO PROVIDE PROMPT with question to a user as this poses a risk of losing data.
    So synching in background should NEVER override file risking corruption on power failure. Do you know how data backup systems work (e.g. storage)? This is not a new discipline and Apple should follow the general rules in implementation of such systems regardless if this is media synching for fun or not. People get involved their money in solutions and toying with solving problems on unreliable solution is not entertainment - listening to music and watching movies is entertainment. We pay for reliable solution that is not wiping out what costs time and money. If they provide unreliable solution then they should provide some info, procedure or perhaps a way for backup. They don't more frequently thses days (comapring to what I saw few years ago) so, I lost already two episodes of TV show that I purchased from their store and I am upset as well.
    I rely on Apple TV a lot, but I feel I am wasting my time if company start treating me similarily like other big company (figure out which one) that I left for ALL Apple solutions in 2003.
    Advises in manner "do not restart" are not appropriate, because sometimes you do not have control over power outage in your area and system should consider those as well (apart of other things that may delete content accidentally).

  • IMessage randomly deleted old messages?

    Hi there - after upgrading to iOS, Messages randomly deleted some of my old messages for some of my contacts.  For example, I previously had over a year of correspondence with my best friend, and as of last Saturday it just completely restarts.  Some of the older messages are on my iPad (some of them that were sent from the iPhone aren't, for some reason).
    Settings-wise, I still have it set to retain messages forever, and I have a ton of open storage space.  Ideas?

    No, it would not continue a thread on her phone from your non-iPhone, but would be its own. The threads are created based not just on the contact, but the device. So, if she had not deleted a thread from you from your Android device, then you texted her from your iPhone, it would be two separate threads. Then if you iMessaged from your iPod, it would be like a 3rd device, since that comes from your email.
    I do not understand why old threads would be deleted, since there isn't anything in the iPhone that will automatically delete a thread. The only exception is if your SMS inbox is full, but we are talking a lot of messages before that happens.

  • Where do I find a  delete tool in CS6.

    where do I find a delete tool in CS6.

    Hi, rawart00.
    Your question is better suited to the InDesing forum, which deals with general InDesign-related issues. This forum is intended mainly to deal with issues arising from the Getting Started video tutorial on creating a brochure in InDesign CC.
    I hope you find the help you need there.
    Thanks,
    Michelle

Maybe you are looking for

  • How can I make multiple popup links on one page?

    I was wondering if anyone had a simple code that will allow me to have multiple popup links on one page? I have no idea what to do.  Any help would be greatly appreciated.

  • Populate 3 columns in obiee

    Hi, i wanted to populate these 3 columns from the given table but how to create such a condition in table level SELECT 'Press' AS Location, ROUND(CONVERT(DECIMAL(8,2), DATEDIFF(mi,'[Param.1]', '[Param.2]')/60.0),0) AS ScheduledPressHours, CONVERT(DEC

  • Issue while giving Print out

    Hi all,          I have a user who has all the administrative rights and also the rights for purchasing. When he tries to take print outs of GRPO, the system gives a message that the user is not permitted to do this action. Also, the user has full au

  • Can create 52 publication, but creating 53rd leads to problems

    Hello, My apologies in advance for a long post, but I was really trying to make sure I do my due diligence before turning to the community for help, so here it goes. I am working on a proof of concept with the purpose of using transactional replicati

  • Unable to open the Virus Scan Provider in Visual Admin

    Hello, dear experts! [SAP WebAS 6.40 SP13 Windows] We have downloaded and installed the latest Anti-Vir dll as a virus scan provider (they are officially certified provider). After I tried to activate it gave me error message that the version of anti