A script to create a script!

Are there are template scripts available which, when run, can create and save a new script application from some lines in the original script?
When the script runs I want it to open a dialog asking for some text and then create a new script using some included lines from itself and insert the typed text in a relevant are and then save that new script as an application.
A bit vague know, thanks for any help.
Mark

Thanks to all of you for some excellent starting points. I'm going to have a go with these and see if I can start to get them to do the first stage of what I want to do.
Its a bit ambitious and most probably not going to be very practical. At the moment its more of a proof or concept than a really useful tool, but I hoped that it could be ironed out to be of use to some people. This is what its for:
In Avid non linear editor systems (Media Composer / Xpress Pro etc) there is a tool called Script editor - this is not a computer scripting tool, rather its a build in text display to show an actual film / tv script.
You drag clips from the bins and attach them to the relevant parts of the text. As the film is gradually shot and loaded, eventually you have a full script with all the slates and takes attached to their corresponding section. This makes checking back and finding certain takes very useful at all stages of the edit.
Ok, so if you got that, here's what I actually want to do! Final Cut Pro does not have such a tool, nor does it have any scripting support. However I have done a small test to see what would happen if I linked a small AppleScript to a section of text in TextEdit. The script contained a keystroke set of commands to activate FCP, check the media browser is active, bring up the search tool, type in the slate name (e.g 12-2 (for slate 12, take 2)) and then when the clip is found its loaded into the FCP Viewer.
It actually worked very well and achieves essentially the same job, but in this form its completely unpractical as it takes too long to make and tie each applescript into the TextEdit doc.
The next step (using your excellent scripts as starting points) is to have the user simply be able to go through the text document, highlight the section they want to link to a clip to, then run a small applescript from the Dock. It will ask what clip name to attach (e.g. 12-2 (this is the dialogue bit)) then it would save this text into a new script (with the keystroke commands) to a dedicated folder (perhaps at the route of the drive) and then attach this file to the text in TextEdit.
There are lots of pitfalls here I realize and its unlikely it can ever be very elegant because it has to use GUI scripting, but I do think that if it worked then really its not much effort for an editor to go through a script in TextEdit, finding the points you want to link clips to and by simply running one applescript and entering a bit of text, you end up with a text file full of clickable links. The rest is hidden away from the user.
The main issues are the number of tasks the first applescript has to perform and I'm starting to think it would be better just to have one script which can be linked to each section of text, but when it runs it looks at what it was attached to and searches for that text instead. So you would type in the clip names directly to the text doc and link that text instead of a section.
There are also issues with FCP's search as it has no feedback so the delay factor would have to be universally set to allow for longer searches in large projects.
I use an Avid in my day job and we have been using the build in Script tool a lot recently and I was thinking it would be nice to have something similar in FCP. I can't program and there is no available add-on support in FCP anyway, but I have used AppleScripts with GUI scripting commands before to automate tasks in FCP. I wondered if it would be possible and I sort of set myself the challenge. In hindsight I'm unlikely to achieve it, but it will be fun trying!!
Thanks for all the scripts and tips, these will be invaluable if I'm to get even close!
Regards
Mark
    G5 Dual 2.0Ghz / 10.4.3 / 4GB RAM / ATI X800XT / QT 7.0.3 / FCP 5.0.3

Similar Messages

  • Is there a script to create a button to set an activated frame to document size + bleed?

    Please see my question above. Thanks in advance!

    Here is a script that creates a script that creates a button that sets an activated frame to document size + bleed.
    Why do you need a script to create a button that sets an activated frame to document size + bleed? You might as well have a script that sets an activated frame to document size + bleed, because you already need to double-click the script that sets an activated frame to document size + bleed and so there is no need to show another button that you can click to set an activated frame to document size + bleed in that.
    theScript = 'var w = new Window("dialog", "Reframe");\n'+
    'w.b = w.add("button", undefined, "Click me!");\n'+
    'w.b.onClick = function(){ w.close(3); };\n'+
    'if (w.show() == 3)\n'+
    '{\n'+
    'dp = app.activeDocument.documentPreferences;\n'+
    'app.selection[0].geometricBounds = [\n'+
    'app.layoutWindows[0].activePage.bounds[0]-dp.documentBleedTopOffset,\n'+
    'app.layoutWindows[0].activePage.bounds[1]-dp.documentBleedBottomOffset,\n'+
    'app.layoutWindows[0].activePage.bounds[2]+dp.documentBleedInsideOrLeftOffset,\n'+
    'app.layoutWindows[0].activePage.bounds[3]+dp.documentBleedOutsideOrRightOffset];\n'+
    writeFile = new File (app.activeScript.parent+'/new script.jsx');
    writeFile = writeFile.saveDlg( 'Save script', File.fs == "Windows" ? "Script:*.jsx,All files:*.*" : function(file) { return file instanceof Folder || (!(file.hidden) && file.name.match(/\.jsx$/i)); } );
    if (writeFile != null && writeFile.open("w"))
      writeFile.encoding = "utf8";
      writeFile.write (theScript);
      writeFile.close();

  • Creating Plugin Script

    Hi Friends,
    I want to create plugin script for algorithm ,can any one pls explain me doubts to crate this plugin
    1.In Plugin Script How can i get the soft paramenters (like in service script we have schema containts local variables(parms) for getting values from ui)
    2.how can we include new hard parameters into Algorithm entity(should we place use=input/output)
    My Requirment is the plugin script should take accountid and return boolean value by validating contracted quantity.
    i tested this requirment with one simple ui and service script which use Bussiness Service .how can i convert service script to plugin script
    For creating plugin script i am taking Ratecomponet as algorithm entity.here how can i get accountid and how can i send boolean value as a result.
    thanks&regards
    sivaram

    Your requirements are a bit confusing, when you say "contracted quantity", are you referring to the Contract Quantity defined on the Service Agreement (if maintained)? OR since you have mentioned Account, is the "contracted quantity" defined on the Account as a Characteristic?
    If the latter then you don't need any Algorithm or Plug-in Script to do the task, you can configure Rate Component Eligibility - Criteria Field as 'Characteristic' and specify Account as the Characteristic Entity and choose the characteristic type. Also, use Rate Component Eligibility - Criteria Comparison and specify the logical operator for comparing the retrieved "contracted quantity" on the Account. Alternatively, you could also configure a SQ Rule having SQ Algorithm of type 'Characteristic Value' and retrieve the "contracted quantity" from the Account. In this case you can then have Rate Component Eligibility - Criteria Field to be 'Service Quantity', select the SQI defined on the SQ Rule and do the comparison.
    If the former, you need to define a SQ Rule (also configured on the Rate Schedule) to fetch the Contract Quantity of a specific type on the SA and assign it to the SQ Array of your choice.
    In either case you don't need a custom Plug-in Script / Algorithm (I assume Rate Component - Criteria Field spot/entity).
    Nevertheless, if you still want to define an Algorithm for Rate Component - Criteria Field entity, you should keep following points in mind (considering your requirement):
    - Account Id is not available in the given script schema, although SA Id is available, hence you'd need a Business Service to retrieve the Account Id from the SA Id.
    - After evaluation, you need to return a boolean for following"output" parameters, either true or false:
    parm/hard/isSingleCriteriaFieldValue
    parm/hard/singleCriteriaFieldValue
    parm/hard/isCriteriaFieldFound- Thereafter, compare the boolean value under Rate Component Eligibility - Criteria Comparison and set the "If True" and "If False" conditions as per your requirements.

  • Illustrator script to create symbols from images in folder

    Time to give back to the community...
    Here is a script I recently devised to bulk create symbols from images in a folder. Tested with Illustrator CC 2014.
    // Import Folder's Files as Symbols - Illustrator CC script
    // Description: Creates symbols from images in the designated folder into current document
    // Author     : Oscar Rines (oscarrines (at) gmail.com)
    // Version    : 1.0.0 on 2014-09-21
    // Reused code from "Import Folder's Files as Layers - Illustrator CS3 script"
    // by Nathaniel V. KELSO ([email protected])
    #target illustrator
    function getFolder() {
      return Folder.selectDialog('Please select the folder to be imported:', Folder('~'));
    function symbolExists(seekInDoc, seekSymbol) {
        for (var j=0; j < seekInDoc.symbols.length; j++) {
            if (seekInDoc.symbols[j].name == seekSymbol) {
                return true;
        return false;
    function importFolderContents(selectedFolder) {
        var activeDoc = app.activeDocument;     //Active object reference
      // if a folder was selected continue with action, otherwise quit
      if (selectedFolder) {
            var newsymbol;              //Symbol object reference
            var placedart;              //PlacedItem object reference
            var fname;                  //File name
            var sname;                  //Symbol name
            var symbolcount = 0;        //Number of symbols added
            var templayer = activeDoc.layers.add(); //Create a new temporary layer
            templayer.name = "Temporary layer"
            var imageList = selectedFolder.getFiles(); //retrieve files in the folder
            // Create a palette-type window (a modeless or floating dialog),
            var win = new Window("palette", "SnpCreateProgressBar", {x:100, y:100, width:750, height:310});
            win.pnl = win.add("panel", [10, 10, 740, 255], "Progress"); //add a panel to contain the components
            win.pnl.currentTaskLabel = win.pnl.add("statictext", [10, 18, 620, 33], "Examining: -"); //label indicating current file being examined
            win.pnl.progBarLabel = win.pnl.add("statictext", [620, 18, 720, 33], "0/0"); //progress bar label
            win.pnl.progBarLabel.justify = 'right';
            win.pnl.progBar = win.pnl.add("progressbar", [10, 35, 720, 60], 0, imageList.length-1); //progress bar
            win.pnl.symbolCount = win.pnl.add("statictext", [10, 70, 710, 85], "Symbols added: 0"); //label indicating number of symbols created
            win.pnl.symbolLabel = win.pnl.add("statictext", [10, 85, 710, 100], "Last added symbol: -"); //label indicating name of the symbol created
            win.pnl.errorListLabel = win.pnl.add("statictext", [10, 110, 720, 125], "Error log:"); //progress bar label
            win.pnl.errorList = win.pnl.add ("edittext", [10, 125, 720, 225], "", {multiline: true, scrolling: true}); //errorlist
            //win.pnl.errorList.graphics.font = ScriptUI.newFont ("Arial", "REGULAR", 7);
            //win.pnl.errorList.graphics.foregroundColor = win.pnl.errorList.graphics.newPen(ScriptUIGraphics.PenType.SOLID_COLOR, [1, 0, 0, 1], 1);
            win.doneButton = win.add("button", [640, 265, 740, 295], "OK"); //button to dispose the panel
            win.doneButton.onClick = function () //define behavior for the "Done" button
                win.close();
            win.center();
            win.show();
            //Iterate images
            for (var i = 0; i < imageList.length; i++) {
                win.pnl.currentTaskLabel.text = 'Examining: ' + imageList[i].name; //update current file indicator
                win.pnl.progBarLabel.text = i+1 + '/' + imageList.length; //update file count
                win.pnl.progBar.value = i+1; //update progress bar
                if (imageList[i] instanceof File) {         
                    fname = imageList[i].name.toLowerCase(); //convert file name to lowercase to check for supported formats
                    if( (fname.indexOf('.eps') == -1) &&
                        (fname.indexOf('.png') == -1)) {
                        win.pnl.errorList.text += 'Skipping ' + imageList[i].name + '. Not a supported type.\r'; //log error
                        continue; // skip unsupported formats
                    else {
                        sname = imageList[i].name.substring(0, imageList[i].name.lastIndexOf(".") ); //discard file extension
                        // Check for duplicate symbol name;
                        if (symbolExists(activeDoc, sname)) {
                            win.pnl.errorList.text += 'Skipping ' + imageList[i].name + '. Duplicate symbol for name: ' + sname + '\r'; //log error
                        else {
                            placedart = activeDoc.placedItems.add(); //get a reference to a new placedItem object
                            placedart.file = imageList[i]; //link the object to the image on disk
                            placedart.name =  sname; //give the placed item a name
                            placedart.embed();   //make this a RasterItem
                            placedart = activeDoc.rasterItems.getByName(sname); //get a reference to the newly created raster item
                            newsymbol = activeDoc.symbols.add(placedart); //add the raster item to the symbols                 
                            newsymbol.name = sname; //name the symbol
                            symbolcount++; //update the count of symbols created
                            placedart.remove(); //remove the raster item from the canvas
                            win.pnl.symbolCount.text = 'Symbols added: ' + symbolcount; //update created number of symbols indicator
                            win.pnl.symbolLabel.text = 'Last added symbol: ' + sname; //update created symbol indicator
                else {
                    win.pnl.errorList.text += 'Skipping ' + imageList[i].name + '. Not a regular file.\r'; //log error
                win.update(); //required so pop-up window content updates are shown
            win.pnl.currentTaskLabel.text = ''; //clear current file indicator
            // Final verdict
            if (symbolcount >0) {
                win.pnl.symbolLabel.text = 'Symbol library changed. Do not forget to save your work';
            else {
                win.pnl.symbolLabel.text = 'No new symbols added to the library';
            win.update(); //update window contents
            templayer.remove(); //remove the temporary layer
        else {
            alert("Action cancelled by user");
    if ( app.documents.length > 0 ) {
        importFolderContents( getFolder() );
    else{
        Window.alert("You must open at least one document.");

    Thank you, nice job & I am looking forward to trying it out!

  • Question about DBCA generate script o create RAC database 2 node cluster

    Question about creating two node RAC database 11g after installing and configuration 11g clusterware. I've used DBCA to generate script to create a rac database. I've set
    environment variable ORACLE_SID=RAC and the creating script creates instance of RAC1 and RAC2. My understanding is that each node will represent a node, however there should only be one database with a name of 'RAC'. Please advise

    You are getting your terminology mixed up.
    You only have one database. Take a look, there are one set of datafiles on shared storage.
    You have 2 instances which are accessing one database.
    Database name is RAC. Instance names are RAC1, RAC2, etc, etc.
    Also, if you look at the listener configuration and if your tnsnames is setup properly then connecting to RAC will connect you to either one of the instances wheras connecting to RAC1 will connect you to that instance.

  • Error While running WLST script to create SOA Domain in Clustered Environme

    Hi,
    I am trying to run WLST script to create SOA Domain in clustered environment.The script is as follows.
    import sys
    print "@@@ Starting the script ..."
    global props
    from wlstModule import *#@UnusedWildImport
    from java.io import FileInputStream
    from java.io import File
    #=======================================================================================
    # Create Boot Properties File
    #=======================================================================================
    def createBootPropertiesFile(directoryPath, username, password):
    adminserverDir = File(directoryPath)
    bool = adminserverDir.mkdirs()
    fileNew=open(directoryPath + '/boot.properties', 'w')
    fileNew.write('username=%s\n' % username)
    fileNew.write('password=%s\n' % password)
    fileNew.flush()
    fileNew.close()
    def createNodeManagerPropertiesFile(directoryPath, username, password):
    adminserverDir = File(directoryPath)
    bool = adminserverDir.mkdirs()
    fileNew=open(directoryPath + '/nm_password.properties', 'w')
    fileNew.write('username=%s\n' % username)
    fileNew.write('password=%s\n' % password)
    fileNew.flush()
    fileNew.close()
    def createAdminStartupPropertiesFile(directoryPath, args):
    adminserverDir = File(directoryPath)
    bool = adminserverDir.mkdirs()
    fileNew=open(directoryPath + '/startup.properties', 'w')
    args=args.replace(':','\\:')
    args=args.replace('=','\\=')
    fileNew.write('Arguments=%s\n' % args)
    fileNew.flush()
    fileNew.close()
    I am getting the error :
    Problem invoking WLST - Traceback (innermost last):
    (no code object) at line 0
    File "D:\Oracle\Middleware\Oracle_SOA1\bin\SOADomainScript.py", line 11
    adminserverDir = File(directoryPath)
    ^
    SyntaxError: invalid syntax
    Do i need to set any jar in the classpath? Already jython.jar is available in the classapath.
    Thanks in advance.
    Regards,
    Subha

    Hi,
    I am trying to run WLST script to create SOA Domain in clustered environment.The script is as follows.
    import sys
    print "@@@ Starting the script ..."
    global props
    from wlstModule import *#@UnusedWildImport
    from java.io import FileInputStream
    from java.io import File
    #=======================================================================================
    # Create Boot Properties File
    #=======================================================================================
    def createBootPropertiesFile(directoryPath, username, password):
    adminserverDir = File(directoryPath)
    bool = adminserverDir.mkdirs()
    fileNew=open(directoryPath + '/boot.properties', 'w')
    fileNew.write('username=%s\n' % username)
    fileNew.write('password=%s\n' % password)
    fileNew.flush()
    fileNew.close()
    def createNodeManagerPropertiesFile(directoryPath, username, password):
    adminserverDir = File(directoryPath)
    bool = adminserverDir.mkdirs()
    fileNew=open(directoryPath + '/nm_password.properties', 'w')
    fileNew.write('username=%s\n' % username)
    fileNew.write('password=%s\n' % password)
    fileNew.flush()
    fileNew.close()
    def createAdminStartupPropertiesFile(directoryPath, args):
    adminserverDir = File(directoryPath)
    bool = adminserverDir.mkdirs()
    fileNew=open(directoryPath + '/startup.properties', 'w')
    args=args.replace(':','\\:')
    args=args.replace('=','\\=')
    fileNew.write('Arguments=%s\n' % args)
    fileNew.flush()
    fileNew.close()
    I am getting the error :
    Problem invoking WLST - Traceback (innermost last):
    (no code object) at line 0
    File "D:\Oracle\Middleware\Oracle_SOA1\bin\SOADomainScript.py", line 11
    adminserverDir = File(directoryPath)
    ^
    SyntaxError: invalid syntax
    Do i need to set any jar in the classpath? Already jython.jar is available in the classapath.
    Thanks in advance.
    Regards,
    Subha

  • Create DB Script error

    Hello,
    i am trying to perform my first manual creation of a database. Initially was always receiving error;
    ORA-01092: ORACLE instance terminated. Disconnection forced
    I think this was because the UNDO element in the init.ora file did not match UNDO element in the Create DB script. But now that i think i have them matching i continously receive the error;
    'Invalid Create Command'
    The UNDO element in the init.ora file is;
    undo_tablespace=UNDOTBS
    The Create script is;
    CREATE DATABASE Customers
    USER SYS IDENTIFIED BY CUSTSYS
    LOGFILE GROUP 1 ('F:\oracle\oradata\Customers\redo01.log') SIZE 100M REUSE,
         GROUP 2 ('F:\oracle\oradata\Customers\redo02.log') SIZE 100M REUSE,
         GROUP 3 ('F:\oracle\oradata\Customers\redo03.log') SIZE 100M REUSE
    MAXLOGFILES 5
    MAXLOGMEMBERS 5
    MAXLOGHISTORY 1
    MAXDATAFILES 100
    MAXINSTANCES 1
    ARCHIVELOG
    CHARACTER SET WE8MSWIN1252
    NATIONAL CHARACTER SET AL16UTF16
    DATAFILE 'F:\oracle\oradata\Customers\system01.dbf' SIZE 200M REUSE
    UNDO TABLESPACE UNDOCUST
    DEFAULT TEMPORARY TABLESPACE tempcust_ts;
    Also, when i have created the service for the database using ORADIM the alert log gives the following near the bottom;
    ORA-00202: controlfile: 'F:\oracle\oradata\Customers\CUSTCONTROL01.CTL'
    ORA-27041: unable to open file
    OSD-04002: unable to open file
    O/S-Error: (OS 2) The system cannot find the file specified.
    Thanks in advance

    I just about give up!!!
    Thanks for everyone’s advice, but nothing so far seems to create the database. I could initially create a database with the Database Configuration Assistant no problem but have been asked to learn to create one manually as it supposedly gives better control of the parameters etc.
    I am using Oracle 9i.
    Next here is the undo elements in init file. (I don't think i can put whole init file up)
    undo_management=AUTO
    undo_retention=10800
    undo_tablespace=UNDOTBS1
    I manage to create the database service okay using ORADIM.
    The alert log file is there at this point but with this error at the bottom.
    ORA-00202: controlfile: 'F:\oracle\oradata\Customers\CUSTOMERSCONTROL01.CTL'
    ORA-27041: unable to open file
    OSD-04002: unable to open file
    O/S-Error: (OS 2) The system cannot find the file specified.
    Tue Aug 22 11:07:51 2006
    ORA-205 signalled during: alter database mount exclusive...
    Shutting down instance (abort)
    I then attempt to create a password file using ORAPWD;
    But i am given an error at command prompt;
    OPW-00001: Unable to open password file
    I then change ORACLE_SID to the new database.
    I then log onto Oracle as sysdba. Says ‘connected to an idle instance’.
    I call start up to init file. I am given following information;
    ORACLE instance started.
    Total System Global Area 135338868 bytes
    Fixed Size 453492 bytes
    Variable Size 109051904 bytes
    Database Buffers 25165824 bytes
    Redo Buffers 667648 bytes
    I then call the SQL script containing the following;
    CREATE DATABASE Customers
    USER SYS IDENTIFIED BY CustSYS
    USER SYSTEM IDENTIFIED BY CustSYSTEM
    CONTROL FILE REUSE
    LOGFILE GROUP 1 ('F:\oracle\oradata\Customers\redo01.log') SIZE 100M REUSE,
         GROUP 2 ('F:\oracle\oradata\Customers\redo02.log') SIZE 100M REUSE,
         GROUP 3 ('F:\oracle\oradata\Customers\redo03.log') SIZE 100M REUSE
    MAXLOGFILES 5
    MAXLOGMEMBERS 5
    MAXLOGHISTORY 1
    MAXDATAFILES 100
    MAXINSTANCES 1
    ARCHIVELOG
    CHARACTER SET WE8MSWIN1252
    NATIONAL CHARACTER SET AL16UTF16
    EXTENT MANAGEMENT LOCAL
    DATAFILE 'F:\oracle\oradata\Customers\system01.dbf' SIZE 200M REUSE
    UNDO TABLESPACE UNDOTBS1 DATAFILE 'F:\oracle\oradata\Customers\UNDOTBS1.dbf'
    DEFAULT TEMPORARY TABLESPACE temp_ts TEMPFILE 'F:\oracle\oradata\Customers\temp01.dbf';
    Error says:
    CONTROL FILE REUSE
    ERROR at line 4:
    ORA-02165: invalid option for CREATE DATABASE
    Also in the alert log more information has been added with the last appending being;
    starting up 1 shared server(s) ...
    starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
    Oracle Data Guard is not available in this edition of Oracle.
    I remove the line CONTROL FILE REUSE from script and run again, then receive this message;
    CREATE DATABASE Customers
    ERROR at line 1:
    ORA-01092: ORACLE instance terminated. Disconnection forced
    Also, now after all these attempts I tried making a new database again using DB Configuration Assistant and it now asks me to specify a template of type data_warehousing when I clicked on General_purpose. It states template file specified does not exist, supplying the following information;
    {ORACLE_HOME}\assistants\dbca\templates\Data_Warehouse.dfj
    Thanks to all for input on this but I am running out of time and have to move on to next part of project.

  • Getting OU of users into CSV created by script

    Hi.
    I've found this script that let's us analyze mailbox Growth over time.
    http://gallery.technet.microsoft.com/scriptcenter/Generate-report-of-user-e4e9afca  (script shown below)
    But I need to add the OU of the user to the script as we are hosting different Companies on the Exchange server I'll be using it on. Therefore it' necessary to be able to sort by using the OU the users are located in.
    I've found out that Get-MailboxStatisics cannot do this for me and therefore that a custom object has to be used. But to be honest I'm a total noob at scripting so I'll be very gratefull if anyone can help me out here and tell me how I should customize
    the script below
    <#
    The sample scripts are not supported under any Microsoft standard support
    program or service. The sample scripts are provided AS IS without warranty 
    of any kind. Microsoft further disclaims all implied warranties including, 
    without limitation, any implied warranties of merchantability or of fitness for
    a particular purpose. The entire risk arising out of the use or performance of 
    the sample scripts and documentation remains with you. In no event shall
    Microsoft, its authors, or anyone else involved in the creation, production, or
    delivery of the scripts be liable for any damages whatsoever (including,
    without limitation, damages for loss of business profits, business interruption,
    loss of business information, or other pecuniary loss) arising out of the use
    of or inability to use the sample scripts or documentation, even if Microsoft
    has been advised of the possibility of such damages.
    #>
    #requires -Version 2
    param
     [Switch]$ExportMailboxSize,
     [Switch]$CompareMailboxSize,
     [String]$LogPath="C:\log",
     [String[]]$Identity,
     [DateTime]$StartDate,
     [DateTime]$EndDate
    #region Export today's Mailbox Size
    if ($ExportMailboxSize)
     $Counter=0
     $UserMailboxStatistics=@()
     if(-not ( Test-Path -Path $LogPath))
      New-Item -ItemType  directory -Path $LogPath
     #Get mailbox identity
     if (-not ($Identity))
      $UserMailboxs=Get-Mailbox -Filter 'RecipientTypeDetails -eq "UserMailbox"' -ResultSize unlimited
     else
      $UserMailboxs=$Identity|Get-Mailbox -Filter 'RecipientTypeDetails -eq "UserMailbox"' -ResultSize unlimited
     #Get SamAccountName,DisplayName and MailboxTotalItemSize for specific users or all users with mailbox.
     foreach ($UserMailbox in $UserMailboxs)
      $Counter++
      Write-Progress -Activity "Export MailboxStatistic" -Status "Exporting" -CurrentOperation $UserMailbox.DisplayName -PercentComplete ($counter/($UserMailboxs.Count)*100)
      $UserMailboxStatistic = New-Object PSObject
      $UserMailboxSizeB = (Get-MailboxStatistics -Identity $UserMailbox).TotalItemSize.Value.tobytes()
      $UserMailboxSizeMB = "{0:#.##}" -f ($UserMailboxSizeB/1mb)
      $UserMailboxStatistic | Add-Member -MemberType NoteProperty -Name "SamAccountName" -Value $UserMailbox.SamAccountName
      $UserMailboxStatistic | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $UserMailbox.DisplayName
      $UserMailboxStatistic | Add-Member -MemberType NoteProperty -Name "UserMailboxSizeMB" -Value $UserMailboxSizeMB
      $UserMailboxStatistics+=$UserMailboxStatistic
     #Output to a CSV file with date format "yyyy-MM-dd" as default name  ,in default path "C:\log". Path can be set by $logpath param.
     $UserMailboxStatistics|Export-Csv -Encoding default -NoTypeInformation -Path "$LogPath\$(get-date -Format "yyyy-MM-dd").csv"
    #endregion
    #region Compare Mailbox Size
    if ($CompareMailboxSize)
     $TempCSVs=@()
     $report=@{}
     $index=-1
     #Check if path is correct
     if(-not ( Test-Path -Path $LogPath))
      Write-Error -Message "'$LogPath' doesn't exist, please make sure the path is correct"
      return
     [array]$CSVFiles=Get-ChildItem $LogPath -Exclude "Compare*"|Sort-Object -Property "CreationTime"
     #Summary all CSV files during the period,given by user 
     if ($StartDate -and $EndDate)
      foreach ($CSVFile in $CSVFiles)
       if ($CSVFile.CreationTime.date -ge $StartDate.date -and $CSVFile.CreationTime.date -le $EndDate.date)
        $TempCSVs+=$CSVFile
     else
      Write-Error -Message "StartDate or EndDate is not correct or not given. Please make sure the format is correct."
      return
     #Check wether CSV files exist during the period
     if (-not $TempCSVs)
      Write-Error "log file created from '$StartDate' to '$EndDate' doesn't exist in '$LogPath'. Please check."
      return
     else
      #Import these CSV files 
      foreach($TempCSV in $TempCSVs)
       $TempDate=$TempCSV.basename
       $counter=0
       $index++
       $UserMailboxStatistics=Import-Csv -Path $TempCSV.fullname
       #add user's mailbox status to report
       foreach ($UserMailboxStatistic in $UserMailboxStatistics)
        if (-not $report.ContainsKey($UserMailboxStatistic.SamAccountName))
         $TempUserMailboxStatistic=New-Object psobject
         $TempUserMailboxStatistic|Add-Member -MemberType NoteProperty -Name "SamAccountName" -Value $UserMailboxStatistic.SamAccountName
         $TempUserMailboxStatistic|Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $UserMailboxStatistic.DisplayName
         $TempUserMailboxStatistic|Add-Member -MemberType NoteProperty -Name "Remark" -Value "Online"
         for ($i=0;$i -lt $TempCSVs.count;$i++)
          $TempUserMailboxStatistic|Add-Member -MemberType NoteProperty -Name "$($TempCSVs[$i].basename)" -Value "N/A"
         $report.Add($UserMailboxStatistic.SamAccountName,$TempUserMailboxStatistic)
        #write progress
        $Counter++
        Write-Progress -Activity "Compare MailboxSize on $TempDate" -Status "Comparing"`
        -CurrentOperation $TempUserMailboxStatistic.DisplayName -PercentComplete ($counter / ($UserMailboxStatistics.Count) * 100)
        $report[$UserMailboxStatistic.SamAccountName].$TempDate=$UserMailboxStatistic.UserMailboxSizeMB
       #check wether users' mailboxes were removed or added.
       $report.values|%{`
       if ($_.$TempDate -eq "N/A" -and $_.Remark -notlike "Remove*")`
        {$_.Remark="Removed on $TempDate"};`
       if ($_.$TempDate -ne "N/A" -and $index -ne 0 -and $_.$($TempCSVs[$index-1].basename) -eq "N/A")`
        {$_.Remark="Added on $TempDate"}}
     #Export report to CSV file
     $report.Values|Export-Csv -Encoding default -NoTypeInformation -Path "$LogPath\Compare$(get-date $StartDate -Format "yyyy-MM-dd")TO$(get-date $EndDate -Format "yyyy-MM-dd").csv"
    #endregion
    if (-not $ExportMailboxSize -and -not $CompareMailboxSize)
    Write-Warning -Message "You did not choose any task. Please choose one."

    StoreThomas,
    At the top of this script, you will see a section where the user mailboxes are collected then each is checked.  Line 45 starts this section.  Just under that, you can see that a custom psObject is created (line 50) and defined (the next 5
    lines) and added to an overall list of mailbox statistics (line 56).  You can add an Add-Member line before line 56 that says the following:
    $UserMailboxStatistic | Add-Member -MemberType NoteProperty -Name "OrgUnit" -Value $UserMailbox.OrganizationalUnit
    That should add your OU to the list of exported fields, and you can use Excel to open and filter that list.

  • Using XML file in Java script to create Google Map

    Hello,
    I work for a non-profit in San Diego as a GIS Specialist. I have had to teach myself about some scripting to create some dynamic maps, but I am still very limited in my skills, so I have had to explore the internet in order to discover various tutorials and examples that have led me on a positive path.
    Right now I am working on a Google Mash-Up that will incorporate over 14,000 records, which will appear as separate markers that will have pop-up info bubbles with additional info inside (using html), once the marker is clicked.
    Here is the XML script example that is used in the tutorial I am following:
    <markers>
    <marker lat="43.65654" lng="-79.90138" html="Some stuff to display in the<br>First Info Window"
    label="Marker One" />
    <marker lat="43.91892" lng="-78.89231" html="Some stuff to display in the<br>Second Info Window"
    label="Marker Two" />
    <marker lat="43.82589" lng="-79.10040" html="Some stuff to display in the<br>Third Info Window"
    label="Marker Three" />
    </markers>
    ...and this is how it looks when the file is retrieved by the java script and mapped: http://econym.googlepages.com/example_map3.htm
    This is the java script that creates the Google Map. I have emboldened the section of the script that retrieves the data and parses it to create the markers:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Google Maps</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA6GoL8P5zqjQlG5A5uM1ETBSUPozAscB0cY3RG8xEGnZyeom4axRySak889rVpvHYRsV4f9OZZzbboA"
    type="text/javascript"></script>
    </head>
    <body onunload="GUnload()">
    <!-- you can use tables or divs for the overall layout -->
    <table border=1>
    <tr>
    <td>
    <div id="map" style="width: 800px; height: 1200px"></div>
    </td>
    <td width = 200 valign="top" style="text-decoration: underline; color: #4444ff;">
    <div id="side_bar"></div>
    </td>
    </tr>
    </table>
    <noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b>
    However, it seems JavaScript is either disabled or not supported by your browser.
    To view Google Maps, enable JavaScript by changing your browser options, and then
    try again.
    </noscript>
    <script type="text/javascript">
    //<![CDATA[
    if (GBrowserIsCompatible()) {
    // this variable will collect the html which will eventualkly be placed in the side_bar
    var side_bar_html = "";
    // arrays to hold copies of the markers used by the side_bar
    // because the function closure trick doesnt work there
    var gmarkers = [];
    var i = 0;
    // A function to create the marker and set up the event window
    function createMarker(point,name,html) {
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(html);
    // save the info we need to use later for the side_bar
    gmarkers[i] = marker;
    // add a line to the side_bar html
    side_bar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
    i++;
    return marker;
    // This function picks up the click and opens the corresponding info window
    function myclick(i) {
    GEvent.trigger(gmarkers, "click");
    // create the map
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng( 37.251699,-119.604315), 7);
    *// Read the data from testXML2blackpoolformat.xml*
    var request = GXmlHttp.create();
    request.open("GET", "testXML2blackpoolformat.xml", true);
    *request.onreadystatechange = function() {*
    *if (request.readyState == 4) {*
    var xmlDoc = GXml.parse(request.responseText);
    *// obtain the array of markers and loop through it*
    var markers = xmlDoc.documentElement.getElementsByTagName("ConnectoryRecord");
    *for (var i = 0; i < markers.length; i++) {*
    *// obtain the attribues of each marker*
    *var lat = parseFloat(markers[i].getAttribute("lat"));*
    *var lng = parseFloat(markers[i].getAttribute("lng"));*
    var point = new GLatLng(lat,lng);
    *var html = markers[i].getAttribute("html");*
    *var label = markers[i].getAttribute("label");*
    *// create the marker*
    var marker = createMarker(point,label,html);
    map.addOverlay(marker);
    // put the assembled side_bar_html contents into the side_bar div
    document.getElementById("side_bar").innerHTML = side_bar_html;
    request.send(null);
    else {
    alert("Sorry, the Google Maps API is not compatible with this browser");
    // This Javascript is based on code provided by the
    // Blackpool Community Church Javascript Team
    // http://www.commchurch.freeserve.co.uk/
    // http://econym.googlepages.com/index.htm
    //]]>
    </script>
    </body>
    </html>
    Here is my delima--
    This is the xml format that I need to use because it can accept the rest of my excel file and loop it through the 14,000+ records to create a functioning xml file. This is just a sample (2 records) of the larger file:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <ConnectoryAug2008>
    <ConnectoryRecord>
         <lng>-117.03683</lng>
         <lat>32.944505</lat>
         <ConnectoryID>1</ConnectoryID>
         <Name>$2.95 Guys</Name>
         <StreetAddress>13750 Stowe Drive</StreetAddress>
         <City>Poway</City>
         <State>CA</State>
         <Zip>92064</Zip>
    <Marker>White</Marker>
         <IndustryGroup>Technical Services</IndustryGroup>
         <ConnectoryProfileLink>http://connectory.com/search/profile_view.aspx?connectoryId=1</ConnectoryProfileLink>
    </ConnectoryRecord>
    <ConnectoryRecord>
         <lng>-117.272843</lng>
         <lat>33.13337</lat>
         <ConnectoryID>2</ConnectoryID>
         <Name>(GLDS) Great Lakes Data Systems</Name>
         <StreetAddress>5954 Priestly Drive</StreetAddress>
         <City>Carlsbad</City>
         <State>CA</State>
         <Zip>92008</Zip>
    <Marker>Orange</Marker>
         <IndustryGroup>Technology</IndustryGroup>
         <ConnectoryProfileLink>http://connectory.com/search/profile_view.aspx?connectoryId=2</ConnectoryProfileLink>
    </ConnectoryRecord>
    </ConnectoryAug2008>
    This is the tutorial where I found the formatting techniques to successfully create the large xml file that will format/convert my excel file properly: http://www.mrexcel.com/tip064.shtml
    These variables should appear as html in the info bubble:
    <ConnectoryID>2</ConnectoryID>
         <Name>(GLDS) Great Lakes Data Systems</Name>
         <StreetAddress>5954 Priestly Drive</StreetAddress>
         <City>Carlsbad</City>
         <State>CA</State>
         <Zip>92008</Zip>
    <IndustryGroup>Technology</IndustryGroup>
         <ConnectoryProfileLink>http://connectory.com/search/profile_view.aspx?connectoryId=2</ConnectoryProfileLink>
    The "Marker" variable instructs Google Maps to label the marker with a particular color. I will be so grateful to the person(s) that helps me get through this wall that I have been hitting for a long time. It's very difficult without having the luxury of peers who know about these types of issues.
    Thank you!!

    Here is the relationship: They both contain geographic coordinates that produce a point on a map. I will use the rest of the information in the second xml file (company name, address, link, etc.) to produce the information for the bubble that will pop up once the marker is clicked.
    My problem is that I need to try to keep the second xml file in a relatively similar format, so the rest of my records will still be accepted. If I had a smaller amount of records I could place them directly into the javascript, but because there are so many records, I need to use an xml file that can be retrieved by the java script. I chose to use the second type of xml file because I can easily copy and past the 14,000+ records that are now in excel document.
    After the xml issue is corrected I need to rework the javascript that is now emboldened so that it will read the new xml file correctly. I included the first xml file so that the readers will understand what type of xml format is currently being used to produce the markers in the tutorial map.

  • Help creating a script for backup

    Hi everybody,
    I would like to make some backups using rman and recovery flash area on oracle10g on my Debian.
    I would like to make a full backup level 0 on Sunday and make incremental backups from Monday to saturday.The best would be to have one for hot backup and one for cold backups.
    But I am wondering how to schedule a task using rman. For example is it possible to write a script that would make the backups at a desired time executed by oracle?
    Or do I have to create a script on unix that should be executed by cron?
    You know I am really bad at scripting, but it would really help me if you could help me creating a script that would make the backup automatically on sunday at midnight and incremental eveydays until sunday.Here is the information I need to put in a script:
    #flash recovery area creation under sqlplus
    SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 10g SCOPE=BOTH SID='*';
    SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = '/home/oracle/flash_recovery_area' SCOPE=BOTH SID='*';
    #setting the default variable
    ORACLE_SID=iscream;
    #connect to target database:
    rman TARGET SYS/oracle@iscream NOCATALOG
    #set the defaults values for rman
    CONFIGURE DEFAULT DEVICE TYPE TO DISK;
    CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
    CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
    CONFIGURE BACKUP OPTIMIZATION ON;
    Any help will be appreciated
    synthese
    hot backup
    using rman
    using flash_recovery_area
    full backup set compressed on sunday
    incremental backup set compressed from mondy to saturday
    using disk
    policy retenttion 7 days
    redondance 2

    You can backup using some unix shell scripts.
    rman is not really good one.

  • Ihave created a script, i need to email in pdf format.

    Hi Experts,
    There are 2 criterias...
    1. criteria
    I have created a script, i need to mail it. Please give me a step by step guide to perform it .. . Please give the comments in all the functional module to be used.
    Do we have to write a separate program to send email or in the same program. i'll post my program along with this mail. I'm using this program to display report after delivery on that particular date.
    REPORT  ZREPORTTOEMAIL LINE-SIZE 400.
    data : count, i  type i.
    TABLES :  VBFA,         "Sales Document Flow
              VBAK,
              KNA1,
              VBKD,
              VBAP,
              LIPS,
              LIKP,
              KONP,
              KOMK,
              KOMP,
              zkna1,
              konv.
    data : l_vbeln like vbfa-vbeln,
           l_posnr like vbfa-posnn,
           l_KNUMV like vbak-KNUMV,
           L_BILL_ITEM LIKE vbfa-posnn ,
           l_netwr like vbrp-netwr,
           l_MWSBP like vbrp-mwsbp.
    DATA: BEGIN OF TKOMV OCCURS 50.
            INCLUDE STRUCTURE KOMV.
    DATA: END OF TKOMV.
    DATA: BEGIN OF TKOMVD OCCURS 50.
            INCLUDE STRUCTURE KOMVD.
    DATA: END OF TKOMVD.
    TYPE-POOLS: SLIS.
    DATA: FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
          HEADING  TYPE SLIS_T_LISTHEADER,
          LAYOUT   TYPE SLIS_LAYOUT_ALV,
          EVENTS   TYPE SLIS_T_EVENT,
          REPNAME  LIKE SY-REPID,
          F2CODE   LIKE SY-UCOMM VALUE  '&ETA',
          G_SAVE(1) TYPE C,
          G_EXIT(1) TYPE C,
          G_VARIANT LIKE DISVARIANT,
          GX_VARIANT LIKE DISVARIANT.
    DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
    CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    DATA: BEGIN OF itab occurs 0,
            kunnr like likp-kunnr,      "ship to party
            NAME2   LIKE  KNA1-NAME1,   "text
            ORT01   LIKE  KNA1-ORT01,   "City
            BSTNK   LIKE  VBAK-BSTNK,   "customer P O
            BSTDK   LIKE  VBAK-BSTDK,   "date
            vbeln like likp-vbeln,      "delivery
            ernam like likp-ernam,      "person
            vstel like likp-vstel,      "shipping point
            vkorg like likp-vkorg,      "sales org
            lfdat like likp-lfdat,      "delivery date
            kunag like likp-kunag,      "sold to party
            NAME1   LIKE  KNA1-NAME1,   "text
            bil_to like VBAK-KUNNR,
            name3 like kna1-name1,
            traid like likp-traid,      "transport/vehicle no
            BOLNR LIKE LIKP-BOLNR,
            wadat_ist like likp-wadat_ist, "good mov. date
            posnr like lips-posnr,      "item
            matnr like lips-matnr,      "material
            arktx like lips-arktx,      "item text
            matkl like lips-matkl,      "mat group
            werks like lips-werks,      "plant
            lgort like lips-lgort,      "stoage location
            lfimg like lips-lfimg,      "del qty
            MEINS LIKE LIPS-MEINS,
            vrkme like lips-vrkme,      "sales unit
            UMVKZ LIKE LIPS-UMVKZ,
            UMVKN LIKE LIPS-UMVKN,
            charg like lips-charg,      "batch
            vgbel like lips-vgbel,      "reference doc
            mtart like lips-mtart,      "mat type
            vkbur like lips-vkbur,      "sales office
            vkgrp like lips-vkgrp,      "sales group
            vtweg like lips-vtweg,      "Distribution Channel
            spart like lips-spart,      "division
            billno like vbak-vbeln,
            basic like komvd-kwert,
            budat like bkpf-budat,
            fin_amt like vbrp-NETWR,
    END OF itab.
    data : begin of jtab occurs 0,
    kunnr like likp-kunnr,
    name2 like kna1-name2,
    vbeln like likp-vbeln,
    zkunnr like zkna1-zkunnr,
    zname like zkna1-zname,
    end of jtab.
    SELECTION-SCREEN SKIP 1 .
    SELECTION-SCREEN BEGIN OF BLOCK BLOCK1 WITH FRAME TITLE TEXT-003.
    SELECT-OPTIONS   : ABC FOR LIKP-WADAT_IST DEFAULT SY-DATUM
                                  NO INTERVALS   .
    SELECT-OPTIONS   : S_MATNR FOR  LIPS-MATNR NO INTERVALS   .
    SELECT-OPTIONS   : S_VKORG FOR  LIKP-VKORG NO INTERVALS.
    SELECT-OPTIONS   : S_VSTEL FOR  LIKP-VSTEL NO INTERVALS.
    SELECT-OPTIONS   : S_VKBUR FOR  LIKP-VKBUR NO INTERVALS.
    SELECT-OPTIONS   : S_VKGRP FOR  LIPS-VKGRP.
    SELECT-OPTIONS   : S_SPART FOR  LIPS-SPART.
    SELECT-OPTIONS   : S_VBELN3 FOR  LIKP-VBELN.
    SELECT-OPTIONS   : S_MATKL FOR  LIPS-MATKL NO INTERVALS,
                       S_KUNAG FOR LIKP-KUNAG.
    SELECTION-SCREEN  END OF BLOCK BLOCK1.
    select * from likp into corresponding fields of itab
                  WHERE  WADAT_IST IN ABC
                  AND    VBELN IN S_VBELN3
                  AND    VKORG IN S_VKORG
                  and VSTEL in S_VSTEL
                  AND VKBUR IN S_VKBUR
                  and lfart like 'Z%'
                  AND    VBTYP = 'J'
                  AND KUNAG IN S_KUNAG.
    select * from lips into corresponding fields of itab
                    WHERE VBELN =  ITAB-VBELN
                    AND   MATNR IN S_MATNR
                    AND   MATKL IN S_MATKL
                    AND VKBUR IN S_VKBUR
                    AND VKGRP IN S_VKGRP
                    AND SPART IN S_SPART.
    IF ITAB-VRKME = 'RM' AND ITAB-MEINS = 'KG'.
    ITAB-LFIMG = ITAB-LFIMG * ( ITAB-UMVKZ / ITAB-UMVKN ).
    ITAB-VRKME = 'KG'.
    ENDIF.
    SELECT SINGLE BSTNK BSTDK INTO (ITAB-BSTNK,ITAB-BSTDK) FROM VBAK
                     WHERE VBELN = ITAB-VGBEL.
    SELECT SINGLE NAME1 ORT01 FROM KNA1 INTO (ITAB-NAME2,ITAB-ORT01)
                                 WHERE KUNNR = ITAB-KUNNR.
    SELECT SINGLE NAME1 FROM KNA1 INTO ITAB-NAME1
                                 WHERE KUNNR = ITAB-KUNAG.
    *select single vbeln POSNN into (itab-billno,L_BILL_ITEM)  from vbfa where VBELV = itab-vbeln
    *and POSNV = itab-posnr and VBTYP_N in ('M','U').
    select vbeln POSNN from vbfa up to 1 rows into (itab-billno,L_BILL_ITEM)   where VBELV = itab-vbeln
    and POSNV = itab-posnr and VBTYP_N in ('M','U') order by vbeln DESCENDING .
    endselect.
    select single * from vbfa where vbelv = itab-billno and posnv = l_bill_item and
    vbtyp_n = 'N'.
    if sy-subrc = 0.
    clear : itab-billno, l_bill_item.
    endif.
    select single budat from bkpf into itab-budat where xblnr = itab-billno and
    blart = 'RV'.
    select single NETWR MWSBP into (l_netwr, l_MWSBP) from vbrp where vbeln = itab-billno
    and posnr = l_bill_item.
    itab-fin_amt = l_netwr + l_MWSBP.
    clear : l_netwr, l_MWSBP.
    select single kunnr from vbpa into itab-bil_to where
    vbeln = itab-BILLNO and PARVW = 'RE'.
    select single name1 into itab-name3 from kna1
    where kunnr = itab-bil_to.
    *select single VBELV POSNV from vbfa into (l_vbeln,l_posnr)
    *where VBELN = itab-vbeln and
    *POSNN = itab-posnr and VBTYP_N = 'J'.
    *select single VBELN POSNN from vbfa into (l_vbeln,l_posnr)
    *where VBELV = itab-vbeln and
    *POSNV = itab-posnr and VBTYP_N = 'M'.
    select VBELN POSNN from vbfa up to 1 rows into (l_vbeln,l_posnr)
    where VBELV = itab-vbeln and
    POSNV = itab-posnr and VBTYP_N = 'M' order by vbeln DESCENDING.
    endselect.
    select single * from vbfa where vbelv = l_vbeln and posnv = l_posnr and
    vbtyp_n = 'N'.
    if sy-subrc = 0.
    clear : l_vbeln, l_posnr.
    endif.
    if sy-subrc = 0.
    *select single KNUMv into l_KNUMv from vbak where vbeln = l_vbeln
    select single KNUMv into l_KNUMv from vbRk where vbeln = l_vbeln
    select * from konv where knumv = l_knumv and kposn = l_posnr and
    kschl in ('ZR00','ZR01','ZR02','ZOBC').
    itab-basic = itab-basic + KONV-KBETR.
    ENDSELECT.
    else.
    *select single KNUMv into l_KNUMv from ekko where ebeln = itab-vgbel.
    *select single KBETR from konv into itab-basic where knumv = l_knumv
    *and kposn = itab-posnr and kschl = 'P101'.
    select single KNUMv into l_KNUMv from VBRK where VBELN = itab-BILLNO.
    select * from konv where knumv = l_knumv and kposn = l_BILL_ITEM AND
    kschl in ('ZR00','ZR01','ZR02','ZOBC').
    itab-basic = itab-basic + KONV-KBETR.
    ENDSELECT.
    *zkna1-zkunnr = itab-kunnr.
    *insert zkna1.
    endif.
         clear : l_vbeln, L_BILL_ITEM, L_POSNR.
    APPEND ITAB.
    clear : itab-basic, itab-lfimg.
         ENDSELECT.
              clear : itab.
    ENDSELECT.
    <b>perform zscript.</b>
    *&      Form  zscript
          text
    -->  p1        text
    <--  p2        text
    FORM zscript .
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
      APPLICATION                       = 'TX'
      ARCHIVE_INDEX                     =
      ARCHIVE_PARAMS                    =
      DEVICE                            = 'PRINTER'
      DIALOG                            = 'X'
       FORM                              = 'ZREPORT2EMAIL'
       LANGUAGE                          = SY-LANGU
      OPTIONS                           =
      MAIL_SENDER                       =
      MAIL_RECIPIENT                    =
      MAIL_APPL_OBJECT                  =
      RAW_DATA_INTERFACE                = '*'
      SPONUMIV                          =
    IMPORTING
      LANGUAGE                          =
      NEW_ARCHIVE_PARAMS                =
      RESULT                            =
    EXCEPTIONS
      CANCELED                          = 1
      DEVICE                            = 2
      FORM                              = 3
      OPTIONS                           = 4
      UNCLOSED                          = 5
      MAIL_OPTIONS                      = 6
      ARCHIVE_ERROR                     = 7
      INVALID_FAX_NUMBER                = 8
      MORE_PARAMS_NEEDED_IN_BATCH       = 9
      SPOOL_ERROR                       = 10
      CODEPAGE                          = 11
      OTHERS                            = 12
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT ITAB.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'MANU'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'MAIN'
    IMPORTING
      PENDING_LINES                  =
    EXCEPTIONS
      ELEMENT                        = 1
      FUNCTION                       = 2
      TYPE                           = 3
      UNOPENED                       = 4
      UNSTARTED                      = 5
      WINDOW                         = 6
      BAD_PAGEFORMAT_FOR_PRINT       = 7
      SPOOL_ERROR                    = 8
      CODEPAGE                       = 9
      OTHERS                         = 10
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                         =
      RDI_RESULT                     =
    TABLES
      OTFDATA                        =
    EXCEPTIONS
      UNOPENED                       = 1
      BAD_PAGEFORMAT_FOR_PRINT       = 2
      SEND_ERROR                     = 3
      SPOOL_ERROR                    = 4
      CODEPAGE                       = 5
      OTHERS                         = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " zscript
    The above one is first criteria just to understand how to send mail to the customers.
    <b>Second criteria</b> is i have to send the mail to the particular customer with only their details, the process should continue until it sends to all the customers with their details for that particular date.
    Please help me out.
    I have seen so many posts in the sdn but not able to understand the functional modules, how they declare that and how does it works...
    Please provide me a good material to understand the functional module and to declare them.
    Please solve this query i'll reward them with very good points.
    Thanks in advance.
    A.Rafique.

    Hi babar haroon,
    Thanks for the link.....
    I went through that link, i created smart form but i was not able to get the results because the pgm gets terminated after executing. I'll show u the code, the code is active. Please check out and tell me if  i have missed anything in the code...
    *& Report  ZZZ_TEST3
    REPORT  ZZZ_TEST3.
    *internal table declarations
    data: i_otf type itcoo occurs 0 with header line,
          i_tline type table of tline with header line,
          i_receivers type table of somlreci1 with header line,
          i_record like solisti1 occurs 0 with header line,
    *Objects to send mail.
          i_objpack like sopcklsti1 occurs 0 with header line,
          i_objtxt like solisti1 occurs 0 with header line,
          i_objbin like solisti1 occurs 0 with header line,
          i_reclist like somlreci1 occurs 0 with header line,
    *workarea declaration.
          w_objhead TYPE soli_tab,
          w_ctrlop TYPE ssfctrlop,
          w_compop TYPE ssfcompop,
          w_return TYPE ssfcrescl,
          w_doc_chng typE sodocchgi1,
          w_data TYPE sodocchgi1,
          w_buffer TYPE string,"To convert from 132 to 255
    Variables declarations
          v_form_name TYPE rs38l_fnam,
          v_len_in LIKE sood-objlen,
          v_len_out LIKE sood-objlen,
          v_len_outn TYPE i,
          v_lines_txt TYPE i,
          v_lines_bin TYPE i.
    call function 'SSF_FUNCTION_MODULE_NAME'
    *call function '/1BCDWB/SF00000105'
          exporting
          formname = 'ZZZ_TEST2'
          importing
          fm_name = v_form_name
          exceptions
          no_form = 1
          no_function_module = 2
          others = 3.
          IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          w_ctrlop-getotf = 'X'.
          w_ctrlop-no_dialog = 'X'.
          w_compop-tdnoprev = 'X'.
         CALL FUNCTION '/1BCDWB/SF00000105'
          EXPORTING
            ARCHIVE_INDEX              =
            ARCHIVE_INDEX_TAB          = itab1
            ARCHIVE_PARAMETERS         =
            CONTROL_PARAMETERS         =
            MAIL_APPL_OBJ              =
            MAIL_RECIPIENT             =
            MAIL_SENDER                =
            OUTPUT_OPTIONS             =
            USER_SETTINGS              = 'X'
          IMPORTING
            DOCUMENT_OUTPUT_INFO       =
            JOB_OUTPUT_INFO            = wa
            JOB_OUTPUT_OPTIONS         =
          EXCEPTIONS
            FORMATTING_ERROR           = 1
            INTERNAL_ERROR             = 2
            SEND_ERROR                 = 3
            USER_CANCELED              = 4
            OTHERS                     = 5
         IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
    CALL FUNCTION v_form_name
          EXPORTING
          control_parameters = w_ctrlop
          output_options = w_compop
          user_settings = 'X'
          IMPORTING
          job_output_info = w_return
          EXCEPTIONS
          formatting_error = 1
          internal_error = 2
          send_error = 3
          user_canceled = 4
          OTHERS = 5.
          IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          i_otf[] = w_return-otfdata[].
          CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
          format = 'PDF'
          max_linewidth = 132
          IMPORTING
          bin_filesize = v_len_in
          TABLES
          otf = i_otf
          lines = i_tline
          EXCEPTIONS
          err_max_linewidth = 1
          err_format = 2
          err_conv_not_possible = 3
          OTHERS = 4.
          IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          Convert PDF from 132 to 255.
          LOOP AT i_tline.
          Replacing space by ~
          TRANSLATE i_tline USING '~'.
          CONCATENATE w_buffer i_tline INTO w_buffer.
          ENDLOOP.
    Replacing ~ by space
          TRANSLATE w_buffer USING '~'.
          DO.
          i_record = w_buffer.
          Appending 255 characters as a record
          APPEND i_record.
          SHIFT w_buffer LEFT BY 255 PLACES.
          IF w_buffer IS INITIAL.
          EXIT.
          ENDIF.
          ENDDO.
          Refresh: i_reclist,
          i_objtxt,
          i_objbin,
          i_objpack.
          clear w_objhead.
          Object with PDF.
          i_objbin[] = i_record[].
         DESCRIBE TABLE i_objbin LINES v_lines_bin.
          Object with main text of the mail.
          i_objtxt = 'Find attached the output of the smart form.'.
          APPEND i_objtxt.
         DESCRIBE TABLE i_objbin LINES v_lines_txt.
          i_objtxt = 'Regards,'.
          APPEND i_objtxt.
          i_objtxt = 'J.Jayanthi'.
          APPEND i_objtxt.
          DESCRIBE TABLE i_objtxt LINES v_lines_txt.
          Document information.
          w_doc_chng-obj_name = 'Smartform'.
          w_doc_chng-expiry_dat = sy-datum + 10.
          w_doc_chng-obj_descr = 'Smart form output'.
          w_doc_chng-sensitivty = 'F'. "Functional object
          w_doc_chng-doc_size = v_lines_txt * 255.
          Pack to main body as RAW.
          Obj. to be transported not in binary form
          CLEAR i_objpack-transf_bin.
          Start line of object header in transport packet
          i_objpack-head_start = 1.
          Number of lines of an object header in object packet
          i_objpack-head_num = 0.
          Start line of object contents in an object packet
          i_objpack-body_start = 1.
          Number of lines of the object contents in an object packet
          i_objpack-body_num = v_lines_txt.
          Code for document class
          i_objpack-doc_type = 'RAW'.
          APPEND i_objpack.
          Packing as PDF.
          i_objpack-transf_bin = 'X'.
          i_objpack-head_start = 1.
         i_objpack-head_num = 1.
          i_objpack-head_num = 0.
          i_objpack-body_start = 1.
          i_objpack-body_num = v_lines_bin.
          i_objpack-doc_type = 'PDF'.
          i_objpack-obj_name = 'Smartform'.
          CONCATENATE 'Smartform_output' '.pdf'
          INTO i_objpack-obj_descr.
          i_objpack-doc_size = v_lines_bin * 255.
          APPEND i_objpack.
          Document information.
          CLEAR i_reclist.
          e-mail receivers.
         i_reclist-receiver = '[email protected]'.
          i_reclist-receiver = '[email protected]'.
          i_reclist-express = 'X'.
          i_reclist-rec_type = 'U'. "Internet address
          APPEND i_reclist.
          Sending mail.
          CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
          document_data = w_doc_chng
          put_in_outbox = 'X'
          TABLES
          packing_list = i_objpack
          object_header = w_objhead
          contents_hex = i_objbin
          contents_txt = i_objtxt
          receivers = i_reclist
          EXCEPTIONS
          too_many_receivers = 1
          document_not_sent = 2
          document_type_not_exist = 3
          operation_no_authorization = 4
          parameter_error = 5
          x_error = 6
          enqueue_error = 7
          OTHERS = 8.
          IF sy-subrc <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    Please reply me back, it is very urgent..
    Thanks and regards.
    A.Rafique

  • How to create a scripting language in java?

    Hello,
    All that I want to do is to create a scripting language in java. I�m familiar with javacc, jsr223 and other things but don�t know how to start. The language syntax is java 5 syntax with some change and I want to generate java source code from small scripts. In fact I don�t know how other languages (like groovy) are created.
    I hope you can show me the required steps.
    Looking forward to hear from you.
    Thanks.

    That's all, huh?
    For a start, generally when I hear "scripting language" I'm thinking interpretter, not a system which creates compiled (or compilable) code.
    I get the impression that what you're talking about is what I'd call a "preprocessor" language, some extra syntax added to java which the preprocessor renders into ordinary java.
    As far as complexity is concerned, much depends on how deeply involved the extra syntax is with the embedded ordinary Java. Does you preprocessor need to understand the java, or is it just embedded as text? How easilly identified are your preprocesor statments? It's a lot easier to do this if preprocessor lines are instantly identifiable from Java code (e.g. start with a #).
    Basically the stages are always the same;
    1) Lexical analysis i.e. picking out words, operators, numbers, quoted strings.
    2) Construct a syntax tree.
    3) Generate code (in this case Java).
    Now, in this case, some of the nodes in the syntax tree may simply be chunks of undigested Java.

  • How do I create a script to do this?

    I have a photoshop file with several layers...about 100. I want to put each layers into it's own group. The name of the group must be the same as the name of the layer.
    I tried creating a action to do this but it did not work right. It only works for one layer selected individually. If I select multiple layers, then it forms nested groups.
    I was told that I can't do this using an action and I would need a script for this.
    How do I create this script?
    I am using adobe photoshop cs6 ( I think) , windows 7.

    This assumes that none of the layer are already in layerSets( group ) and none have layer locking.
    if(app.documents.length>0){
        var doc = app.activeDocument;
        while(!doc.artLayers[0].isBackgroundLayer && doc.artLayers.length>0  ){
            var newSet = doc.layerSets.add();
            newSet.name = doc.artLayers[0].name;
            doc.artLayers[0].move(newSet,ElementPlacement.INSIDE);

  • Powershell Script to create "custom" Document Library

    I have a powershell script which creates a Document Library for every user in AD.
    This works, but rather than using the default Document Library I want it use a custom Document Library.  However this isnt working.
    My script to create the default Document Library is this...
    [System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
    $site = new-object Microsoft.SharePoint.SPSite("http://servername/sitename");
    $siteweb = $site.OpenWeb();
    $webs = $siteweb.Webs;
    $strFilter = "(&(objectCategory=User)(name=accountname))"
    $objDomain = New-Object System.DirectoryServices.DirectoryEntry
    $objSearcher = New-Object System.DirectoryServices.DirectorySearcher
    $objSearcher.SearchRoot = $objDomain
    $objSearcher.PageSize = 1000
    $objSearcher.Filter = $strFilter
    $objSearcher.SearchScope = "Subtree"
    $colProplist = "samaccountname"
    foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}
    $colResults = $objSearcher.FindAll()
    foreach ($objResult in $colResults)
    $objItem = $objResult.Properties; $objItem.samaccountname
    $listTemplate = [Microsoft.SharePoint.SPListTemplateType]::DocumentLibrary
    $listId = $siteweb.Lists.Add($objItem.samaccountname, "", $listtemplate);
    $list = $siteweb.Lists.GetList($listId, $true);
    $roleDef = $siteweb.RoleDefinitions.GetByType("Contributor");
    $user = "domain\" + $objItem.samaccountname;
    $rolAssign = new-object Microsoft.SharePoint.SPRoleAssignment($user, "email", "name", "notes");
    $rolAssign.RoleDefinitionBindings.Add($roleDef);
    if(!$list.HasUniqueRoleAssignments)
    {$list.BreakRoleInheritance($true);}
    for ($i = $list.roleAssignments.Count - 1; $i -gt -1; $i--)
    { $list.RoleAssignments.Remove($i) }
    $list.RoleAssignments.Add($rolAssign);
    $list.Update();
    Now I have a custom Document Library named "TESTLIB" so if I substitute the line:
    $listTemplate = [Microsoft.SharePoint.SPListTemplateType]::DocumentLibrary
    with
    $listTemplate = [Microsoft.SharePoint.SPListTemplateType]::TESTLIB
    Then it errors with this...
    How can I script powershell to create a "custom" Document Library?
    Thanks

    The below link should help you in creating custom document library using powershell
    http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/23/use-powershell-cmdlets-to-manage-sharepoint-document-libraries.aspx
    Vinod H
    Thanks for the link but I cant see anything to assist creating a custom library?  Was there something in paticular you saw?

  • Create a script to save multiple groups into seperate png files

    Hello,
    I want to use a script to save every group I made into a '.PNG. I'm visualizing something like this, but the outputformat/name doesn't matter, as long it is a output from a group:
    group1 -> 1.png
    group2 -> 2.png
    group3 -> 3.png
    group4 -> 4.png
    etc.
    I noticed that someone create a script like that, but it isn't using for me anymore. Find here the script that isnt working for me:
    Re: Export Groups to Files?
    I am using Photoshop CC 2014 on Windows 7 (64bit).
    Looking forward to your reply! Thanks.
    Kind regards,
    Joost

    Which code cpu you use and what does
    but it isn't using for me anymore.
    mean exactly?

Maybe you are looking for

  • My imac ***** and I want to return and get a PC

    2 big bogus problems affecting my sanity. Helpviewer does not work. It does not respond. I've tried the troubleshooting steps found on this site, but to no avail. http://www.thexlab.com/faqs/helpviewer.html I keep getting the multi-language "must hol

  • Variable Substituition throwing an error for empty payload

    Hi All, I am using variable substituition in the receiver file adapter... Everything is working fine and the variable substituion is working and creating a file whenever the payload in the mapping has the filenode field for variable substituition. No

  • Regd Integrated ITS passing parameter

    Hi , We are using Integrated ITS 6.40 . SAP Basis support pack is 18. We are facing difficulty in passing parameters from Portal IAC iView through application parameter property to ITS 6.40. I have given the screenfield name in the application parame

  • LovBindings in 10g

    Hi, Two buggy issues...! I have migrated an application from JDeveloper 9i to 10g. Firstly, a number of dropdown-lists have LOV-Bindings to ViewObjects, and the selection is controlled by a panelBinding. When the list is populated no account is taken

  • Import from Expression Media

    I have a big library of pictures which I managed in Expression Media. Each picture goes through different stages like location tagged, people tagged, etc. Each such stage is represented by a particular color. Lightroom seems to have something similar