Variable loop AppleScript

Hi, I have a script that works with the .txt file and takes a number, do a little with her in the loop and should create a new file where to save the results of calculation. Now my script can open a file, see a words it contains, add a certain number of words. But I didn't know how I can send results to loop to another file or as a result. For example, loop works with the file, which have four numbers as text. Loop takes a number, second, third, but as result remember fourth result only.

Open a txt file, it cannot because the file is already open and loop takes a number to it, if I try to create a second file, applescript takes error.

Help, please

loop at the bottom of the script

thisFile to Choose file with guest "choose an image file:

say application "Imagine the Photo.

the value thisImporter for import graphics thisFile

if the component error of thisImporter is not equal to 0 then

thisImporter close

display the dialog box "Not an image file that quicktime recognizes."

return

end if

the value {x, y, xDim, yDim} to the limits natural of thisImporter

define thisDocument to make new document window properties {size: {xDim, yDim}}

the value the destination of thisImporter to thisDocument drawing

thisImporter trace

thisImporter close

-The section which follows should be replaced according to the pixel value class

the value pixelValueRect to {x, y, xDim, yDim}

the value pixelValues1 to get the pixel values of thisDocument with properties {class of pixel values:pixel in the rectangle, rectangle boundaries: pixelValueRect}

thisDocument close

-class (pixel points) as a list

-' class pCol' as a list - цвета координаты разнесены по классам с именами, приводим к списку и

end say

say application "Imagine the Photo.

-the value pixelValues1...

the value t to my to_s (pixelValues1)

end say

say application "TextEdit".

say (do in new document)

the value sa text to t

end say

end say

on to_s (a)

(*

a: nothing

Returns the Unicode text: textual representation of a

*)

local astid0

point of the value astid0 to AppleScript text delimiters

Try

{'class AAAA ': a}class BBBB ".

on error t - t = "could not get 'category BBBB' of {"YYYY category": a}.

Try

the value Point text delimiters to AppleScript {' {"YYYY category":} "}

the value t to t text elements 2 thru -1 as Unicode text

the value {"Point text delimiters to AppleScript {" "}"}

the value t to t elements text 1 thru -2 as Unicode text

the value Point text delimiters to AppleScript astid0

back t - t = a, which is in Unicode text

on error number errn errs

the value Point text delimiters to AppleScript astid0

error number errn errs

end try

end try

end to_s

say application "TextEdit".

say front document

say STI text - NB "sound." We need the reference TextEdit, not the text itself.

-Remove (paragraphs-3 thru - 1).

the value noneedenttext to (shift of "pixel points" (it as text)) + 13-"he text" should that "offset" because the actual text.

the value noneedenttext1 to (shift of "colors of the pixels" (it as text)) - 2-"he text" should that "offset" because the actual text.

the value noneedenttext2 to (shift of "colors of the pixels" (it as text))-16

delete (characters 1 thru noneedenttext)

delete (characters noneedenttext1 via noneedenttext2)

game of nonech to (shift of '}} ' (it as text)) определяем - лишние скобки за координатами

game of nonech1 to (shift of "}}}" (it as text))-определяем лишние скобки за цветами

delete (character nonech) стираем - нахуй

delete (characters (nonech1 - 1) through the intermediary of nonech1) стираем - нахуй

display the dialog box "Количество цветов в картинке от 2 12 dizinine Введите" answer "4" buttons by default {"OK"} default button 1

copy the result list to {button_res, value_res}

If button_res is 'OK' then

the value colors_inpic to the value_res

-put words of the doc is key word to keyword_repl

the value color_span to 65000 / colors_inpic - определяем сколько делить цифру для упрощения количества цветов цвета на

end if

the value word_count to count words of (he text you thong)

define character_count to count characters of (he text you thong)

the value pixel_amount to the word_count / 5 as number - количество пискселей

the value word_pixels to the word_count / 2.5 - количество слов-координат

the value pixel_data to words 1 thru word_pixels - String оставить, все ряд одно число как в пишет если

the value pixel_col of words (word_pixels + 1) thru -1 + 1 значит без последнего слова конца dizinine знаит-1

game counter to 1

the value ad_i to 1

-say (brand new)

Pixel_amount repeat them time

the value x to Word (counter) in whole

the value y of Word (compared with + 1) in whole

game from r to ((Word ((word_pixels + ad_i))) / color_span) as integer

the value of g to ((Word ((word_pixels + ad_i + 1))) / color_span) as integer

game from b to ((Word ((word_pixels + ad_i + 2))) / color_span) as integer

game of full_pixel to x & "" & y & "" & r & "" & g & "" & b

value counter to the counter + 2

the value ad_i to the ad_i + 3

Display alert "" & full_pixel

-set its text on full_pixel

end Repeat

-end tell

end say

end say

end say

It is not quite clear to me what it is you are trying to do - and your script is very specific to your needs, so it is not obvious.

Can you explain more what you're trying to do - specifically what data you have ('4 integers"?) and what you try to do with them (write them to a file)?

Can you give an example of what might be your input values (for example a list: {123 456 789, 4.321} and you want the output file to look like?)

Tags: Mac OS & System Software

Similar Questions

  • Automator - using variables in applescript do script

    How can I insert a variable in 'doing the script' in AppleScript? I want repoName be what is the variable.

    the term {parameters}

    Tell application "Terminal".

    activate

    Set currentTab to script ("ssh [email protected];")

    delay of 6

    do script (' cd... /.. ") ("/ var/www ') in currentTab

    delay of 6

    RepoName text set

    make the script currentTab ('sudo mkdir $repoName")

    tell the end

    end of race

    Figured it out:

    the term {parameters}

    Tell application "Terminal".

    activate

    Set currentTab to script ("ssh [email protected];")

    delay 3

    do script (' cd... /.. ") ("/ var/www ') in currentTab

    delay 3

    Define repoName (enter text)

    do script ('sudo mkdir") & repoName in currentTab

    tell the end

    end of race

    The key is the & symbol, which concatenates.

  • Move the JavaScript Variable to AppleScript

    Hi all

    My request is zip file.

    I create the file using Javascript and the variable is "Chemin_dossier"

    As for the zip, I pass the variable chemin_dossier to the AppleScript. But not success.

    Help, please

    Concerning

    Siraj

    Take a look at scripts args;

    var main = function() {
      app.scriptArgs.setValue ("path", "/path/to/folder" );
    
      var scpt  = 'tell application "Adobe InDesign CC 2015"\
      tell script args\
      set v to get value name "path"\
      display dialog  v\
      end tell\
      end tell';
    
      app.doScript ( scpt, ScriptLanguage.applescriptLanguage );
    }
    
    main();
    

    HTH

    Loïc

    Ozalto | Productivity-oriented - Loïc Aigon

  • Variable + Loop = "undefined".

    Hello

    I want to make that a single loop in my animation and then continue.

    To do this, I added a trigger on my calendar and added this code:

    if (typeof oneLoop == 'undefined') {
      var oneLoop = true;
    }
    
    if (oneLoop) {
      oneLoop = false;
      sym.play(0);
    }
    

    But the loop is infinite because the variable resets.

    How to do?

    I'd do it quite differently, but hey, I like different.

    in compositionReady, add:

    isplaying = 1;

    SYM. Play();

    on the section where you want to loop:

    {if(IsPlaying==1)}

    SYM. Play (0);

    isplaying = 0;   change the value of the variable to 0 so it will not loop again.

    }

  • Is it possible to rename the variable loop for I?

    I do a lot of work with 2D arrays.  Sometimes, it would be useful when browsing the tables for one of the index named i and the other named j.  Is it possible to change the name of the variable increment other than what actually in another variable?

    Thnaks.

    Hummer1,

    As already said, there is no way to change the image of the final iteration.  However, you can add a description to the wire.  Click with the right button on the wire, then select "Description and Tip", type the name/description you want in the box.  Now you can move your mouse over the wire, and the description will appear in the context-sensitive Help window.  I hope this helps.

    Chris M

  • document.variables.removeAll)

    Using CS5, I would like to remove all the variables that appear in a panel of document variables, so that newcomers can be put in without any error happening. But removing them causes an error of Illustrator. After inspection of the OMV, document.variables is a read-only element. Why is it a removeAll(), at all, or are there other ways to achieve this goal?

    I had the same problem with other collections thrown errors with removeAll() as well, I just tried to delete all sets of data and that works fine, so not all readOnly collections I have this problem.

    for variables, loop through them and remove one by one.

  • New-VM hangs over the background task

    I am writing a script to automate some vm deployment and am having some problems with a background task.  If I run the code below, the new - vm command hangs and does not always complete the task.  I have to manually kill the jobs to get them to stop.  The next set of code below which is exactly the same thing, but not in a separate post and it works fine.  I am running the script on a windows 7, Powershell 3.0, esx server 5.1, 5.5 powercli. Any ideas? I have attached two scripts below as well. Any help would be appreciated.

    ########################################################

    #********************Add Snapin*************************

    #Import module PowerCLI

    Add-PSSnapin VMware.VimAutomation.Core

    #Update the title bar

    $host.ui.rawui.WindowTitle = "PowerShell [PowerCLI loaded Module] '"

    ########################################################

    #Declare high-level Script Varibles

    $vcserver

    $userName

    $SecurePassword

    $connectionUp = 0

    $Credentials

    While (0, $connectionUp - eq)

    {

    Variable #Set for Vcenter connection

    $vcserver = Read-Host "Vcenter Server you want to connect to?

    $userName = Read-Host "enter user name".

    $SecurePassword = Read-Host-Prompt "enter password" - AsSecureString

    $Credentials = new-Object System.Management.Automation.PSCredential '

    -ArgumentList $UserName, $SecurePassword

    $connectionUp = 0

    try {}

    # Set all errors to be a stop action

    $ErrorActionPreference = "stop".

    #Connect to the vCenterServer

    SE connect-VIServer-Server $vcserver - Credential $Credentials

    $connectionUp ++

    }

    catch {}

    #Connection failed

    "Unable to connect".

    $connectionUp = 0

    }

    #Set that all default return errors

    $ErrorActionPreference = "continue".

    }

    ########################################################

    ########################################################

    #*** Menu variables *.

    #Title and Message

    $title = "deploy the virtual machine.

    $message = "select Action".

    #Creates menu options (new options should be added in the table down below)

    $UsVm = new-Object System.Management.Automation.Host.ChoiceDescription '& US' "

    "Creates US VM."

    $Eu = new - Object System.Management.Automation.Host.ChoiceDescription '& Europe' "

    "Creates the VM Europe."

    "$exit = New-Object System.Management.Automation.Host.ChoiceDescription" & quit ","

    "Exits Script."

    #Creates the table of options

    $options = [System.Management.Automation.Host.ChoiceDescription []] ($UsVm, $Eu, $exit)

    ###########################################################

    Variable Loop #End

    $running = 0

    #Loops the Menu up to what the exit option is chosen

    While ($running - eq 0) {}

    #Creates the Menu object

    $menu = $host.ui.PromptForChoice ($title, $message, $options, 0)

    switch ($menu)

    {

    {0}

    Machine virtual #Deploy U.S.

    # Include variables for the virtual machine.

    $vmName = Read-Host "what is the name of the virtual machine?

    Start-Job - ScriptBlock {}

    SE connect-VIServer-Server $args [2] - Credential $args [1]

    $cluster = get-Cluster-name "VDI Workstations - VCA Sandy Bridge - (HA, DRS)"

    $template = get-Template-name "ViewWin7Template".

    $custSpecifacation = get-OSCustomizationSpec-name 'Standard of Windows 7 desktop.

    $dataStoreCluster = get-DatastoreCluster-name of 'VDI SAN Production'

    $location = get-file-name 'Mobile computers to office (MD).

    $DeployVmName = $args [0]

    $DeployedVmName = $DeployVmName

    New-VM-name $DeployedVmName - location $location - model $template - ResourcePool Datastore - $dataStoreCluster - OSCustomizationSpec $custSpecifacation $cluster - slim DiskStorageFormat

    Start-Sleep - s 60

    Start-VM $DeployedVmName

    } - InitializationScript {Add-PSSnapin VMware.VimAutomation.Core} - ArgumentList $vmName, $Credentials, $vcserver

    }

    1 {"you selected KAY."}

    2 {$running = 1}

    }

    }

    Here's the script according to which works very well

    #Import module PowerCLI

    Add-PSSnapin VMware.VimAutomation.Core

    #Update the title bar

    $host.ui.rawui.WindowTitle = "PowerShell [PowerCLI loaded Module] '"

    #Declare high-level Script Varibles

    $vcserver

    $userName

    $SecurePassword

    $connectionUp = 0

    $Credentials

    While (0, $connectionUp - eq)

    {

    Variable #Set for Vcenter connection

    $vcserver = Read-Host "Vcenter Server you want to connect to?

    $userName = Read-Host "enter user name".

    $SecurePassword = Read-Host-Prompt "enter password" - AsSecureString

    $Credentials = new-Object System.Management.Automation.PSCredential '

    -ArgumentList $UserName, $SecurePassword

    $connectionUp = 0

    try {}

    # Set all errors to be a stop action

    $ErrorActionPreference = "stop".

    #Connect to the vCenterServer

    SE connect-VIServer-Server $vcserver - Credential $Credentials

    $connectionUp ++

    }

    catch {}

    #Connection failed

    "Unable to connect".

    $connectionUp = 0

    }

    #Set that all default return errors

    $ErrorActionPreference = "continue".

    }

    $vmName = Read-Host "what is the name of the virtual machine?

    $cluster = get-Cluster-name "VDI Workstations - VCA Sandy Bridge - (HA, DRS)"

    $template = get-Template-name "ViewWin7Template".

    $custSpecifacation = get-OSCustomizationSpec-name 'Standard of Windows 7 desktop.

    $dataStoreCluster = get-DatastoreCluster-name of 'VDI SAN Production'

    $location = get-file-name 'Mobile computers to office (MD).

    $DeployedVmName = $vmName

    New-VM-name $DeployedVmName - location $location - model $template - ResourcePool Datastore - $dataStoreCluster - OSCustomizationSpec $custSpecifacation $cluster - slim DiskStorageFormat

    Start-Sleep - s 60

    Start-VM $DeployedVmName

    Have you ever tried adding the line Add-PSSnapin the scriptblock in the 2nd script.

    Another problem could be that the script sends messages of 'warning', and these may cause crashes in tasks in the background as well.

    Try to set $WarningPreference = "SilentlyContinue".

  • PL/scope

    Hello experts,

    I'm trying to understand what makes PL/scope and how it might help with the programming. What I understand, it seeks all identifiers in PL/SQL (variables, loops, input/output parameters etc.) and records in a table.

    Can what additional information I turn on PL/scope? and how dangerous is it possible because I saw a caveat on some sites you might need to restart the database or drop it:

    Oracle PL/SCOPE

    Do not try this with any database, that you are not ready to give up

    Best regards

    Igor

    IgorS. wrote:

    Hello experts,

    I'm trying to understand what makes PL/scope and how it might help with the programming. What I understand, it seeks all identifiers in PL/SQL (variables, loops, input/output parameters etc.) and records in a table.

    Can what additional information I turn on PL/scope? and how dangerous is it possible because I saw a caveat on some sites you might need to restart the database or drop it:

    Oracle PL/SCOPE

    Do not try this with any database, that you are not ready to give up

    Best regards

    Igor

    Just watch, and that the warning is just recompile the standard package of in the SYS schema with the option of identifiers: PL/SCOPE.

    I agree, that doesn't look like a good idea.

    Read the documentation and use it to your own code, not for stuff SYS.

  • Help with animation and buttons

    So, I have a small question. I have an animation that is configured to stop when I open the swf file. A 'play' button is ther and works fine, when I hit him he plays through the animation, but stops once it's done. I need the looping animation at the beginning. Can someone help me?

    If you have a bunch of code the first image that defines what you can not return to the first image in your loop. Only you know what you have for the code on the first frame for answering this question. If this is the case then on the last frame of the animation just skip the first image by saying to go back to the frame 2 to complete.

    On the last picture:

    gotoAndPlay (2);

    If you want to repeat the frame 1 then put your stop() in a condition. Something like this:

    If (loop is nothing)

    {

    first row (var loop does not exist)

    define the var so there will be next time

    var loop: Boolean = true;

    stop at the start

    Stop();

    }

    The next time that animation refers to the Framework 1 variable "loop" will exist and the stop() will be ignored, says the head of (looping).

  • Workaround for calling from InDesign on Mac Acrobat

    With the help of @Test username and @Gilad D, I could get my original problem about 90% fixed.  Now, I need to tie everything together in order to solve this puzzle.  This puzzle called Acrobat from a script on Mac InDesign.

    Windows users have no trouble because BridgeTalk is available for their use, allowing them to call Acrobat directly from InDesign script.  Mac users, on the other hand, have been cheated by Adobe.  BridgeTalk does not work with Acrobat on a Mac.  Unfortunately, where I work, I found myself in the unenviable position to require a script (written in JavaScript/ExtendScript) InDesign to call Acrobat to a simple page of replacement function.  And, of course, our computers here at work are all Macs.

    With the help of the above, I, at least, got most of the way.  I discovered that AppleScript can be used to call Acrobat and do things.  And there is a 'doScript()' JavaScript function, which allows the scripts to another language to be run inside a JavaScript script.  Unfortunately, I ran into a wall when have AppleScript to save a file, but at least I can have call a function of the JavaScript script folder level to take care of her for me, I looked for work.  Yes, you can see the complications here.

    So what must happen, then, is a JavaScript script that calls an AppleScript script which in turn calls another script JavaScript that runs inside Acrobat.  Phew!  Talk about a script-reception!  But I was actually able to make this work!  However, I ran into a little snag.

    You see, I need to pass a variable through each of the three layers of scripts so that it works.  I'll post what I have so far.

    First of all, the top-level script, which runs inside InDesign.  This is just a test script to make sure that it all works before I integrate it with the real InDesign script:

    var fName = "testfile2.pdf";
    var aFName = new Array;
    aFName.push(fName);
    scriptFile = new File ("/apache HD/Users/apache/Documents/unlockCover.applescript");
    app.doScript(scriptFile, ScriptLanguage.APPLESCRIPT_LANGUAGE, aFName);
    

    Now, the AppleScript file (the middle layer), you can see being referred to above:

    on run argv
              set unlockedFile to item 1 of argv as text
              tell application "Adobe Acrobat Pro"
                        do script ("unlockCover(" & unlockedFile & ");")
              end tell
    end run
    


    This should, in theory, finally call the last script (low level), which is a JavaScript file saved inside the box at the level of the files for Acrobat, so that it runs automatically as soon as the launch of Acrobat and the function remains in memory to be called at any time:

    var unlockCover = app.trustedFunction(function (fName)
    {
              app.beginPriv();
              var myDoc = app.openDoc("/g/ ArtDept/Product Templates/ ProofCover/proof_cover.pdf");
              myDoc.replacePages(0, "/apache HD/Users/apache/Desktop/Old samples/407471 Folder/407471_cover.pdf", 0, 0);
              myDoc.saveAs("/apache HD/Users/apache/Desktop/" + fName);
              myDoc.closeDoc(true);
              app.endPriv();
    });
    

    There are the real meat of it.  These four lines between "app.beginPriv ();" and "app.endPriv ();" are those that this is all about.  However, I get an error message when I try to run the script at a higher level:

    End of line but found consistent application or review.

    If I send a call to each of you scripting gurus out there, how can I put the last nail in the coffin of this monster and call it a day.  I'm pretty sure 100% that the problem lies in trying to pass the argument ("aFName' in the top-level script) for the intermediate level AppleScript script.  Any ideas?

    Problem solved.

    I played with it a bit more and discovered that it was, indeed, passing the variable of AppleScript script that was the problem.  I used 'on run argv', I read on some site earlier today as the way AppleScript handles the arguments given.  More recently, however, I discovered that JavaScript uses a table defined as 'arguments' whenever AppleScript him passes a variable.  So, on a lark, I decided to try to use 'arguments' the other way ' round (I also had to add an extra set of quotes in the line "do script" AppleScript seems to save strings to variables without them):

    set unlockedFile to item 1 of arguments
    tell application "Adobe Acrobat Pro"
              do script ("unlockCover(\"" & unlockedFile & "\");")
    end tell
    

    And who did!  I can now pass a variable all the way from code JavaScript/ExtendScript InDesign JavaScript Acrobat low-level code top-level!  YAY!

  • General optimization

    Hello world!

    I have a few questions about genral code optimization, I demonstreate examples below:

    (1) is it better to use: for (i = 0; i < Array.length; i ++)

    {

    Code of...

    }

    or:

    length = Array.length

    for (i = 0; i < length; i ++)

    {

    Code of...

    }

    (2) is it better to use: for (i = 0; i < NUM; i ++)

    {

    If (tempArray [i] .property is something)

    {

    Code of...

    }

    }

    or: for (i = 0; i < NUM; i ++)

    {

    tempVar = tempArray [i]

    If (tempVar.property is something)

    {

    Code of...

    }

    }

    (3) (may somilar to 2..)  is it better to use: for (i = 0; I < NUM: I ++)

    {

    table [i] = new object (...)

    }

    or:                                                             for (i = 0 ; i < NUM : i ++)

    {

    tempObject = new object (...)

    table [i] = tempObject

    }

    I have more questions like that, but respond to those who should help me get started...

    Also, is there aby fomral documentation Adobe concerning these things? I couldn't ' find there... So, if someone could refer to such (if it exists), I'd be grateful.

    (Edit: by preformance I mean time to use and them RAM - I develop for mobile so this is crucial)

    Thank you!

    It's the optimization chapter in a book I wrote:

    For loops, While loops loops

    The bottom line of fast execution loops in Flash is reversed for loops are the fastest.  If a list stored objects of the same type is required in the loop, a loop reversed using a vector to refer to the list of objects is faster.

    All three loops run faster if you use an int for the iteration parameter if you use a uint. All three loops to run faster if you decrement the loop variable, instead of increment.  (Note: If you decrement a variable loop i and use I > = 0 as long as the condition of senior year, you will trigger an infinite loop if i is a uint.)

    All three loops run faster if you use a variable or a constant for the terminal condition rather than a property of object or expression.

  • Interactive package vs permission issues?

    This piece of code works fine when entereed (or using the source @) in a sqlplus session:

    Start
    FOR f IN (select sys.dba_data_files file_name)
    LOOP
    dbms_output.put_line ('is' | f.file_name);
    END loop;
    end;
    /

    I tried making it a procedure in a package (comments with reference to the below error line/column):

    create or replace package my_pkg
    as
    procedure my_proc;
    end my_pkg;
    /
    display errors

    create or replace package body my_pkg
    as
    procedure my_proc
    is
    Start
    FOR f IN (select sys.dba_data_files file_name)
    -^ 6/13 ^ 6/39
    LOOP
    dbms_output.put_line ('is' | f.file_name);
    -^ 9/7 ^ 9/42
    END loop;
    end;
    end my_pkg;
    /
    display errors

    But what causes the following errors:

    Package created.

    No errors.

    WARNING: The body of a Package created with compilation errors.

    PACKAGE BODY MY_PKG errors:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    6/13 PL/SQL: statement ignored
    6/39 PL/SQL: ORA-00942: table or view does not exist
    9/7 PL/SQL: statement ignored
    9/42 PLS-00364: variable loop index "F" use is not valid

    Why?

    I am aware that ORA-942 means usually not sufficient privileges. But in an interactive way, I choose the table successfully (it is owned by sys). I tried two schemas different non - sys, with the same result.

    Help?

    When you want to use a table inside a stored procedure, function, or package, you must grant access directly to the owner of the procedure/function/formula.
    You can't grant by role. Grant through role is sufficient for interactive sql, but not for the stored procedure.

    So:

    1 login as the owner of the table
    2. select on grant

    à ;
    3 log in as the owner of the procedure
    4 compilation

    Published by: hm on 01.11.2010 12:14

  • For any error in the anoymous blk

    Hi all

    When I run the query below, I got error

    the file errors
    ORA-06550: line 54, column 1:
    PLS-00103: Encountered the symbol "DBMS_OUTPUT" when expecting one of the following:

       . ( * @ % & - + / at mod rem select update <an exponent (**)>
       delete insert ||
    The symbol "." was substituted for "DBMS_OUTPUT" to continue.
    ORA-06550: line 54, column 95:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:

       . ( * % & - + / at mod rem s
    the actual query below
    SET SERVEROUTPUT ON;

    SPOOL /tmp/customer_ext.xls

    DECLARE

    TYPE tpcustnos IS TABLE OF dw_customer.cust_no%TYPE INDEX BY BINARY_INTEGER;
    TYPE tptitles IS TABLE OF dw_customer.title%TYPE INDEX BY BINARY_INTEGER;
    TYPE tpsalutations IS TABLE OF dw_customer.salutation%TYPE INDEX BY BINARY_INTEGER;
    TYPE tpfirstnames IS TABLE OF dw_customer.first_name%TYPE INDEX BY BINARY_INTEGER;
    TYPE tplastnames IS TABLE OF dw_customer.last_name%TYPE INDEX BY BINARY_INTEGER;
    TYPE tpcreationtimes IS TABLE OF dw_customer.creation_time%TYPE INDEX BY BINARY_INTEGER;


    CURSOR customerdetails(FromCreationTime IN dw_customer.creation_time%TYPE,
                                                    ToCreationTime IN dw_customer.creation_time%TYPE)
    IS
    SELECT dc.cust_no,
               dc.title,
               dc.salutation,
               dc.first_name,
               dc.last_name,
               dc.creation_time
    FROM dw_customer dc
    WHERE trunc(dc.creation_time) >=  FromCreationTime
            AND    trunc(dc.creation_time) <  ToCreationTime + 1;

    lcustnos tpcustnos;
    ltitles tptitles;
    lsalutations tpsalutations;
    lfirstnames tpfirstnames;
    llastnames tplastnames;
    lcreationtimes tpcreationtimes;
    vCount BINARY_INTEGER;


    FromCreationTime DATE      := '08-APR-2003';
    ToCreationTime DATE      := '08-APR-2003';

    BEGIN

    DBMS_OUTPUT.PUT_LINE('Opening cursor');

    OPEN customerdetails(FromCreationTime => FromCreationTime,
                                                    ToCreationTime => ToCreationTime) ;


    DBMS_OUTPUT.PUT_LINE('Fetching from the cursor and bulk collecting into table variables');
    LOOP
    FETCH customerdetails BULK COLLECT INTO lcustnos, ltitles, lsalutations, lfirstnames, llastnames, lcreationtimes;


    DBMS_OUTPUT.PUT_LINE('Closing the cursor');

    FORALL vCount IN 1..lcustnos.COUNT


    DBMS_OUTPUT.PUT_LINE(lcustnos, ltitles, lsalutations, lfirstnames, llastnames, lcreationtimes);


    --EXIT WHEN customerdetails%NOTFOUND;
    END LOOP;

    END;

    Just put it all together

    for vcount in 1..lcustnos.count
    loop
         dbms_output(
                  lcustnos(vcount)      ||','||
                  lsalutations(vcount)||','||
                  lfirstnames(vcount) ||','||
                  llastnames(vcount)      ||','||
                  lcreationtimes(vcount)
                 )
    end loop;
    
  • AppleScript Variable error

    Hi all

    I'm writing an applescript script which is called with a variable and then use that variable in the script. For example:

    on run argv
      set a to item 1 of argv
      tell application "iTerm-2"
        tell current window
          tell the current session
          write text "ssh" & a
          end tell
        end tell
      end tell
    end run
    

    There is something fishy's going on with the open with - command args and AppleScript. I suggest that you run your application as follows to capture item 1 of argv:

    osascript mypp.app machine

  • Get the value of the cursor in variable AppleScript

    I'm looking for a pointer on where to start with this project, please.

    I want to create an application with a simple slider - say, the divisions of 10% on a scale of 0 to 100% - and then to feed this entry in a script variable.

    I guess it will be something with AppleScriptObjC.  If this is true, can anyone recommend that a good getting started resource please?

    Yes, you can use AppleScriptObjC, but there are also many other languages and tools that can be used.  Are you familiar with AppleScript and cocoa, or programming in general?  I ask because AppleScriptOBjC is a framework that allows you to access Cocoa classes and methods go AppleScript, so you would need to know a bit about the two of them.  In addition, the Interface Builder in Xcode is what is used to generate the UI for your typical application of cocoa, so you would need to know a little more about this as well.

    Apple doesn't have a lot of specific other than their Release NotesAppleScriptObjC documentation, because they expect you to be able to use the existing Objective-C stuff.  However, an early AppleScriptObjC tutorial can be found at MacScripter.net, and something more to date can be found at MacOSXAutomation.com.

Maybe you are looking for