Preload script - Ignore if already cached?

Hi all,
I'm considering using the Script below (altered to fit my
design) to preload the images prior to a site loading...but what I
would like some help doing is altering the script so that it can
skip the preload if the images its tasked to preload are already in
the viewers cache... What do I need to add to do this?
http://www.dynamicdrive.com/dynamicindex4/preloadimage.htm
Cheers!

Why? Are you wanting to 'preload' all the images on the site
before opening
the home page? I don't think that is a good idea.
Preloading is not magic - it makes a 500K page act like a
500K page, you
know?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"nhavfx" <[email protected]> wrote in
message
news:e2aq4s$o80$[email protected]..
> Hi all,
>
> I'm considering using this (altered to fit my design) to
preload the
> images
> prior to the site loading...but what I would like some
help doing is
> altering
> the script so that it can skip the preload if the images
its tasked to
> preload
> are already in the viewers cache... What do I need to
add to do this?
>
> Cheers!
>
>
http://www.dynamicdrive.com/dynamicindex4/preloadimage.htm
>

Similar Messages

  • Logical Arrangement of Preloader Script

    Hi,
    I have created one swf which does following two things;
    1. Once it gets loaded in HTML on server it will pass Flashvar to HTML. if flash var from swf and HTML both will match then only swf should play.
    2. It will also have Preloader
    independently both the scripts work perfectly. But when i compile both in one file then it dosent work in following cases;
    Case 1- preloader script first and then flashvar:= this preloads file perfectly but dosent pass flashvar
    Case 2- flashvar first and then Preloader:= this works perfectly when i test my file Locally but once i upload it to server then it dosent work for Preloader
    what should be my logical sequence or options in this?
    I am using "Event.ENTER_FRAME" for Preloder and "Event.COMPLETE" for flashvar...is there any mistake?
    //////////////PRELOADER//////////////////
    stop();
    this.addEventListener(Event.ENTER_FRAME, myMovieLoading);
    function myMovieLoading(e:Event):void {
        var total:Number = this.stage.loaderInfo.bytesTotal;
        var loaded:Number = this.stage.loaderInfo.bytesLoaded;
        preloader_mc.bar_mc.scaleX = loaded/total;
        loadInfoText.text = Math.floor((loaded/total)*100)+ "%";
        if (total == loaded) {
            play();
            this.removeEventListener(Event.ENTER_FRAME, myMovieLoading);
    ////////////INITIALISING MOVIE///////////////
    var keyLoader:URLLoader = new URLLoader();
    keyLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    keyLoader.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
    keyLoader.addEventListener(Event.COMPLETE, loading);
    keyLoader.load(new URLRequest("C:/keytext.txt"));
    function onLoadError(evt:IOErrorEvent):void
        loadmyHTML();
    var myFlashVar:String;
    var ver:String;
    var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
    for (ver in paramObj)
        myFlashVar = String(paramObj[ver]);
    function loading(event:Event):void
        if (keyLoader.data.passKey == "pass1")
        else if (myFlashVar=="pass1")
        else
            stop();
            parent.removeChild(this);
    function loadmyHTML():void
        if (myFlashVar!="pass1")
            stop();
            parent.removeChild(this);

    in your loaded code there is
    keyLoader.load(new URLRequest("C:/keytext.txt"));
    please see this will not be found on the server thus it may have problem in loading it on serveer while it run local machine. please try replacing the keytext.txt file path to a relative path which can also be found on the server.
    hope this would help you,

  • Preloading images to browser's cache

    Hi,
    I'm working on a flash gallery project where images are
    loaded through xml file.I have some buttons in the gallery for
    different categories of images to be shown. Is there a way to
    preload images to browser's cache prior to them being called.?,I'm
    using AS2.
    Thanks in advance...

    You can simply load images into an empty movieClip, off
    stage.
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Why does my script ignore values in variable only some of the time?

    Hello,
    I'm a beginner at Powershell and am writing a script to gather the deployment details on all Azure Cloud Services attached to a Azure Subscription, including the info for any service that does not have a deployment.  
    I understand that the way I'm going about this may be wrong and I am NOT looking for any help creating a final script.  Some of my script is written specifically so that I can better understand what it's doing (for learning purposes).
    What I am looking for is help understand why my current script behaves the way it does.
    Here's my current script:
    #Create a report that shows the created date and latest deployment date for all
    #hosted services (cloud services)deployments in MyAzureSubscription
    Select-AzureSubscription MyAzureSubscription
    $ServiceNames = Get-azureservice
    foreach ($service in $ServiceNames){
    $ServiceName = $service | select -ExpandProperty ServiceName
    $ServiceDateModified = $service | select -ExpandProperty DateModified
    $service |
    get-azuredeployment -ErrorAction SilentlyContinue -ErrorVariable NoDeployment |
    Select @{Name="ServiceName";Expression={$ServiceName}}, DeploymentName, Status, CreatedTime, LastModifiedTime, @{Name="ServiceDateModified";Expression={$ServiecDateModified}}, @{Name="NoDeployment";Expression={$NoDeployment}} |
    Sort-Object -Propert DeploymentName |
    export-csv "outputfile.csv" -notypeinformation -append
    #Test statements below
    #Write-Host "NoDeployment Below:"
    #$Service | select ServiceName | Write-Host
    #Write-Error $NoDeployment
    Write-Host $ServiceName
    The output file only contains a list of servicenames and deployment details for services that do have a deployment.  None of the services that have no deployments are added/exported to the csv file.  However, the "write-host $ServiceName"
    writes ALL the service names in the powershell window, regardless of whether there's a deployment or not.
    What I don't understand is why the Select @{Name="ServiceName";Expression={$ServiceName}} only outputs the service names of services that have deployments instead of ALL service names regardless of whether they have a deployment or not.
    I've already proven that the variable $ServiceName does, at some point, save the ServiceName into the $ServiceName variable by writing it to host on each iteration of the foreach loop.  So why is it ignoring some ServiceNames when outputting/exporting
    to the csv file?
    Thanks!

    Hi Landshrkk,
    The script only outputs the names of the services that have deployments, because the get-azuredeployment cmdlet encounter error and didn't pass the result to select cmdlet, please try the script below:
    $output=@()
    Select-AzureSubscription MyAzureSubscription
    $ServiceNames = Get-azureservice
    foreach ($service in $ServiceNames){
    $ServiceName = $service | select -ExpandProperty ServiceName
    $ServiceDateModified = $service | select -ExpandProperty DateModified
    $s=$service |get-azuredeployment -ErrorAction SilentlyContinue -ErrorVariable NoDeployment
    $output += New-Object PSObject -Property @{
    ServiceName = $ServiceName
    DeploymentName = $s.DeploymentName
    Status = $s.Status
    CreatedTime = $s.CreatedTime
    LastModifiedTime = $s.LastModifiedTime
    ServiceDateModified = $ServiecDateModified
    NoDeployment = $NoDeployment}
    $output|Sort-Object -Propert DeploymentName |export-csv "outputfile.csv" -notypeinformation
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Help on internal preloader script

    Good day guys,
    Anyone could help me on this code.
    stop();
    this.addEventListener(Event.ENTER_FRAME, onPreloading);
    function onPreloading(e:Event):void{
      var total:Number = stage.loaderInfo.bytesTotal;
      var loaded:Number = stage.loaderInfo.bytesLoaded;
      var percent: Number = loaded / total;
      preloaderMC.loaderMC.scaleX = percent;
      preloaderMC.percentText.text = Math.ceil(percent * 100).toString() + "%";
      trace(percent);
    if (total == loaded){
      play();
      this.removeEventListener(Event.ENTER_FRAME, onPreloading);
    I got this code above preloading the main fla with a movieclip that is the preloader it resides on frame 1 both the preloaderMC and the code above.
    The problem goes when I simulate download which would show the preloader runnning but the text with the percent sign animates from 1% - 7% - 11% and back to 0%
    It did'nt animate from 1 - 100%.
    Any help is greatly appreciated.

    That's it embedding fonts.
    But as far as I can remember I did it already but when I copy all objects to another .fla file. I should repeat the embed font.
    I should click the correct answer button here.
    Thanks you Sir

  • Script to drop empty caches

    Hello,
    I'm looking for a way to drop group of empty caches that have specific name pattern, such as xyz-realtime-*.
    Our program dynamically creates temporary caches that after some time have all the objects expired and stay empty. I'm thinking of a reaper script that can run daily, connect to the cluster, find such empty caches and remove them. Would it be even possible?
    Any advise or suggestions will be greatly appreciated.
    Thanks,
    Alex

    You have to write a dynamic SQL cursor WHILE loop:
    http://www.sqlusa.com/bestpractices2008/rebuild-all-indexes/
    Here is the cursor declaration query:
    SELECT * FROM sys.server_principals WHERE name like 'test%'
    Kalman Toth Database & OLAP Architect
    SELECT Query Video Tutorial 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • External preloader script problem

    hi, i'm try to create an external preloader, i've made three layers (the script, one for a funky design of my logo and keep things simple i've also embedded the preloader text in this layer and finally the preloader bar beneath. i've created two frames for each layer, the script has two keyframes, the other layers only have a keyframe first then a standard frame. i can't get it work though, please help. here's the script i'm using on the second keyframe.
    var loader:MovieClipLoader = new MovieClipLoader();
    this.createEmptyMovieClip("Empty_movieclip",1);
    loader.loadClip("Creative-Outrage.swf",Empty_movieclip);
    var preload:Object = new Object();
    loader.addListener(preload);
    preload.onLoadProgress = function (target, loadedBytes, totalBytes){
    if (_root.getBytesTotal() != _root.getBytesLoaded()){
    gotoAndPlay(1);
    else (loadMovie("Creative-Outrage.swf",Empty_movieclip));
    removeMovieClip("Preloader_movieclip");
    Bar_movieclip._xscale=(_root.getBytesLoaded()/_root.getBytesTotal())*100;
    Preloader_movieclip.Loader_text.text=Math.round((_root.getBytesLoaded()/_root.getBytesTota l())*100)+"% Complete";

    try: 
    var loader:MovieClipLoader = new MovieClipLoader();
    this.createEmptyMovieClip("Empty_movieclip",1);
    // move the next line to the end of your code
    loader.loadClip("Creative-Outrage.swf",Empty_movieclip);
    var preload:Object = new Object();
    loader.addListener(preload);
    // the next two lines should be in preload.onLoadProgress
    //Preloader_movieclip.Bar_movieclip._xscale=(loadedBytes/totalBytes)*100;
    //Preloader_movieclip.Loader_text=Math.round((loadedBytes/totalBytes)*100)+"% Complete";
    preload.onLoadProgress = function (target,loadedBytes,totalBytes){
    if (loadedBytes = totalBytes){
    // (loadMovie("Creative-Outrage.swf",Empty_movieclip));  <-- comment out or remove this line
    removeMovieClip("Preloader_movieclip");
    else {
    gotoAndPlay(1);
    it's still not displaying any gradual progress, it just displays the full progress bar immediately even when i simulate a download and it's not loading the external file either.

  • Preloader script

    I am new to scripting, so this is probably a pretty easy fix.
    I have the
    following code for my preloader:
    onClipEvent (load) {
    total = _parent.getBytesTotal();
    onClipEvent (enterFrame) {
    loaded = _parent.getBytesLoaded();
    percent = int(loaded/total*100);
    perc1 = ""+percent+"%";
    gotoAndStop(percent);
    if (loaded == total) {
    _parent.gotoAndPlay(2);
    As of now, the clip loads fine in another swf, but I want
    the clip to start
    playing before is has fully been loaded so that it cuts down
    on the time the
    viewer has to wait, say at 75% loaded, or 65% for example.
    How would I change
    the above code?
    Also, how would I change it to reflect in the percentage as
    well, for example,
    if it starts playing when it is really 65% loaded, how would
    the code change to
    show that it is fully loaded, in the percentage and the full
    loading bar, even
    though it really isn't...
    Does that make sense? Thanks for the help.

    what the 431,405 in your script?

  • How to make my script ignore pages 1 and 2?

    Hi all. I'm a complete beginnger at all of this so thank you in advance for all you're help, I really appreciated it.
    I have a JavaScript that I've been working on, and with help from people on here it's working really well. I uses a combination of GREP expressions and checks the entire document and then applies pre-made Character Style that have been set up in the InDesign Templates. (By the way I'm using CS6).
    My latest problem is that I don't want this to affect page 1 or 2 as the templates are layed out in spreads so these are the front and back cover.
    Is there a way I can get the script to ignore page 1 and 2?
    If not, I thought another way round would be to only have the script run on highlighted text, but I'd prefere to just ignore pages 1 and 2.
    Any and all help would be greatly appreciated.
    Thanks again,
    Scorpio

    Hi Scorpio17523 and Kai,
    > As far as I know, it is not possible to search for specific pages?
    My guess is that you can, in fact, use Pages.itemByRange(2,-1)... in order to reach a valid plural specifier that holds a findGrep (or changeGrep) method—like TextFrame or Paragraph. This is a powerful way to run a GREP query in a single command.
    Say you want to apply some character style (MyCharStyle) to every word that begin with a 'A' or 'a', considering all textframes except those of page 1 and 2 (i.e. index 0 and 1). This can be done in a single pass without any loop, as shown below:
    // Your settings
    var GREP_PATTERN = '\\<[aA][\\l\\u]+';
    var CHAR_STYLE_NAME = 'MyCharStyle';
    // Variables
    var doc = app.activeDocument,
        cStyle = doc.characterStyles.itemByName(CHAR_STYLE_NAME),
        target = doc.pages.itemByRange(2,-1).textFrames.everyItem().paragraphs.everyItem(),
        nr;
    // Set GREP, and run!
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = GREP_PATTERN;
    app.changeGrepPreferences.appliedCharacterStyle = cStyle;
    nr = target.changeGrep().length;
    alert( nr + " expressions have been changed." );
    The important part is:
    target = doc.pages.itemByRange(2,-1).textFrames.everyItem().paragraphs.everyItem()
    This allows to filter page indices 0 and 1 inside the specifier. As a result, target is a 'plural' Paragraph object which represents every desired text and can then invoke its changeGrep() method.
    Note that we could as well invoke changeGrep() from a plural TextFrame—i.e.: ...textFrames.everyItem()—but the GREP command will lead to a runtime error if some textframe of the collection is empty. That issue does not occur if one extends the specifier to ...paragraphs.everyItem()—unless all the frames are empty!
    Hope that helps.
    @+
    Marc

  • Rsync script - ignore some files, include others?

    I am using an rsync script to backup files from one Mac to another. I have the "--ignore-existing" flag set to avoid copying files that haven't changed. However, there are certain files that I ALWAYS want to sync, regardless of whether or not they've changed. Is there a flag that I can add that will allow me to specify the files? They should be easy to run a match on, since they all contain the word "library" somewhere in their filename.

    If I understand correctly, you're synchronizing two iTunes libraries with rsync, while iTunes is running on the receiver, and it doesn't immediately register the changes. That's the expected behavior. iTunes loads its library file when it starts up, and it doesn't expect the library to change during the session unless it makes the change itself. Copying unchanged files will have no effect on that behavior. rsync has no way of notifying iTunes that the library has changed.
    If you want to share an iTunes library between two machines, you have three options: (1) make the library folder an AFP sharepoint; (2) use the synchronization features built into iTunes; or (3) if you insist on changing the library externally, quit and relaunch iTunes on the receiver to make it recognize the changes.

  • SAPUI5 Bootstrap Script Query For Application Cache Buster

    Hi,
    I am trying to implement Application Cache Buster. I am following Fiori Wave2 application structure.
    As Demokit says "To activate the Application Cache Buster the configuration data-sap-ui-appCacheBuster="./" must be added to the bootstrap script of the application page"
    But I don't get where to add the said configuration. I have Component.js(extends ComponentBase), Configuration.js, Main.view.xml and Main.controller.js. I am using "fioriSandboxConfig.json" to run the application.
    Any idea where to add the AppCacheBuster configuration?
    Kind regards,
    Rauf

    I think you have to add it to your index.html:
    <script src="https://sapui5.hana.ondemand.com/sdk/resources/sap-ui-core.js"
      id="sap-ui-bootstrap"
      data-sap-ui-libs="sap.m"
      data-sap-ui-theme="sap_bluecrystal"
      data-sap-ui-appCacheBuster="./">
      </script>
    Kind regards,
    Wouter

  • Another simple bash script to clean pacman cache

    here is a simple script that I have written which cleans pacman cache folder in a way that only the packages which are now "updated" in the repositories, will get removed. This is different from what "pacman -Sc" does. pacman -Sc also removes any package which is not installed, while this script keeps all the packages which are updated whether they are installed or not.
    The functionality is some how like what "apt-get autoclean" does in debian.
    to use this script you need to run it with "list" or "clean" arguments.  you can also use the "help" argument for more help.
    I hope it helps
    #! /bin/bash
    # clcache - This script cleans pacman cache folder in a way that only the packages
    #+ which are now updated in the repositories, will get removed. This is
    #+ different from what "pacman -Sc" does. pacman -Sc also removes any package
    #+ which is not installed, while this script keeps all the packages which are
    #+ updated whether they are installed or not.
    # I have tweaked this script to be as fast as possible, it might still need a
    #+ couple of minutes to compelete based on the size of your cache folder.
    # to use this script you need to run it with "list" or "clean" arguments.
    # you can also use the "help" argument for more help.
    # This script is written by "Ali Mousavi". Please report bugs to [email protected]
    DIR="/var/cache/pacman/pkg" #the default directory of pacman cache.
    ROOT_UID=0 #Only users with $UID 0 have root privilages.
    TMPFILE="/tmp/cache.tmp"
    # Run as root
    if [ "$UID" -ne "$ROOT_UID" ]
    then
    echo "Must be root to run this script"
    exit 1
    fi
    # Check for the arguments
    if [ -z "$1" ]
    then
    echo -e 'What should I do?\nValid Argument are "list", "clean" or "help"'
    exit 1
    elif [ "$1" = "list" ]
    then
    ACTION="ls"
    MESSAGE="Are you sure you want to continue?"
    elif [ "$1" = "clean" ]
    then
    ACTION="rm -vf"
    MESSAGE="Are you sure you want to remove outdated packages? This process can not be undone!"
    elif [ "$1" = "help" -o "$1" = "-h" -o "$1" = "--help" ]
    then
    echo -e "This script checks the packages in your pacman cache directory and removes the packages that are outdated. It doesn't matter if the package is installed or not.\n\n3 arguments can be passed to the script:\n\nlist:\n\tchecks for package that are outdated and prints the names.\n\nclean:\n\tremoves outdated packages.\n\nhelp,-h,--help:\n\tprints this help text.\n\nThis script is written by \"Ali Mousavi\". Please report bugs to [email protected]"
    exit 0
    else
    echo 'Valid Argument are "list", "clean" or "help"'
    exit 1
    fi
    # Check if the user is sure!
    echo "This might take a while based on the amount of cached packages."
    echo -n "$MESSAGE(y/n) "
    read ANS
    if [ $ANS = "y" -o $ANS = "Y" -o $ANS = "yes" ]
    then
    echo "Processing packages..."
    elif [ $ANS = "n" -o $ANS = "N" -o $ANS = "No" ]
    then
    echo "Exiting on user request"
    exit 0
    else
    echo "Invalid answer"
    exit 1
    fi
    # Process the packages
    cd $DIR #change to cache directory.
    pacman -Sl | awk '{ print $2" "$3; }' > $TMPFILE
    for f in $(ls $DIR)
    do
    pname=$(file $f | cut -d: -f1) #Produces filename, like: fetchmail-6.3.19-1-i686.pkg.tar.xz"
    spname=$(echo $pname | sed 's/-[0-9][0-9]*.*//g') #removes package version: fetchmail
    pver=$(echo $pname | sed 's/.*-\([0-9\-\.][0-9\-\.]*-[0-9\-\.][0-9\-\.]*\).*/\1/g') #using pacman -Qi for all files takes a lot of time.
    if [ $(echo $pver | grep '[^0-9\-\.\-\-]' | wc -l) != 0 ] #checks if package version is alright
    then
    pver=$(pacman -Qpi $f | grep Version | awk '{print $3}')
    fi
    newpver=$(grep -e "^$spname " $TMPFILE | awk '{ print $2 }')
    if [[ $newpver != $pver ]]
    then
    $ACTION $f
    fi
    done
    rm -f $TMPFILE
    echo "Outdated packages processed successfully!"
    exit 0
    Last edited by tuxitop (2011-09-13 09:24:26)

    tuxitop wrote:# Check for the arguments
    if [ -z "$1" ]
    then
    echo -e 'What should I do?\nValid Argument are "list", "clean" or "help"'
    exit 1
    elif [ "$1" = "list" ]
    then
    ACTION="ls"
    MESSAGE="Are you sure you want to continue?"
    elif [ "$1" = "clean" ]
    then
    ACTION="rm -vf"
    MESSAGE="Are you sure you want to remove outdated packages? This process can not be undone!"
    elif [ "$1" = "help" -o "$1" = "-h" -o "$1" = "--help" ]
    then
    echo -e "This script checks the packages in your pacman cache directory and removes the packages that are outdated. It doesn't matter if the package is installed or not.\n\n3 arguments can be passed to the script:\n\nlist:\n\tchecks for package that are outdated and prints the names.\n\nclean:\n\tremoves outdated packages.\n\nhelp,-h,--help:\n\tprints this help text.\n\nThis script is written by \"Ali Mousavi\". Please report bugs to [email protected]"
    exit 0
    else
    echo 'Valid Argument are "list", "clean" or "help"'
    exit 1
    fi
    1. `echo -e 'foo\nbar\nbaz'` gets long and unreadable quickly. Instead, use here documents:
    cat <<EOF
    What should I do?
    Valid Argument are "list", "clean" or "help"
    EOF
    2. Use a case command, looks cleaner:
    case "$1" in
    list) ... ;;
    clean) ... ;;
    help|-h|--hep) ... ;;
    # Check if the user is sure!
    echo "This might take a while based on the amount of cached packages."
    echo -n "$MESSAGE(y/n) "
    read ANS
    if [ $ANS = "y" -o $ANS = "Y" -o $ANS = "yes" ]
    then
    echo "Processing packages..."
    elif [ $ANS = "n" -o $ANS = "N" -o $ANS = "No" ]
    then
    echo "Exiting on user request"
    exit 0
    else
    echo "Invalid answer"
    exit 1
    fi
    Try:
    read -p "hello: " -r
    echo $REPLY
    And again, `case` should be cleaner in this case.
    # Process the packages
    cd $DIR #change to cache directory.
    pacman -Sl | awk '{ print $2" "$3; }' > $TMPFILE
    While you quoted a lot, you left these two out. "$DIR" and "$TMPFILE" should be quoted, otherwise whitespaces will break the code.
    for f in $(ls $DIR)
    Apart from the same missing quotes, calling `ls` is a waste here. The following is sufficient and (maybe surprisingly) more accurate:
    for f in *
    How is it more accurate? Run this test script:
    #!/bin/bash
    DIR=/tmp/foo
    mkdir -p "$DIR"
    cd "$DIR"
    touch a\ b c$'\n'd
    for i in *; do
    printf '+%s+\n' "$i"
    done
    printf '%s\n' ---
    for i in $(ls $DIR); do
    printf '+%s+\n' "$i"
    done
    Let's not go too far here. Just get the idea.
    do
    pname=$(file $f | cut -d: -f1) #Produces filename, like: fetchmail-6.3.19-1-i686.pkg.tar.xz"
    Calling `file` here is, again, unnecessary. Also, filename of a package can contain ":", e.g., vi-1:050325-1-i686.pkg.tar.xz, which breaks your code.
    Don't complicate things:
    pname=$f
    spname=$(echo $pname | sed 's/-[0-9][0-9]*.*//g') #removes package version: fetchmail
    Broken for ntfs-3g-2011.4.12-1-i686.pkg.tar.xz, nvidia-173xx-utils-173.14.31-1-i686.pkg.tar.xz, etc...   Something less lousy:
    sed 's/\(-[^-]\+\)\{3\}$//' <<< "$pname"
    pver=$(echo $pname | sed 's/.*-\([0-9\-\.][0-9\-\.]*-[0-9\-\.][0-9\-\.]*\).*/\1/g') #using pacman -Qi for all files takes a lot of time.
    Although this might work for now, this would break if we had an architecture that starts with a digit, e.g. 686.  Something less lousy:
    sed 's/\(.*\)-\([^-]\+-[^-]\+\)-[^-]\+$/\2/' <<< "$pname"
    if [ $(echo $pver | grep '[^0-9\-\.\-\-]' | wc -l) != 0 ] #checks if package version is alright
    then
    pver=$(pacman -Qpi $f | grep Version | awk '{print $3}')
    fi
    Again, calling `wc` here is a waste. Anyway, why is this check necessary at all?
    newpver=$(grep -e "^$spname " $TMPFILE | awk '{ print $2 }')
    if [[ $newpver != $pver ]]
    then
    $ACTION $f
    fi
    done
    rm -f $TMPFILE
    echo "Outdated packages processed successfully!"
    exit 0
    The post is getting too long, so so much from me. If there's anything you don't understand yet, read bash(1).
    If I sound harsh or anything, don't be discouraged. Just keep reading, keep improving.
    Last edited by lolilolicon (2011-09-13 12:53:04)

  • My InDesign to PDF script ignores warnings, but I need to change that.

    Hello,
    I have a script here that converts InDesign Docs to PDF files.
    It works fine and was created to make bulk pdf's regardles of missing images.
    Now I want to revise it so that it does stop for missing fonts and images.
    This script also was built for quark and I can see where I could remove the supress all warnings dialog to remove it for the quark part, but I can't figure out where that warning is in the InDesign part to remove it.
    Here is the script: If anyone can help me find out where this line of code is that I could remove, so that the script does stop if there are missing fonts and images, that would be great!!
    property Babs_Folder : "Babs PDF Folder"
    global deskPath
    global PathToFolder
    global PathToFolder2
    global tempPictures
    on open thefiles
        tell application "Finder"
            activate
            set tempPictures to (every item of (get selection)) -- MUST GET BEFORE MAKING FOLDERS
            if not (exists folder Babs_Folder) then make new folder with properties {name:Babs_Folder}
            set deskPath to desktop as text
            set PathToFolder to POSIX path of (deskPath & Babs_Folder)
            set PathToFolder2 to deskPath & Babs_Folder & ":"
        end tell
        my openfiles()
        say "Finished"
    end open
    on openfiles()
        try
            tell application "Finder"
                repeat with LoopFiles in tempPictures
                    set foundImages to {}
                    if kind of LoopFiles = "Folder" then
                        try
                            set foundImages to files of entire contents of LoopFiles as list
                        on error
                            set foundImages to files of entire contents of LoopFiles
                        end try
                    else
                        if kind of LoopFiles is not in {"Volume", "Disk Image", "Application", "Web Internet Location", "Document", "Text Clipping"} then
                            set end of foundImages to LoopFiles
                        end if
                    end if
                    --set WorkingFile to item i of fileList
                    repeat with WorkingFile in foundImages
                        if not ((kind of WorkingFile starts with "Quark") or (kind of WorkingFile starts with "InDesign")) then
                            activate
                            display dialog "This file is not an InDesign or Quark document!" buttons "Skipping" default button "Skipping" with icon 0 giving up after 1
                        else
                            --Determine whether to use InDesign subroutines or Quark subroutines
                            if (kind of WorkingFile starts with "InDesign") then -- Process as InDesign
                                my createInDesignPDF(WorkingFile, PathToFolder2)
                            else -- Process as Quark
                                my createQuarkPDF(WorkingFile)
                            end if
                        end if
                    end repeat
                end repeat
            end tell
        on error errmsg
            display dialog "OpenFiles." & return & errmsg giving up after 20
        end try
    end openfiles
    on createInDesignPDF(WorkingFile, savePath)
        set x to 0
        repeat
            if x = 0 then
                set newpart to ""
            else
                set newpart to " " & x
            end if
            tell application "Finder"
                set tempname to my add_extension(WorkingFile, newpart, "pdf")
                if not (exists file tempname in folder Babs_Folder) then exit repeat
            end tell
            set x to x + 1
        end repeat
        tell application "Adobe InDesign CS3"
            try
                try
                    set user interaction level of script preferences to never interact
                end try
                open WorkingFile as alias
                delay 2
                repeat
                    if exists document 1 then exit repeat
                    delay 0.2
                end repeat
                set theProps to properties of PDF export preset "[Press Quality]"
                set newProps to {view PDF:false, crop marks:false, bleed marks:false, color bars:false, registration marks:false} & theProps
                set oldProps to properties of PDF export preferences
                set properties of PDF export preferences to newProps
                export front document format PDF type to (savePath & tempname) without showing options
                set properties of PDF export preferences to oldProps
                delay 1
                tell documents to close saving no
                try
                    set user interaction level of script preferences to interact with all
                end try
            on error errmsg
                display dialog "CreateIndesignPDF." & return & errmsg giving up after 20
            end try
        end tell
    end createInDesignPDF
    on createQuarkPDF(WorkingFile)
        try
            set x to 0
            repeat
                if x = 0 then
                    set newpart to ""
                else
                    set newpart to " " & x
                end if
                tell application "Finder"
                    set tempname to my add_extension(WorkingFile, newpart, "pdf")
                    if not (exists file tempname in folder Babs_Folder) then exit repeat
                end tell
                set x to x + 1
            end repeat
            tell application "QuarkXPress"
                activate
                open WorkingFile as alias with Suppress All Warnings
                tell application "System Events" to tell process "QuarkXPress"
                    click menu item "Layout as PDF..." of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
                    delay 1
                    keystroke tempname
                    delay 1
                    keystroke "G" using {shift down, command down}
                    delay 1
                    keystroke PathToFolder
                    delay 1
                    click button "Go" of sheet 1 of window "Export as PDF"
                end tell
                repeat 2 times
                    delay 1
                    activate
                    tell application "System Events" to tell process "QuarkXPress"
                        try
                            if exists button "OK" of window 1 then
                                click button "OK" of window 1
                            end if
                        end try
                    end tell
                end repeat
                delay 1
                tell application "System Events" to tell process "QuarkXPress"
                    try
                        click button "Save" of window "Export as PDF"
                    end try
                end tell
                repeat 4 times
                    delay 1
                    activate
                    tell application "System Events" to tell process "QuarkXPress"
                        try
                            if exists button "OK" of window 1 then
                                click button "OK" of window 1
                            end if
                        end try
                        try
                            if exists button "List Profiles" of window 1 then
                                click button "Continue" of window 1
                            end if
                        end try
                    end tell
                end repeat
                delay 2
                close front document saving no
            end tell
        on error errmsg
            display dialog "CreateQuarkPDF." & return & errmsg giving up after 20
        end try
    end createQuarkPDF
    on add_extension(WorkingFile, new_part, new_extension)
        try
            set this_info to info for WorkingFile as alias
            set this_name to the name of this_info
            set this_extension to the name extension of this_info
            if this_extension is missing value then
                set the default_name to this_name
            else
                set the default_name to text 1 thru -((length of this_extension) + 2) of this_name
            end if
            return (the default_name & new_part & "." & the new_extension)
        on error errmsg
            display dialog "add extension " & return & errmsg
        end try
    end add_extension
    thanks!!!
    babs

    Hello,
    OK-I had then blew it... ;-(
    I was playing with a combination of removing (commenting out those two try areas you suggested), and that didn't do it on its own. It didn't do anything, it just said finished.
    Then I found this in the dictionary ( set alert missing images to true) and added it to the script below. See my changes in Bold.
    At one point, I was able to get the missing images dialog box. Then I don't know what happened, I think I tried to turn one of the try areas back on to test it, and then it stopped giving me that dialog box and only the one being asked in that on error errmsg - display dialog "CreateIndesignPDF." & return & errmsg giving up after 20,  was showing up.
    I commented out what I thought I had  changed, but even after compiling and re-saving, I can't seem to get the missing images dialog box to show???
    any thoughts?
    thanks!!!
    babs
    property Babs_Folder : "Babs PDF Folder"
    global deskPath
    global PathToFolder
    global PathToFolder2
    global tempPictures
    on open thefiles
        tell application "Finder"
            activate
            set tempPictures to (every item of (get selection)) -- MUST GET BEFORE MAKING FOLDERS
            if not (exists folder Babs_Folder) then make new folder with properties {name:Babs_Folder}
            set deskPath to desktop as text
            set PathToFolder to POSIX path of (deskPath & Babs_Folder)
            set PathToFolder2 to deskPath & Babs_Folder & ":"
        end tell
        my openfiles()
        say "Finished"
    end open
    on openfiles()
        try
            tell application "Finder"
                repeat with LoopFiles in tempPictures
                    set foundImages to {}
                    if kind of LoopFiles = "Folder" then
                        try
                            set foundImages to files of entire contents of LoopFiles as list
                        on error
                            set foundImages to files of entire contents of LoopFiles
                        end try
                    else
                        if kind of LoopFiles is not in {"Volume", "Disk Image", "Application", "Web Internet Location", "Document", "Text Clipping"} then
                            set end of foundImages to LoopFiles
                        end if
                    end if
                    --set WorkingFile to item i of fileList
                    repeat with WorkingFile in foundImages
                        if not ((kind of WorkingFile starts with "Quark") or (kind of WorkingFile starts with "InDesign")) then
                            activate
                            display dialog "This file is not an InDesign or Quark document!" buttons "Skipping" default button "Skipping" with icon 0 giving up after 1
                        else
                            --Determine whether to use InDesign subroutines or Quark subroutines
                            if (kind of WorkingFile starts with "InDesign") then -- Process as InDesign
                                my createInDesignPDF(WorkingFile, PathToFolder2)
                            else -- Process as Quark
                                my createQuarkPDF(WorkingFile)
                            end if
                        end if
                    end repeat
                end repeat
            end tell
        on error errmsg
            display dialog "OpenFiles." & return & errmsg giving up after 20
        end try
    end openfiles
    on createInDesignPDF(WorkingFile, savePath)
        set x to 0
        repeat
            if x = 0 then
                set newpart to ""
            else
                set newpart to " " & x
            end if
            tell application "Finder"
                set tempname to my add_extension(WorkingFile, newpart, "pdf")
                if not (exists file tempname in folder Babs_Folder) then exit repeat
            end tell
            set x to x + 1
        end repeat
        tell application "Adobe InDesign CS3"
            try
               --try
                --set user interaction level of script preferences to never interact
                --end try
                open WorkingFile as alias
                set alert missing images to true
                delay 2
                repeat
                    if exists document 1 then exit repeat
                    delay 0.2
                end repeat
                set theProps to properties of PDF export preset "[Press Quality]"
                set newProps to {view PDF:false, crop marks:false, bleed marks:false, color bars:false, registration marks:false} & theProps
                set oldProps to properties of PDF export preferences
                set properties of PDF export preferences to newProps
                export front document format PDF type to (savePath & tempname) without showing options
                set properties of PDF export preferences to oldProps
                delay 1
                tell documents to close saving no
                --try
                --set user interaction level of script preferences to interact with all
                --end try
            on error errmsg
                display dialog "CreateIndesignPDF." & return & errmsg giving up after 20
            end try
        end tell
    end createInDesignPDF
    on createQuarkPDF(WorkingFile)
        try
            set x to 0
            repeat
                if x = 0 then
                    set newpart to ""
                else
                    set newpart to " " & x
                end if
                tell application "Finder"
                    set tempname to my add_extension(WorkingFile, newpart, "pdf")
                    if not (exists file tempname in folder Babs_Folder) then exit repeat
                end tell
                set x to x + 1
            end repeat
            tell application "QuarkXPress"
                activate
                open WorkingFile as alias with Suppress All Warnings
                tell application "System Events" to tell process "QuarkXPress"
                    click menu item "Layout as PDF..." of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
                    delay 1
                    keystroke tempname
                    delay 1
                    keystroke "G" using {shift down, command down}
                    delay 1
                    keystroke PathToFolder
                    delay 1
                    click button "Go" of sheet 1 of window "Export as PDF"
                end tell
                repeat 2 times
                    delay 1
                    activate
                    tell application "System Events" to tell process "QuarkXPress"
                        try
                            if exists button "OK" of window 1 then
                                click button "OK" of window 1
                            end if
                        end try
                    end tell
                end repeat
                delay 1
                tell application "System Events" to tell process "QuarkXPress"
                    try
                        click button "Save" of window "Export as PDF"
                    end try
                end tell
                repeat 4 times
                    delay 1
                    activate
                    tell application "System Events" to tell process "QuarkXPress"
                        try
                            if exists button "OK" of window 1 then
                                click button "OK" of window 1
                            end if
                        end try
                        try
                            if exists button "List Profiles" of window 1 then
                                click button "Continue" of window 1
                            end if
                        end try
                    end tell
                end repeat
                delay 2
                close front document saving no
            end tell
        on error errmsg
            display dialog "CreateQuarkPDF." & return & errmsg giving up after 20
        end try
    end createQuarkPDF
    on add_extension(WorkingFile, new_part, new_extension)
        try
            set this_info to info for WorkingFile as alias
            set this_name to the name of this_info
            set this_extension to the name extension of this_info
            if this_extension is missing value then
                set the default_name to this_name
            else
                set the default_name to text 1 thru -((length of this_extension) + 2) of this_name
            end if
            return (the default_name & new_part & "." & the new_extension)
        on error errmsg
            display dialog "add extension " & return & errmsg
        end try
    end add_extension

  • Preloader Script Problem

    Hi;
    Please advise on this error:
    Scene 1, Layer 'PreLoader', Frame 1, Line 1
    1087: Syntax Error: extra characters found after end of program
    onClipEvent (enterFrame) {
            loading = _parent.getBytesLoaded();
            total = _parent.getBytesTotal();
        if (percent == undefined) percent = 0;
            percent -= (percent-((loading/total)*100))*.25;
            per = int(percent);
            percentage = per+"%";
            loadBar._width = per;
            if (percent>99) {
                    _parent.gotoAndStop(2);
    TIA,
    beno

    that's as2 and in as2 that code would have to be attached to a movieclip, not a timeline.
    in as3, no code can be attached to an object.  as3 does have an enterframe event.
    attached to your main timeline:
    this.addEventListener(Event.ENTER_FRAME,f);
    var percent:Number=0
    function f(e:Event){
        var loading:uint = loaderInfo.bytesLoaded;
            var total:uint = loaderInfo.bytesTotal;
            percent -= (percent-((loading/total)*100))*.25;
            loadBar.width = percent;
            if (percent>99) {
           gotoAndStop(2);

  • Preload DB tables into Coherence Cache using HibernateDataStore

    Hi,
    I am trying to use Hibernate just to pre-load my database tables [reference data with millions of rows] into coherence cache [as pojos]. I started looking at the configuration file from the below link -
    http://coherence.oracle.com/display/COH35UG/Using+Hibernate+as+a+CacheStore+for+Coherence
    and could not grab much from there.
    Can someone plz provide clean steps on how i can use hibernate to pre-load my database tables into coherence. An example with pojo would be very helpful?
    Thank You,
    Jagadeesh.

    Hi, Steve
    Thanks for the information. I did look at the document regarding CacheLoader and read-through and read-ahead.
    I have the question based on the above info.
    1. Currently I am using Built-in CacheStore implementation: JPA CacheStore.
    Here is the configuration in persistance.xml.
    <backing-map-scheme>
    <read-write-backing-map-scheme>
    <!--
    Define the cache scheme
    -->
    <internal-cache-scheme>
    <local-scheme/>
    </internal-cache-scheme>
    <cachestore-scheme>
    <class-scheme>
    <class-name>com.tangosol.coherence.jpa.JpaCacheStore</class-name>
    <init-params>
    JpaCacheStore extends JpaCacheLoader and implments CacheStore interface.
    so in JpaCacheLoader, it has load and loadAll method implementation.
    Can I confirm in my case, i shouldn't do anything else regarding the read-through?
    Cheers
    Julia

Maybe you are looking for

  • Aperture 3 book preview: Always WYSIWYG compared to the print?

    I have found that the Aperture photo book previews of identical images differ significantly depending on the file type.  This came to my attention when I compared .jpg images to RAW images on the same page.  The reds and resulting skin tones were ver

  • Prime Infrastructure 2.1 Compliance Licensing

    Till Date LMS and Cisco Prime Infrastructure are standalone applications and do not operate in sync. If you deploy a new application server for LMS, it will be working separately and you can have its compliance manager running with this license appli

  • OS X Yosemite - iPhoto v.9.6, library needs upgrade

    Hi there, My apologies if this Q has been answered before - I've failed to find a response in the relevant discussions: I installed OS X Yosemite some months ago. Since then, every time I wish to open my iPhoto v.9.6, the following window pops-up: "T

  • IPod nano (black)

    Hey, Thinking of getting the black iPod nano. Would love to ehar forma ctual users in regards to design, general experience and personal thoughts. Did you regret it or are happy about it? Chris

  • Why must I reboot my Mac to switch between iTunes libraries?

    AppleTV 2 can always see the libraries but choosing "the wrong one" gives me the error message about not being able to connect. We have two OS X user accounts, different iTunes libraries, both setup with the same AppleID. I have to reboot my Mac and