Script to export a script as run-only via AppleScript Editor

Hi,
I have written a script that's creating a new script and than save it to the desktop as run-only.
Now Apple has re-written the rules of AppleScript Editor so the run-only command had to go via 'Export' (and not 'Save' anymore).
I can't figure out how to script it now... I even tried to script the menu's but that's only possible for all menu's without '...' ending it. For example: 'File > New' is scriptable, but 'File > Export...' is not.
Script 1 is the script I want to get working, but if scripting the Export of AppleScript Editor is not possible, I want to get de workaround of Script 2
Script 1:
==================================================
set myScript to "
set studentnumber to \"" & studentnumber & "\"
set password to \"" & password & "\"
tell application \"Safari\"
tell application "AppleScript Editor"
activate
make new document with data myScript
          save document 1 as "application" in file ((path to desktop as Unicode text) & "Automatisch Inloggen op GLR.app") with run only
-- save doesn't work anymore and has to be EXPORT...
          return
close document 1
end tell
=================================================
Script 2 (workaround, but doesn't work either)
tell application "AppleScript Editor" to activate
menu_click({"AppleScript Editor", "File", "Export..."})
-- 'File > New' works but 'File > Export... not'
on menu_click(mList)
          local appName, topMenu, r
-- Validate our input
          if mList's length < 3 then error "Menu list is not long enough"
-- Set these variables for clarity and brevity later on
          set {appName, topMenu} to (items 1 through 2 of mList)
          set r to (items 3 through (mList's length) of mList)
-- This overly-long line calls the menu_recurse function with
-- two arguments: r, and a reference to the top-level menu
          tell application "System Events" to my menu_click_recurse(r, ((process appName)'s ¬
                    (menu bar 1)'s (menu bar item topMenu)'s (menu topMenu)))
end menu_click
on menu_click_recurse(mList, parentObject)
          local f, r
-- `f` = first item, `r` = rest of items
          set f to item 1 of mList
          if mList's length > 1 then set r to (items 2 through (mList's length) of mList)
-- either actually click the menu item, or recurse again
          tell application "System Events"
                    if mList's length is 1 then
  click parentObject's menu item f
                    else
                              my menu_click_recurse(r, (parentObject's (menu item f)'s (menu f)))
                    end if
          end tell
end menu_click_recurse

Applescript has changed a little. You can now save uncompiled scripts, but it would make no sense to save an uncompiled script as read-only, so trying to do that fails. Add a compile command before the save:
tell application "AppleScript Editor"
  activate
          set doc to make new document with data myScript
  compile doc
          save doc as "application" in ((POSIX path of (path to desktop)) & "Automatisch Inloggen op GLR.app") with run only
          return
  close doc
end tell

Similar Messages

  • Change application to RUN ONLY via API?

    Is it possible to set an application to be RUN ONLY via the API instead of accessing the Workspace manager? We have an environment that discourages access to the workspace manager in production and try to do as much as possible via SQL Plus..
    Right now when we migrate an application to production, we get a copy of the application from version control, modify the app to a RUN ONLY version and then pass it over to our DBA to load into production. We would prefer to made the RUN ONLY change when the app is loaded into production via SQL Plus and the APEX API...
    Any suggestions?
    Thank you,
    Tony Miller
    Ruckersville, VA

    TexasApexDeveloper wrote:
    So in theory, if you setup an anonymous block with the security and such and tried to update the flows table, you could achieve this, right???
    (I know what I am asking is unsupported, thus the "In Theory" portion of posting, just to be sure no thinks I will violate the terms that we use APEX under)..
    Thank you,
    Tony Miller
    Ruckersville, VATony,
    I understand, In theory it should be ok and here is the full update statement, and valid values for build_status column are RUN_AND_BUILD and RUN_ONLY
      update wwv_flows
      set build_status = 'RUN_ONLY'
      where id = l_id and
            security_group_id = :flow_security_group_id and
            build_status != nvl(l_build_status,'x') and
            build_status is not null;Thanks,
    Vikram

  • Exporting mail from specific subfolders only via powershell

    I am trying to create a powershell script to export mail from the specified subfolder of the inbox of an exchange 2010 mailbox to a PST.  For example, if Bobs mailbox has a folder in the inbox called salesinfo and this needs to be exported to a PST,
    but nothing else in the mailbox should be included, is there a way to do this in PowerSHell?
    I have tried new-exportrequest -mailbox bob -includefolders '#inbox#\\salesinfo' -filepath \\server\share\bob.pst
    and am getting nowhere fast.  this gets folder structure for somethings out but no mail.... exporting the whole mailbox or even the entire inbox is also no good...
    Does anyone know if there might be a way to do this?
    thanks much
    Derek
    Derek Schauland, MCSE, MCTS Active Directory | Microsoft MVP - File System Storage | Author - Training Guide Configuring Windows 8 MS Press | Technology Addict

    Hello Derek,
    There are parameters that you can use to export specific folders however these days Exchange forums are getting attacked by third party product person so having lack of quality :)
    You can use IncludeFolder or ExlcudeFolder switch to choose specific folder or exclude folders that you don't want...
    For example for default folder (you can use #defaultfoldername#)... 
    New-MailboxExportRequest -Mailbox Kweku -IncludeFolders "#Inbox#" -FilePath \\SERVER01\PSTFileShare\Kweku\LegalHold.pst
    If you want to include multiple folders then here is an example...
    New-MailboxExportRequest -Mailbox Kweku -IncludeFolders "#Contacts#","rootfoldername/subfoldername"  -FilePath \\SERVER01\PSTFileShare\Kweku\LegalHold.pst
    If you want to include all subfolder of a root folder then here is the switch...
    -IncludeFolders "rootfoldername/*"
    New-MailboxExportRequest - http://technet.microsoft.com/en-us/library/ff607299(v=exchg.141).aspx

  • Applescript won't run as .app but runs fine in AppleScript Editor

    I'm an experienced web developer.. but total applescript noob. so forgive me if this is a silly question.
    I'm calling my script it from Flash via fscommand to launch a PDF using finder, rather than a browser.
    The script works great from AppleScript Editor when i hit run but when saved as a .app it doesn't run.
    any ideas?
    Here's the code:
    property fileName : "my.pdf"
    set myPath to (path to me as string)
    set AppleScript's text item delimiters to ":"
    set the parentFolder to ¬
    ((text items 1 thru -2 of myPath) & "") as string
    set AppleScript's text item delimiters to ""
    try
    set targetFile to alias (the parentFolder & fileName)
    on error
    return quit
    end try
    tell application "Finder"
    open file targetFile
    end tell

    A script application is actually an application bundle - a bundle is a kind of folder that gets treated like a single item (in this case, an application). Getting path to me results in a path that ends with a colon (since it is a folder), so when you try to use text item delimiters to get the container you are actually just stripping off the trailing colon, so the path built for your file won't point to the correct location.
    As previously posted, the Finder can get the container, so you can just do everything in a tell application "Finder" statement:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    property fileName : "my.pdf"
    set myPath to (path to me)
    tell application "Finder"
    set the parentFolder to container of myPath
    try
    open file ((parentFolder as text) & fileName)
    end try
    end tell
    </pre>

  • Enterprise Manager Job for Scripting DataPump Export for Oracle Database Running On MS Windows Server 2008

    Greetings,
    I would like an example of an Enterprise Manager Job that uses an OS Script for MS Windows that would effectively run a datapump export of my Oracle 11g database (11.2.0.3) running on a Windows 2008 server.  My OEM OMS is running on a Linux server with an Oracle 12c repository.  I'd like to be able to set environment variables for date and time, my export file name (that includes SID, and export date and time, job name, and other information pertinent to the datapump export.  Thus far, I have been unsuccessful with using the % delimiter around my variables.  Also, I have put the "cmd/c" as the "Interpreter" but I am not getting anywhere in a hurry :-( 
    Thanks  Million!!!
    Mike

    1. Try to reach server with IP )(bypath name resolution)
    2. Disabling IPv6 is not good idea
    3. What is server operating system and what is workstation operating system?
    4. Is this new or persistent problkem?
    5. If server and workstation has different SMB version, set higher to lower one (see Petri web for procedure)
    6. Uninstall AV with removal tool and test it without AV
    7. Use network monitor to diagnose network traffic.
    M.

  • Export hard drive dir as XML via AppleScript?

    Does anyone know of a utility (even an AppleScript) that can take my hard drive (or a specific folder therein) and write the whole directory out (including nested folder structures) as an XML document? Need it urgently!

    global eof_character
    global indent_string
    set eof_character to the ASCII character of 0
    set indent_string to " "
    set thestartingpoint to choose folder with prompt "Pick a folder to list as (not-quite-)XML." with invisibles and showing package contents
    set include_invisibles to (the button returned of (display dialog "Do you want to include invisible items in the listing?" buttons {"No", "Yes"} default button "Yes") is "Yes")
    set show_permissions to (the button returned of (display dialog "Do you want to include permissions (file owner, read/write/execute, etc.) in the listing?" buttons {"No", "Yes"} default button "Yes") is "Yes")
    set output_file to open for access (choose file name with prompt "Where should the pseudo-XML be written?" default name "Not Really XML.xml") with write permission
    try
         set the_info to info for thestartingpoint
         set the_kind to "folder"
         if the kind of the_info is "Volume" then set the_kind to "volume"
         set permissions_info to getpermissions_info(the_startingpoint)
         set the_contents to ""
         set insufficientaccess_tolist to "true"
         if item 1 of permissions_info is "1" then
              set the_contents to xmlfolder(the_startingpoint, indent_string, include_invisibles, show_permissions)
              set insufficientaccess_tolist to missing value
         end if
         set permissions_pairs to {}
         if show_permissions then
              set permissions_pairs to {{"permissions", item 2 of permissions_info}, {"owner", item 3 of permissions_info}, {"owner_id", item 4 of permissions_info}, {"group", item 5 of permissions_info}, {"group_id", item 6 of permissions_info}}
         end if
         write xml_entity("", the_kind, {{"name", the name of the_info}, {"creation_date", the creation date of the_info}, {"modification_date", the modification date of the_info}, {"extension_hidden", the extension hidden of the_info}, {"visible", the visible of the_info}, {"insufficientaccess_tolist", insufficientaccess_tolist}} & permissions_pairs, the_contents) to output_file as string
         close access output_file
    on error msg number num
         close access output_file
         error msg number num
    end try
    on xmlfolder(thefolder, the_indent, include_invisibles, show_permissions)
         set the_result to ""
         set the_path to (the_folder as alias) as string
         set the_list to list folder the_folder invisibles include_invisibles
         repeat with x in the_list
              set the_item to ((the_path & x) as alias)
              set the_info to info for the_item
              set permissions_info to getpermissions_info(theitem)
              set permissions_pairs to {}
              if show_permissions then
                   set permissions_pairs to {{"permissions", item 2 of permissions_info}, {"owner", item 3 of permissions_info}, {"owner_id", item 4 of permissions_info}, {"group", item 5 of permissions_info}, {"group_id", item 6 of permissions_info}}
              end if
              set standard_pairs to {{"name", the name of the_info}, {"creation_date", the creation date of the_info}, {"modification_date", the modification date of the_info}, {"extension_hidden", the extension hidden of the_info}, {"visible", the visible of the_info}}
              if the alias of the_info then
                   tell application "Finder" to set the_original to (the original item of alias file the_item) as alias
                   set the_result to the_result & xmlentity(theindent, "alias", standard_pairs & {{"original", the_original}} & permissions_pairs, "")
              else
                   if the folder of the_info then
                        set the_contents to ""
                        set insufficientaccess_tolist to "true"
                        if item 1 of permissions_info is "1" then
                             set the_contents to xmlfolder(theitem, the_indent & indent_string, include_invisibles, show_permissions)
                             set insufficientaccess_tolist to missing value
                        end if
                        set the_result to the_result & xmlentity(theindent, "folder", standard_pairs & {{"insufficientaccess_tolist", insufficientaccess_tolist}} & permissions_pairs, the_contents)
                   else
                        set the_result to the_result & xmlentity(theindent, "file", standard_pairs & {{"locked", the locked of the_info}, {"size", the size of the_info}, {"type", the file type of the_info}, {"creator", the file creator of the_info}} & permissions_pairs, "")
                   end if
              end if
         end repeat
         return the_result
    end xml_folder
    on xmlentity(theindent, the_name, the_attributes, the_contents)
         set the_result to ""
         repeat with x in the_attributes
              set the_result to the_result & xml_attribute(item 1 of x, item 2 of x)
         end repeat
         if the_contents is "" then
              set the_result to the_indent & "<"<">" & return & the_contents & the_indent & "</""
         else
              return " " & the_label & "=\"" & xmlescape(thevalue) & "\""
         end if
    end xml_attribute
    on xmlescape(thestring)
         set the_string to the_string as string
         if (the offset of eof_character in the_string) > 0 then
              return eofavoider(thestring)
         else
              return do shell script ("perl -e 'my $a = $ARGV[0]; $a =~ s/&/&/g; $a =~ s/</</g; $a =~ s/>/>/g; $a =~ s/\"/"/g; while ( $a =~ m/^(.)([\x01-\x1F])(.)$/s ) { $a = $1 . \"&#\" . ord($2) . \"" . $3; } print $a;' " & the quoted form of the_string)
         end if
    end xml_escape
    on eofavoider(thestring)
         if the_string is eof_character then
              return "&#0;"
         else
              set the_offset to the offset of eof_character in the_string
              if the_offset is 0 then
                   return xmlescape(thestring)
              else
                   if the_offset is 1 then
                        return "&#0;" & xml_escape(text 2 through -1 of the_string)
                   else
                        return xml_escape(text 1 through (the_offset - 1) of the_string) & eof_avoider(text the_offset through -1 of the_string)
                   end if
              end if
         end if
    end eof_avoider
    on getpermissions_info(theitem)
         return the paragraphs of (do shell script ("perl -e 'my @a = lstat($ARGV[0]); my @u = getpwuid($a[4]); my @g = getgrgid($a[5]); printf \"%d\\n%04o\\n%s\\n%d\\n%s\\n%d\", ( ( -r $ARGV[0] ) ? ( 1 ) : ( 0 ) ), $a[2] & 07777, $u[6], $u[2], $g[0], $g[2];' " & the quoted form of (the POSIX path of the_item)))
    end getpermissionsinfo

  • Applescript - save as "run only" gone missing

    Did OS X 10.7 do away with the ability to save Applescripts as run-only?  I just noticed that all my scripts compiled and saved previously as "run only" now have the Rosetta prohibitory symbol on them.
    Is there a work-around for saving Applescripts as run-only?  I prefer to open Applescript, run the compiled script in the background, then quit.

    On Mountain Lion I had the same problem. But it wasn't solved by choosing duplicate. When I chose application I only had the options, "Show start up screen" and "Stay open after run handler".
    The help menu suggested that "Run only" should be there but it is not.
    Anyone have any ideas?

  • Write xmp sidecar files without need to export masters - script

    I've written a script to write xmp sidecar files for referenced and online images (the 2 conditions in the script) of the selected images. I looked for a while at system events and other stuff to be able to write the xmp file, but i'm not a programmer, so in the end i chose the long and dirty way to do it.
    This script will export all iptc expanded fields as aperture does (creating basically the same file). It can be easily adjusted to include other tags, even custom ones. I don't know how to get at the adjustments for images, otherwise those could be included as well.
    If anyone has the energy to clean this up and make it faster, feel free to do so. Next, I'm going to try to write a script to do the opposite, import xmp sidecars for imported online and referenced files.
    Here it goes (thanks to Brett Gross for the database part to find the master filename):
    --script to create sidecar xmp files for referenced files without having to export masters. parts of the script (finding the file name) are by brett gross
    property p_sql : "/usr/bin/sqlite3 "
    global g_libPath
    on run
    my getLibPath()
    --counter for processed images, reset, just in case
    set mastercount to 0
    tell application "Aperture"
    if not (exists selection) then
    display dialog "You have to select at least one image" buttons {"OK"} default button 1
    return
    else
    display dialog "You have selected " & (count of selection) & " images." & return & "Continue?" default button 1
    end if
    set theSel to selection
    --run through the selected images
    repeat with currentpic from 1 to count of theSel
    tell item currentpic of theSel
    -- only apply to referenced and online images
    if referenced and online then
    set mastercount to mastercount + 1
    set curID to id
    --find the master file path and name - this part by brett gross, thanks
    set libPOSIX to POSIX path of g_libPath
    set libDBPOSIX to (libPOSIX & "/Aperture.aplib/Library.apdb") as string
    set theScript to p_sql & (quoted form of libDBPOSIX) & " \"select ZFILEUUID from ZRKVERSION where ZUUID='" & curID & "'\""
    set ZFILEUUID to do shell script theScript
    # ---------- Get the master's path
    set theScript to p_sql & (quoted form of libDBPOSIX) & " \"select ZIMAGEPATH from ZRKFILE where ZUUID='" & ZFILEUUID & "'\""
    set ZIMAGEPATH to do shell script theScript
    # ---------- Get the master's disk name
    set theScript to p_sql & (quoted form of libDBPOSIX) & " \"select ZFILEVOLUMEUUID from ZRKFILE where ZUUID='" & ZFILEUUID & "'\""
    set ZFILEVOLUMEUUID to do shell script theScript
    set theScript to p_sql & (quoted form of libDBPOSIX) & " \"select ZNAME from ZRKVOLUME where ZUUID='" & ZFILEVOLUMEUUID & "'\""
    set diskName to do shell script theScript
    set imgPath to (diskName & "/" & ZIMAGEPATH)
    --end brett gross part
    --strips extension, seems to work for files and paths with more than one period
    set oldlim to AppleScript's text item delimiters
    set AppleScript's text item delimiters to "."
    try --remove last extension only
    set contador to text item -1 of imgPath
    set noExtension to Unicode text 1 thru -((count of contador) + 2) of imgPath
    on error --handle files with no extensions
    set noExtension to imgPath
    end try
    set AppleScript's text item delimiters to oldlim
    --create the file and path name with the .xmp extension for writing
    set xmpPath to "/Volumes/" & noExtension & ".xmp" as Unicode text
    --convert posix path to alias for easier write and read handling
    set xmpPath to POSIX file xmpPath as file specification
    -- header for xmp file
    set xmpheader to ("<?xpacket begin='' id=''?>
    <x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 2.9-9, framework 1.6'>
    <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>") & return
    -- footer for xmp file
    set xmpfooter to ("</rdf:RDF>
    </x:xmpmeta>
    <?xpacket end='w'?>") & return
    --xmp content, part 1
    --check for existence of iptc tags, create content or empty string depending on existance of tags
    if (exists IPTC tag "Contact") or (exists IPTC tag "Country/PrimaryLocationCode") then
    set xmpcontentpartone to ("<rdf:Description rdf:about='' xmlns:Iptc4xmpCore='http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/'>") & return
    try
    set CountryCode to value of IPTC tag "Country/PrimaryLocationCode"
    set xmpcontentpartone to xmpcontentpartone & tab & "<Iptc4xmpCore:CountryCode>" & CountryCode & "</Iptc4xmpCore:CountryCode>" & return
    end try
    try
    set CreatorContactInfo to value of IPTC tag "Contact"
    set xmpcontentpartone to xmpcontentpartone & tab & "<Iptc4xmpCore:CreatorContactInfo>" & CreatorContactInfo & "</Iptc4xmpCore:CreatorContactInfo>" & return
    end try
    set xmpcontentpartone to xmpcontentpartone & ("</rdf:Description>") & return
    else
    set xmpcontentpartone to ""
    end if
    --xmp content, part 2
    --check for existence of iptc tags, create content or empty string depending on existance of tags
    if (exists IPTC tag "Category") or (exists IPTC tag "City") or (exists IPTC tag "Country/PrimaryLocationName") or (exists IPTC tag "Credit") or (exists IPTC tag "DateCreated") or (exists IPTC tag "Headline") or (exists IPTC tag "Province/State") or (exists IPTC tag "Source") or (exists IPTC tag "SpecialInstructions") or (exists IPTC tag "SupplementalCategory") or (exists IPTC tag "Writer/Editor") then
    set xmpcontentparttwo to ("<rdf:Description rdf:about='' xmlns:photoshop='http://ns.adobe.com/photoshop/1.0/'>") & return
    try
    set Category to value of IPTC tag "Category"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Category>" & Category & "</photoshop:Category>" & return
    end try
    try
    set City to value of IPTC tag "City"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:City>" & City & "</photoshop:City>" & return
    end try
    try
    set Country to value of IPTC tag "Country/PrimaryLocationName"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Country>" & Country & "</photoshop:Country>" & return
    end try
    try
    set Credit to value of IPTC tag "Credit"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Credit>" & Credit & "</photoshop:Credit>" & return
    end try
    try
    set DateCreated to value of IPTC tag "DateCreated"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:DateCreated>" & DateCreated & "</photoshop:DateCreated>" & return
    end try
    try
    set Headline to value of IPTC tag "Headline"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Headline>" & Headline & "</photoshop:Headline>" & return
    end try
    try
    set State to value of IPTC tag "Province/State"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:State>" & State & "</photoshop:State>" & return
    end try
    try
    set Source to value of IPTC tag "Source"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Source>" & Source & "</photoshop:Source>" & return
    end try
    try
    set Instructions to value of IPTC tag "SpecialInstructions"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:Instructions>" & Instructions & "</photoshop:Instructions>" & return
    end try
    try
    set SupplementalCategory to value of IPTC tag "SupplementalCategory"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:SupplementalCategory>" & SupplementalCategory & "</photoshop:SupplementalCategory>" & return
    end try
    try
    set CaptionWriter to value of IPTC tag "Writer/Editor"
    set xmpcontentparttwo to xmpcontentparttwo & tab & "<photoshop:CaptionWriter>" & CaptionWriter & "</photoshop:CaptionWriter>" & return
    end try
    set xmpcontentparttwo to xmpcontentparttwo & ("</rdf:Description>") & return
    else
    set xmpcontentparttwo to ""
    end if
    --xmp content, part 3
    --check for existence of iptc tags, create content or empty string depending on existance of tags
    if (exists IPTC tag "Byline") or (exists IPTC tag "Caption/Abstract") or (exists IPTC tag "CopyrightNotice") or (exists IPTC tag "Keywords") or (exists IPTC tag "ObjectName") then
    set xmpcontentpartthree to ("<rdf:Description rdf:about='' xmlns:dc='http://purl.org/dc/elements/1.1/'>") & return
    try
    set creator to value of IPTC tag "Byline"
    set xmpcontentpartthree to xmpcontentpartthree & tab & "<dc:creator><rdf:Seq><rdf:li>" & creator & "</rdf:li></rdf:Seq></dc:creator>" & return
    end try
    try
    set description to value of IPTC tag "Caption/Abstract"
    set xmpcontentpartthree to xmpcontentpartthree & tab & "<dc:description><rdf:Alt><rdf:li xml:lang='x-default'>" & description & "</rdf:li></rdf:Alt></dc:description>" & return
    end try
    try
    set rights to value of IPTC tag "CopyrightNotice"
    set xmpcontentpartthree to xmpcontentpartthree & tab & "<dc:rights><rdf:Alt><rdf:li xml:lang='x-default'>" & rights & "</rdf:li></rdf:Alt></dc:rights>" & return
    end try
    --keywords, slightly different, as they need to be written as a list and not as a string
    --i don't think it's a problem if we create an empty list if there are no keywords present.
    set xmpcontentpartthree to xmpcontentpartthree & tab & "<dc:subject><rdf:Bag>" & return
    --make list item for every keyword
    try
    repeat with n from 1 to count of keywords
    set cursubject to name of (keyword n)
    set xmpcontentpartthree to xmpcontentpartthree & tab & tab & "<rdf:li>" & cursubject & "</rdf:li>" & return
    end repeat
    end try
    set xmpcontentpartthree to xmpcontentpartthree & tab & "</rdf:Bag></dc:subject>" & return
    try
    set title to value of IPTC tag "ObjectName"
    set xmpcontentpartthree to xmpcontentpartthree & tab & "<dc:title><rdf:Alt><rdf:li xml:lang='x-default'>" & title & "</rdf:li></rdf:Alt></dc:title>" & return
    end try
    set xmpcontentpartthree to xmpcontentpartthree & ("</rdf:Description>") & return
    else
    set xmpcontentpartthree to ""
    end if
    --part four. aperture doesn't seem to export anything there
    set xmpcontentpartfour to "<rdf:Description rdf:about='' xmlns:photomechanic='http://ns.camerabits.com/photomechanic/1.0/'>
    </rdf:Description>" & return
    --part five. rating
    set xmpcontentpartfive to "<rdf:Description rdf:about='' xmlns:xap='http://ns.adobe.com/xap/1.0/'>" & return
    try
    set Rating to main rating
    set xmpcontentpartfive to xmpcontentpartfive & tab & "<xap:Rating>" & Rating & "</xap:Rating>" & return
    end try
    set xmpcontentpartfive to xmpcontentpartfive & "</rdf:Description>" & return
    --join everything
    set xmptext to xmpheader & xmpcontentpartone & xmpcontentparttwo & xmpcontentpartthree & xmpcontentpartfour & xmpcontentpartfive & xmpfooter
    --write file
    my writexmpFile(xmptext, xmpPath)
    end if
    end tell
    end repeat
    display dialog "Processed " & mastercount & " referenced and online image(s)." buttons {"OK"} default button 1
    end tell
    end run
    -- write xmp sidecar file routine
    on writexmpFile(theContents, xmpFileName)
    --tell application "Finder"
    try
    open for access xmpFileName with write permission
    set eof of xmpFileName to 0
    write (theContents) to xmpFileName starting at eof
    close access xmpFileName
    on error
    try
    display dialog xmpFileName
    close access xmpFileName
    end try
    end try
    --end tell
    end writexmpFile
    --this part copied from Brett Gross-------------------------------------------------------------------------- --------------------------------
    on getLibPath()
    tell application "System Events" to set p_libPath to value of property list item "LibraryPath" of property list file ((path to preferences as Unicode text) & "com.apple.aperture.plist")
    if ((offset of "~" in p_libPath) is not 0) then
    -- set p_posix to POSIX file p_libPath
    set p_script to "/bin/echo $HOME"
    set p_homePath to (do shell script p_script)
    set p_offset to offset of "~" in p_libPath
    set p_path to text (p_offset + 1) thru -1 of p_libPath
    set g_libPath to p_homePath & p_path
    else
    set g_libPath to p_libPath
    end if
    end getLibPath
    --end brett gross part

    imigra wrote:
    I've written a script to write xmp sidecar files for referenced and online images (the 2 conditions in the script) of the selected images. I looked for a while at system events and other stuff to be able to write the xmp file, but i'm not a programmer, so in the end i chose the long and dirty way to do it.
    This script will export all iptc expanded fields as aperture does (creating basically the same file). It can be easily adjusted to include other tags, even custom ones.
    Excellent stuff!
    I don't know how to get at the adjustments for images, otherwise those could be included as well.
    They are stored as binary data in the Version XML files at the bottom level of the Library package. You can also have a look around in the ZRKIMAGEADJUSTMENT table, but again the actual settings for each adjustment are in binary form.
    If anyone has the energy to clean this up and make it faster, feel free to do so.
    As far as I can remember, Aperture uses the 'proper' IPTC tag names when accessing them via AppleScript, so you may be able to do a loop through all the IPTC tags for each image, rather than picking out each specific one. But that would need checking. The EXIFTools site is a good place to find out about the different ways that IPTC data can be described.
    Next, I'm going to try to write a script to do the opposite, import xmp sidecars for imported online and referenced files.
    Don't rush unless you feel like it - I've already started planning out a free (as in beer and speech) XMP importer with a GUI so that you can choose how to map the XMP CORE tags that don't exist in Aperture. You've given me an extra idea, though - if we can decide on a set of custom tags, my importer could map the XMP CORE tags to them and your exporter could export those tags.
    Thanks for the work!
    Ian
    P.S. I'll check through your script tomorrow, some of the database tables changed between 1.5.6 and 2.0, so you might need to add in a version check to be really thorough.

  • Batch Process Export Layers Script

    I know how to break down a layered file using the Export Layers Script, and it works pretty well for me.  What I want to know is if there is a way to create an action using this script, that I can apply to multiple files and batch process in Bridge?  I have created an action that in theory should work, but I keep getting stop errors when I actually run it.  Has anyone successfully created an action that can export out multiple layers of multiple files?

    Joyce,
    Thank you.  Your suggestion helped clear my mental log jam.
    Fireworks batch scripting seems to work in reverse.
    Using "Batch Process..." scripting interface 'Export' (as JPEG) option first, 'Rename' (add Prefix) option second, and then follow these by using the history panel's 2 previously saved steps (Numeric Transform, Fit Canvas), batch process now works.  PNG file (list) is saved in targeted folder as a reduced scale JPEG with a prefixed file name.
    Batch Process allows the entire newly defined command sequence to be saved (script.js).  Placing this (renamed) file into Firework's batch look-up directory for scripts (C:\Documents and Settings\account_name\Application Data\Adobe\Fireworks CS4\Commands) does not work.  The file name does not display in "Batch Process" window "Batch options:" Commands drop-down list.
    Batch Process only works by recreating the above steps each use.
    The new (JavaScript) file is 26 KB.  Is script file size limited in Fireworks "Batch options:" feature?

  • How do I run a shell script via AppleScript?

    Seems obvious, "do shell script" but that doesn't work for me.
    I have an Automator app which runs a shell script, I'd like to take that into an AppleScript. My AS doesn't run the shell script. Perhaps "do shell script' is expecting the script to be located elsewhere? The rest of my AS runs fine, but the shell script doesn't.
    repeat with i from 1 to count of items in exportFolder
      do shell script
              "exiftool -overwrite_original -Photoshop:CopyrightFlag='True'"
      done
    end repeat
    As I say this works within an Automator app, what changes do I need to make it work in AppleScript?
    Thanks!

    Camelot wrote:
    repeat with i from 1 to count of items in exportFolder
    What is 'exportFolder'? Where is it defined?
    Thanks, 'exportFolder' is defined earlier in the script. The purpose of the script - which is run from within Aperture - is to rename the selected images, export them (to the 'exportFolder'), reset the version name and, using ExifTool, add metadata which Aperture does not write to exported JPEGs.
    I have a version of this which works in Automator but I couldn't see any clues there on setting the path to ExifTool.
    Here's the full (modified) script. Currently it returns an error
    Result:
    error "No file specified" number 1
    so I now need to understand if I can use 'exportFolder' (defined at the start) to tell Finder which folder to use.
    -- Creating filenames by making Version Name  from the IPTC Headline and Filename (with hypens where spaces exist). The Aperture Version Name is used to create the file's name on export. Once exported the Aperture Version Name is reset to its original.
    tell application "System Events"
              set exportFolder to (choose folder with prompt "Choose an export folder")
    end tell
    tell application "Aperture"
              set theSel to (get selection)
              if theSel is {} then
                        error "Please select an image or two!."
              else
                        repeat with theImg in theSel
      -- Creating a new Aperture Version Name which will become the exported file's filename.
                                  tell theImg
                                            set headline to (get value of IPTC tag "Headline" of theImg)
                                            set AppleScript's text item delimiters to " "
                                            set theTextItems to text items of headline
                                            set AppleScript's text item delimiters to "-"
                                            set headline to theTextItems as string
                                            set AppleScript's text item delimiters to {""}
                                            set objectName to (get value of IPTC tag "ObjectName" of theImg)
                                            set newVersion to (headline & "-" & objectName) as string
                                            set name of theImg to newVersion
                                  end tell
                        end repeat
      -- Exporting the files as JPEGs to chosen folder/Project Name using the Version Name as a filename
                        export theSel using export setting "JPEG - Original Size" to exportFolder
      -- Resetting the Aperture Version Name back to filename using IPTC Title (which should be the file's filename without suffex).
                        repeat with theImg in theSel
                                  tell theImg
                                            set title to (get value of IPTC tag "ObjectName" of theImg)
                                            set name of theImg to title
                                  end tell
                        end repeat
              end if
    end tell
    --Using ExifTool to set Photoshop Copyright Status etc
    tell application "Finder" to set theFiles to files of exportFolder as alias list
    repeat with eachFile in theFiles
              do shell script "/usr/bin/exiftool -overwrite_original -Photoshop:CopyrightFlag='True' -Photoshop:URL='http://davidgordon.co.uk/'" & quoted form of POSIX path of eachFile
    end repeat
    display dialog "Done that!" with icon note buttons "OK" default button 1 giving up after 10

  • Not able to Export sap script with RSTXSCRP in different languages IT,ES

    Hi all,
      I am trying to export sap script to local file using this program RSTXSCRP, but it's working fine for English but not other languages like IT,ES and DA. Even if i specify parameter in selection screen Language vector as IT. It's not exporting code from sap script for IT language. By default it's exporting only EN.
    Can you please tell me what I have to do to export sap script  from different language.
    Thank you.

    Hi!
    For Translating you can do it by
    Going in transaction SE63 -> Translation -> Abap objects -> Other Long Texts -> FS Forms and Styles.
    There you have to enter client and form name source lang. and target lang.
    Then you export it with the program RSTXSCRP in the language u have translated....
    As you have form created in English and  you can download and upload it in only  English .
    Regards.

  • Shell script for export backup in oracle 11g

    Hi,
    Oracle version 11.2.0..
    O/S-AIX
    How to write shell script for export full backup in oracle 11g and also need to remove 2 days of old backup.
    Regards,
    Raju

    How to write shell script for export full backup in oracle 11g
    Do you mean that export is your backup strategy ? is your database running in noarchivelog mode ? if so, then why ? if not so, then why not RMAN ?
    need to remove 2 days of old backup.
    If that mean remove files older than 2 days, you can use something like this :
    $ find <absolute directory path> -mtime +2 -exec rm {} \;

  • How to export Powershell script information to Sharepoint?

    I'm trying to export information gather from a Powershell script to a Sharepoint list. I've got a couple of powershell scripts that gather general server information from a server ex: server uptime, disk space, service tag, etc. and it will export the information
    to a csv file. What I would like to do is out-put the same information gathered by the powershell scripts to a Sharepoint list directly if at all possible.
    Ex:
    # all this does is reads from a list and runs a script call "boottime.ps1"
    get-content "\\%Data-Path-Of-List%\computers.txt" | %Data-Path-Of-Script%\boottime.ps1 |  Export-csv %Data-Path-For-CSV\Computers.csv
    # then just exports the information from the boottime.ps1 script to a csv file
    #I also have a script that will upload the information to a sharepoint list.
    # I found that I have to run this in version 2 of powershell, so I just open a DOS prompt in Admin Priv's and type the following
    powershell.exe -version 2.0
    # Next I make sure the Sharepoint snap-in is loaded
    if ( (Get-PSSnapin -Name Microsoft.sharepoint.powershell - erroraction silentlycontinue) -eq $null)
    Add-PsSnapin Microsoft.Sharepoint.Powershell
    $spweb = get-SPweb $spserver
    $spdata =$spweb.getlist("%URL_Of_My_List%")
    # this is the same location from the orginal Powershell script previously stated.
    $ComputerInfoFile = "%Data-Path-For-CSV%\Computers.csv"
    foreach ($rows in $tblData) {
    # here is where I add the information from my csv file
    # 2 things needs to be present
    # 1st the colums have to be present in the sharepoint site before I can upload the information
    # 2nd the columns have to the headers in my csv file
    $spItem = $spData.AddItem()
    $SpItem["ServerName"] = $row."ServerName".toString()
    $SpItem["Uptime"] = $row."Uptime".toString()
    $SpItem.Update()
    # this just disconnects from Sharepoint
    $spWeb.Dispose()
    Please dismiss all the comments it just helps me understand what the code is doing, also if this is not the correct place to post this question I appologize in adavance and ask that if this is the incorrect place to post this question please provide me a
    link to a where I can post such questions.

    Sorry for the delay in posting this, but I ended up getting working. I'll post it in the hopes that my head scratching will save someone else some head scratching:
    I ended up writting 3 PS scripts and one batch job.
    1st Batch file
    powershell.exe -version 2.0 -command
    \\%Script-Location\Get-Server-Infor-4-SP.ps1
    powershell.exe -version 2.0 -command \\%Script-Location\Delete-list-Items.ps1"
    powershell -veriosn 2.0 -command
    \\%Script-Location\Populate-SP.ps1
    1st PS script that gets the info:
    get-content
    \\%Location-Of-My-File-With-List-Of-Servers%\%name-of-file%.txt |
    \\%Location-Of-My-Script-To-get-the-Information-I-want | Export-csv
    \\%location-of-my-output\%filename%.csv
    Ex: get-content C:\scripts\computers.txt | C:\scripts\boottime.ps1 | export-csv C:\scripts\computer.csv
    2nd PS script Delete-List-Items.ps1
    # http:
    #Script 1 Boottime.ps1:
    # This script permits to get UpTime from localHost or a set of remote Computer
    # usage
    # localHost
    # .\BootTime.ps1
    # set of remote computers
    # get-content .\MyserverList.txt | .\boottime.ps1
    # Optionally pipe output to Export-Csv, ConverTo-Html
    Process {
    $ServerName = $_
    if ($serverName -eq $Null) {
    $serverName= $env:COMPUTERNAME
    $timeVal = (Get-WmiObject -ComputerName $ServerName -Query "SELECT LastBootUpTime FROM Win32_OperatingSystem").LastBootUpTime
    #$timeVal
    $DbPoint = [char]58
    $Years = $timeVal.substring(0,4)
    $Months = $timeVal.substring(4,2)
    $Days = $timeVal.substring(6,2)
    $Hours = $timeVal.substring(8,2)
    $Mins = $timeVal.substring(10,2)
    $Secondes = $timeVal.substring(12,2)
    $dayDiff = New-TimeSpan $(Get-Date –month $Months -day $Days -year $Years -hour $Hours -minute $Mins -Second $Secondes) $(Get-Date)
    $Info = "" | select ServerName, Uptime
    $Info.servername = $servername
    $d =$dayDiff.days
    $h =$dayDiff.hours
    $m =$dayDiff.Minutes
    $s = $daydiff.Seconds
    $info.Uptime = "$d Days $h Hours $m Min $s Sec"
    $Info
    #Script 2: Delete-List-Items.ps1
    # http://markimarta.com/sharepoint/delete-all-items-in-sharepoint-list-using-powershell/
    # there seems to be a problem with running this script in version 3 or later, the workaround is to run it in version 2
    # below is the cmd for doing so, just open up a DOS prompt with Admin Privileges Start-->Run-->cmd
    # type then copy and paste the following line the DOS window then you can run this script
    #powershell.exe -version 2.0
    # make sure that the Microsoft.SharePoint.PowerShell Snap-in is installed as well
    if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
    Add-PsSnapin Microsoft.SharePoint.PowerShell
    # "Enter the site URL instead http://serverurl"
    $SITEURL = "%http://serverurl%"
    $site = new-object Microsoft.SharePoint.SPSite ( $SITEURL )
    $web = $site.OpenWeb()
    "Web is : " + $web.Title
    # Enter name of the List below in the [“%List-Name%”]
    $oList = $web.Lists["%List-Name%"];
    # This echo out the name of the list its going to be deleting the records from
    "List is :" + $oList.Title + " with item count " + $oList.ItemCount
    # It’s just counting the rows/records
    $collListItems = $oList.Items;
    $count = $collListItems.Count - 1
    # Here is where it is actually deleting the records and then out put the number or the record it deleted
    for($intIndex = $count; $intIndex -gt -1; $intIndex--)
    "Deleting record: " + $intIndex
    $collListItems.Delete($intIndex);
    #Script 3: Populate-SP_Test.ps1
    # http://blogs.technet.com/b/stuffstevesays/archive/2013/07/10/3577320.aspx
    # there seems to be a problem with running this script in version 3 or later, the workaround is to run it in veriosn 2
    # below is the cmd for doing so, just open up a DOS prompt with Admin Privileges Start-->Run-->cmd
    # type then copy and paste the following line the the DOS window then you can run this script
    #powershell.exe -version 2.0
    # make sure that the Microsoft.SharePoint.PowerShell Snap-in is installed
    if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
    Add-PsSnapin Microsoft.SharePoint.PowerShell
    # Here are some more varables that can be added I was not able to get this to work
    #$SPComputerInfo="/Lists/PowershellTest/"
    # Here is where we connect and Open SharePoint List via Powershell
    $SPServer= "%http://serverurl%
    $spWeb = Get-SPWeb $SPServer
    $spData = $spWeb.GetList("%List-Name%")
    # This is the variable for the path that has the file I want to input to SharePoint List
    $InvFile="\\%location-ofList%\computers.csv"
    # This is just some error checking to make sure the file exist
    $FileExists = (Test-Path $InvFile -PathType Leaf)
    if ($FileExists) {
    "Loading $InvFile for processing..."
    $tblData = import-csv $InvFile
    } else {
    "$InvFile not found - stopping import!"
    exit
    # Loop through Applications add each one to SharePoint
    "Uploading data to SharePoint...."
    foreach ($row in $tblData) {
    #Here is where I add the information from my CSV file
    #2 things have to be present
    # 1. the columns have to be in the sharepoint site before I can import the information
    # 2. columns have to the headers in my csv file
    #"Adding entry for "+$row."Computer Information".ToString()
    $spItem = $spData.AddItem()
    $spItem["ServerName"] = $row."ServerName".ToString()
    $spItem["Uptime"] = $row."Uptime".ToString()
    #$spItem["DNSHostName"] = $row."DNSHostName".ToString()
    #$spItem["DistinguishedName"] = $row."DistinguishedName".ToString()
    $spItem.Update()
    # This is just disconnecting from SharePoint
    $spWeb.Dispose()
    Enjoy, and if anyone has a better way of doing this I'm interested in knowing, thanks again
    Thanks in Adavance

  • Exporting action script in 2nd frame

    I have a preloader in frame one so I export frame for classes
    in frame two in the publishing settings. I have a scrolling
    component in the .fla and when I set up the linkage for the
    scrollable movie clip, it exports into the 1st frame. How do I tell
    Flash to export action script for component in 2nd frame? Because
    of the conflict with the publishing settings set at frame 2, the
    scroll bar won't work unless I publish export action script into
    frame one.
    Please help,
    Darryl

    Thank you for replying. I was instructed that it is better to
    have the action script load in the second frame if my preloader is
    in the first frame in order for the page to cache faster on the
    users PC. So in the Publish Settings, in the Flash Tab under
    Settings, I was informed to "export frame for classes in "2".
    The action script for the compenent in the Library only gives
    me the choice of it exporting in frame 1. And because they do not
    correspond, the scroll bar will not appear unless I change the
    Publish settings to export in frame 1 and I will get this error
    message Error opening URL
    "file:///D|/Flash%20Studio%208/nams/scroll".
    My goal was to increase the download speed of the Flash page.
    Is there a way to get the compenent Action script to export in
    Frame 2? The only option box through the Library Linkage is Frame
    1.
    Thank you again for responding,
    Darryl

  • Script to export Discoverer worksheets automatically

    Dear All,
    Is there a way to create a script to export Discoverer worksheets into excel and save them in a dedicated directory.
    We are using Discoverer to create worksheets but we have a huge number of worksheets. We run the reports and export them manually in order to use them in excel files. We want to automate this process.
    Please advice,
    Thanks

    Hi,
    Yes there is more than 1 way,
    1. You can use the windows command line on the computer where discoverer desktop is installed:
    create a batch file containing the commands for exporting a workbook to XLS.
    The format is:
    <the path to the discoverer home>\dis51usr.exe /connect <user>/<paswword>@<DB Environment> /apps_user /apps_responsibility <Responsibility> /opendb <workbook name> /export XLS "Path for the export and file name" /batch
    * I am using oracle apps so I need the responsibility as well, if you are using a DB user then drop that part...
    for example, look at the following batch:
    echo off
    cls
    title Export Workbook For Discoverer
    md C:\Workbooks\%date:~-7,2%_%date:~-9,1%_%date:~-4,4%
    start /wait C:\oracle\BIToolsHome_1\BIN\dis51usr.exe /connect ADMIN/AD1234@Test1 /apps_user /apps_responsibility <Responsibility> /opendb "Test for Export" /export XLS "C:\Workbooks\%date:~-7,2%_%date:~-9,1%_%date:~-4,4%\Test For Export" /batch
    echo The Export Ended, You can look in the LOG File.
    echo.
    echo off
    exit
    2. you can use the java command line and then use it on your server but for that you will need to do a little research.

Maybe you are looking for