Hw do I access a subfolder in Applescript?

This seems like it should be simple, but Ive tried dozens of variations without success.
          tell application "Finder"
                    set myDocs to documents folder
                    log "myDocs is " & myDocs
                    set vmware to folder "Virtual Machines.localized" of alias of myDocs
          end tell
When I run it I get this:
tell application "Finder"
  (*myDocs is documents folder*)
Result:
error "Can’t get alias of documents folder." number -1728 from alias of documents folder

That solved my problem, but now I'm stuck trying to use the folder. as the default location of a choose statement.  I get the feeling I'm missing a fundamental concept or something.
          tell application "Finder"
                    set myDocs to path to documents folder
                    log "myDocs is " & myDocs
                    set vmware to folder "Virtual Machines.localized" of myDocs
                    log "vmware is " & vmware
  choose file name with prompt ¬
                              "Where to put the new VM:" default location myDocs
                    log "result is " & result
                    try
  choose file name with prompt ¬
                                        "Where to put the new VM:" default location vmware
                    on error errMsg
                              log "didn't work: " & errMsg
                    end try
                    try
  choose file name with prompt ¬
                                        "Where to put the new VM:" default location alias of vmware
                    on error errMsg
                              log "didn't work: " & errMsg
                    end try
                    try
  choose file name with prompt ¬
                                        "Where to put the new VM:" default location path of vmware
                    on error errMsg
                              log "didn't work: " & errMsg
                    end try
          end tell
Running it results in this:
tell application "Finder"
  path to documents folder
                    --> alias "Macintosh HD:Users:sam:Documents:"
  (*myDocs is Macintosh HD:Users:sam:Documents:*)
          get folder "Virtual Machines.localized" of alias "Macintosh HD:Users:sam:Documents:"
                    --> folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk
          get folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk
                    --> "Macintosh HD:Users:sam:Documents:Virtual Machines.localized:"
  (*vmware is Macintosh HD:Users:sam:Documents:Virtual Machines.localized:*)
          choose file name with prompt "Where to put the new VM:" default location alias "Macintosh HD:Users:sam:Documents:"
                    --> file "Macintosh HD:Users:sam:Documents:untitled"
  (*result is Macintosh HD:Users:sam:Documents:untitled*)
          choose file name with prompt "Where to put the new VM:" default location folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk
                    --> error number -1700 from folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk to alias
  (*didn't work: Finder got an error: Can’t make folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk into type alias.*)
          choose file name with prompt "Where to put the new VM:" default location alias of folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk
                    --> error number -1700 from alias of folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk to alias
  (*didn't work: Finder got an error: Can’t make alias of folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk into type alias.*)
          choose file name with prompt "Where to put the new VM:" default location path of folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk
                    --> error number -1700 from path of folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk to alias
  (*didn't work: Finder got an error: Can’t make path of folder "Virtual Machines.localized" of folder "Documents" of folder "sam" of folder "Users" of startup disk into type alias.*)
end tell

Similar Messages

  • How to create a Share with selective access to subfolder?

    Hi All!
    Just purchased PX12-400r and now "trying" to setup shares. What I want to accomplish is to have a Share accessible to one departmant (Finance). Inside that Share, I want to create sub-folders that is only accessble to specific employee and the department head. Presently, I have this setup in one of our Windows 2008 server and I want to do the same in this box. I already checked the:
    Allow users to change file level security
    After I created the subfolder and set necessary security (limiting subfolders to specific users), anybody who has an access to the Share folder can still access all the sub-folders.
    So, how to setup a main Share and selecitve access to sub-folder?
    Solved!
    Go to Solution.

    Hello Staplewire
    With the Allow users to change file level security enabled, you should be able to set the sub-folder and file level permissions via the connected client workstation.  Normal ACL permissions would apply at that point.  
    LenovoEMC Contact Information is region specific. Please select the correct link then access the Contact Us at the top right:
    US and Canada: https://lenovo-na-en.custhelp.com/
    Latin America and Mexico: https://lenovo-la-es.custhelp.com/
    EU: https://lenovo-eu-en.custhelp.com/
    India/Asia Pacific: https://lenovo-ap-en.custhelp.com/
    http://support.lenovoemc.com/

  • Accessing Hot Corners using AppleScript in Mavericks

    Hello,
    I'm trying to update a previous utility that could be used to disable/turn off hot corners using an applescript (the script was taken from https://gist.github.com/klynch/827581 and is pasted below). Trying to update it for Mavericks, I saw that the 'top left screen corner' can no longer be used to refer to hot corners. Google has uncovered a 'stack exchange' question that seems to purport that it is not possible anymore (http://apple.stackexchange.com/questions/106775/how-to-fast-set-hot-corners-in-m avericks). Is that true?
    If that is indeed true, is there a work-around to my work-around? Specifically, is there a way to easily disable hot corners for when I go into a full screen application or anything like that? I'm thinking something like Caffeine, but for hot corners and not for power saving options. Thoughts?
    Thanks in advance!
    Disable Hot Corner:
    tell application "System Events"
    activate
    if UI elements enabled then
    tell expose preferences
    set properties of the top left screen corner to {activity:none, modifiers:{}}
    set properties of the top right screen corner to {activity:none, modifiers:{}}
    set properties of the bottom left screen corner to {activity:none, modifiers:{}}
    set properties of the bottom right screen corner to {activity:none, modifiers:{}}
    end tell
    else
    tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.universalaccess"
    display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
    end tell
    end if
    end tell
    tell application "System Preferences" to quit

    However, if you wish to be able to toggle between to states of the hot corners (enabled/disabled), the following script would be more appropriate:
    property theSavedValues : {"Mission Control", "Desktop", "Dashboard", "Launchpad"} -- for example
    tell application "System Preferences"
        activate
        set current pane to pane id "com.apple.preference.expose"
        tell application "System Events"
            tell window "Mission Control" of process "System Preferences"
                click button "Hot Corners…"
                tell sheet 1
                    tell group 1
                        set theCurrentValues to value of pop up buttons
                        if theCurrentValues is {"-", "-", "-", "-"} then
                            repeat with i from 1 to 4
                                set thisValue to item i of theSavedValues
                                tell pop up button i
                                    click
                                    click menu item thisValue of menu 1
                                end tell
                            end repeat
                        else
                            copy theCurrentValues to theSavedValues
                            repeat with i from 1 to 4
                                tell pop up button i
                                    click
                                    click last menu item of menu 1
                                end tell
                            end repeat
                        end if
                    end tell
                    click button "OK"
                end tell
            end tell
        end tell
        quit
    end tell

  • Cannot access ui combobox in applescript

    Hi All,
    I am trying to ui script my way around the audiobook builder in order to create audiobooks in batch.
    However I am currently stuck with filling the author field which is a combo box.
    According to the accessibility manager I should be on the spot but still I am receiving errors while executing the script.
    Maybe someone here can give me the final hint to solve my issue?
    My code currently reads as:
    the corresponding ui interface inspector says:
    Thanks for any help in advance,
    Stefan

    alright found it out myself.
        tell application "System Events"
            tell process "Audiobook Builder"
                -- create new project
                tell window 1
                    click button 1
                    delay 1
                end tell
                -- name project
                tell window 1
                    set value of text field 1 to Filename
                    delay 1
                    click button 4
                end tell
                -- name author
                tell window 1
                    set value of combo box 2 to vAuthor
                    tell radio group 1
                        click radio button 2
                    end tell

  • Accessing the RPT in subfolder on Crystal Server

    I am trying to write a program to generate the Crystal Reports through Java program. These RPT files are inside a subfolder and whenever I try to acces these RPT, I get an error and report is not generated. It looks like the error is because java program is not able to access the subfolder.
    Please guide me how I can access the RPT inside a subfolder on Crystal Server.
    Regards
    Kapil

    Are you able to get any results with below query
    SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND = 'CrystalReport' and si_name='<your RPT title>' and SI_PARENTID = 123
    where
    <your RPT title>  is name the RPT file present in your CR server
    sub folder id is ID of the subfolder
    let me the output
    Thanks,
    Praveen

  • Applescript 'Contacts' code error with Maverick

    After upgrading from MacOSX 10.6.8 to Maverick my applescripts are creating errors. One example is the following script which works fine if you run it from within the 'Applescript Editor.app' (v 2.6.1) under Maverick but creates a "Data paste section" error -1743 from the 'Contacts' app if you run the script indpendently. Any hints anyone on how I might return this script to full indpendent functionality?
    Script to load a raw address for conversion and inserting into Address Book
    Wish list
    1.    Check if 'New Address' Group already exists and if it doesn't then create one.
    2.    Provide a dialog that enables the user to specify which group to attach the new address to.
    3.    Find the new address and show it in Address Book.
    4.    Create a list of existing Groups to chose from to reduce keyboard error. --> done but the resultant window is not complete - no scroll bar becomes active.
    Problem code:
    set theFiles to (every file of folder addressesFolder) as alias list
    global ABactive, aExists
    property testText : "http://address-parser.com"
    property newGroup : "New Addresses" --> Default group for new address additions
    property aPrefix : ""
    property aFirstName : ""
    property aMiddleName : ""
    property aLastName : ""
    property aSuffix : ""
    property aPosition : ""
    property aDepartment : ""
    property aCompany : ""
    property aCompany2 : ""
    property aStreet : ""
    property aStreet2 : ""
    property aPostbox : ""
    property aPlace : ""
    property aPostPlace : ""
    property aState : ""
    property aZip : ""
    property aPostboxCode : ""
    property aCountry : ""
    property aPhone : ""
    property aPhone2 : ""
    property aMobile : ""
    property aFax : ""
    property aEmail : ""
    property aWebsite : ""
    property aNote : ""
    set newline to ASCII character 10
    -- Select the desired file
    try
        set addressFile to (choose file with prompt "Choose an address file:" of type {"public.text"} without invisibles) as text
        --    set addressFile to (choose file with prompt "Choose an address file:" of type {"public.text"} default location addressesFolder without invisibles) as text
        -- note the data type set for 'addressFile' is 'text'
    on error number -128
        -- User pressed 'Cancel' button
        return
    end try
    set AppleScript's text item delimiters to {":"}
    set fileName to last text item of addressFile
    set AppleScript's text item delimiters to {""}
    (* If there is an error while processing the address file, delay it just long enough to close the file access. Otherwise continue. *)
    set addressFileReference to open for access addressFile
    -- 'addressFileReference' is the 'returned access number'
    -- Check first to see whether the file was created with output from the expected source
    try
        set wholeFile to read addressFileReference as text
        if (offset of testText in wholeFile) is equal to 0 then
            display dialog "File chosen is:" & return & fileName & return & return & "This file does not appear to contain output from the 'http://www.address-parser.com' demo page." buttons {"Cancel"} default button 1 with title "Error!" with icon stop
        end if
    on error number -128
        -- User pressed 'Cancel' button
        close access addressFileReference
        set wholeFile to ""
        return
    end try
    close access addressFileReference
    set wholeFile to ""
    -- Reopen file (need to clarify why EOF error if two read calls made with file open).
    set addressFileReference to open for access addressFile
    try
        set AppleScript's text item delimiters to {""}
        -- Read address file contents in 'addressFileContents' as a list delimited by paragraph and tab.
        set x to paragraphs of (read addressFileReference as text)
        set addressFileContents to {}
        set AppleScript's text item delimiters to tab
        repeat with i from 1 to count x
            set addressFileContents's end to x's item i's text items
        end repeat
        set AppleScript's text item delimiters to {""}
        repeat with i from 1 to count of addressFileContents
            if (item i of addressFileContents) is not {} then
                --Every line must be checked as there is no set order
                if text item 1 of (item i of addressFileContents) is "Prefix= " then ¬
                    set aPrefix to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "First name= " then ¬
                    set aFirstName to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Middle name= " then ¬
                    set aMiddleName to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Last name= " then ¬
                    set aLastName to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Suffix= " then ¬
                    set aSuffix to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Position= " then ¬
                    set aPosition to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Department= " then ¬
                    set aDepartment to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Company= " then ¬
                    set aCompany to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Company - line 2= " then ¬
                    set aCompany2 to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Street address= " then ¬
                    set aStreet to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Street address - line 2= " then ¬
                    set aStreet2 to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Postbox address= " then ¬
                    set aPostbox to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Place name= " then ¬
                    set aPlace to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Post place name= " then ¬
                    set aPostPlace to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "State/Region/Province= " then ¬
                    set aState to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "ZIP/Postal code= " then ¬
                    set aZip to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Postal code of postbox= " then ¬
                    set aPostboxCode to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Country= " then ¬
                    set aCountry to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Phone= " then ¬
                    set aPhone to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Phone 2= " then ¬
                    set aPhone2 to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Mobile phone= " then ¬
                    set aMobile to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Fax= " then ¬
                    set aFax to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Email= " then ¬
                    set aEmail to text item 2 of (item i of addressFileContents)
                if text item 1 of (item i of addressFileContents) is "Web site= " then ¬
                    set aWebsite to text item 2 of (item i of addressFileContents)
                --Collect unrecognised elements and place them in the 'Note' field
                if text item 1 of (item i of addressFileContents) contains "Unrecognized values:" then
                    set i to i + 1
                    set aNote to "Additional address bits:"
                    repeat with i from i to count of addressFileContents
                        --display dialog "Note text reads:" & return & "aNote:" & tab & "'" & aNote & "'" & return & "Line #:" & tab & i & return & (item i of addressFileContents) as text default button 1 with title "Debug Dialog"
                        if (item i of addressFileContents) is not {} then
                            if item 1 of (item i of addressFileContents) is "" and ¬
                                item 2 of (item i of addressFileContents) is not "" then
                                set aNote to aNote & newline & text item 2 of (item i of addressFileContents)
                            end if
                        end if
                    end repeat
                end if
            end if
        end repeat
    on error errMsg number errNum
        close access addressFileReference
        -- do some sort of error processing here
        display dialog "An error occurred with the following number and description: " & return & errNum & return & errMsg & return & return & "Item " & (i as string) & tab & "'" & (item i of addressFileContents) & "'" with title "Data load section."
        error errMsg number errNum
    end try
    close access addressFileReference
    --Debug dialogs
    --display dialog (item 1 of addressFileContents as text) & return & return & (item 2 of addressFileContents as text) & return & return & (item 3 of addressFileContents as text) & return & return & (item 4 of addressFileContents as text)
    --display dialog "title:" & tab & tab & tab & aPrefix & return & "first name:" & tab & tab & aFirstName & return & "middle name:" & tab & tab & aMiddleName & return & "last name:" & tab & tab & aLastName & return & "suffix:" & tab & tab & tab & aSuffix & return & "job title:" & tab & tab & tab & aPosition & return & "department:" & tab & aDepartment & return & "organization:" & tab & aCompany with title "Just prior to new record insertion:" with icon note
    --check if Contacts application is active
    tell application "System Events"
        if exists application process "Contacts" then
            set ABactive to true
        else
            set ABactive to false
        end if
    end tell
    --display dialog "title:" & tab & tab & tab & aPrefix & return & "first name:" & tab & tab & aFirstName & return & "middle name:" & tab & tab & aMiddleName & return & "last name:" & tab & tab & aLastName & return & "suffix:" & tab & tab & tab & aSuffix & return & "job title:" & tab & tab & tab & aPosition & return & "department:" & tab & aDepartment & return & "organization:" & tab & aCompany with title "Just prior to create new entry:" with icon note
    --create new address entry
    tell application "Contacts"
        try
            --if the aCompany2 variable is filled append its contents to the aCompany variable
            if aCompany2 is equal to "" then
                set thePerson to make new person with properties ¬
                    {title:aPrefix, first name:aFirstName, middle name:aMiddleName, last name:aLastName, suffix:aSuffix, job title:aPosition, department:aDepartment, organization:aCompany}
            else
                set aCompany to aCompany & newline & aCompany2
                set thePerson to make new person with properties ¬
                    {title:aPrefix, first name:aFirstName, middle name:aMiddleName, last name:aLastName, suffix:aSuffix, job title:aPosition, department:aDepartment, organization:aCompany}
            end if
            --set the Company view binary if no First and Last name
            if (first name of thePerson is equal to "") and (last name of thePerson is equal to "") then ¬
                set the company of thePerson to true
            tell thePerson
                if aPhone is not equal to "" then ¬
                    make new phone at end of phones with properties ¬
                        {label:"work", value:aPhone}
                if aPhone2 is not equal to "" then ¬
                    make new phone at end of phones with properties ¬
                        {label:"other", value:aPhone2}
                if aMobile is not equal to "" then ¬
                    make new phone at end of phones with properties ¬
                        {label:"mobile", value:aMobile}
                if aFax is not equal to "" then ¬
                    make new phone at end of phones with properties ¬
                        {label:"fax", value:aFax}
                if aEmail is not equal to "" then ¬
                    make new email at end of emails with properties ¬
                        {label:"Work", value:aEmail}
                if aWebsite is not equal to "" then ¬
                    make new url at end of urls with properties ¬
                        {label:"Work", value:aWebsite}
                if aStreet is not equal to "" then
                    if aStreet2 is equal to "" then
                        make new address at end of addresses with properties ¬
                            {label:"work", street:aStreet, city:aPlace, state:aState, zip:aZip, country:aCountry}
                    else
                        make new address at end of addresses with properties ¬
                            {label:"work", street:aStreet & ", " & aStreet2, city:aPlace, state:aState, zip:aZip, country:aCountry}
                    end if
                end if
                if aPostPlace is equal to "" then set aPostPlace to aPlace
                if aPostbox is not equal to "" then
                    if aPostboxCode is not equal to "" then
                        make new address at end of addresses with properties ¬
                            {label:"postal", street:aPostbox, city:aPostPlace, state:aState, zip:aPostboxCode, country:aCountry}
                    else
                        make new address at end of addresses with properties ¬
                            {label:"postal", street:aPostbox, city:aPlace, state:aState, zip:aZip, country:aCountry}
                    end if
                end if
                if aNote is not equal to "" then set note to aNote
            end tell
            -- place the new entry into a group
            set myGroups to name of every group
            set theGroup to (choose from list myGroups with prompt "Attach to which group?" without multiple selections allowed and empty selection allowed) as text
            --If user selects 'Cancel' button the value of the result variable is 'false'
            if theGroup is not "false" then
                add thePerson to group theGroup
            else
                -- create a default group and place the entry in there; first testing to see whether the default group already exists
                try
                    if group newGroup exists then ¬
                        display dialog "newGroup exists" with icon 1
                    add thePerson to group newGroup
                on error number -1728
                    -- newGroup does not exist so create it
                    display dialog "newGroup does not exist. Make new group with newGroup" with icon 1
                    set theGroup to make new group with properties {name:newGroup}
                    add thePerson to group newGroup
                end try
            end if
            save application "Contacts"
            set selection to (thePerson)
            activate
    --set flag that new address entry was successful by seeking
            if the selection is equal to properties ¬
                {title:aPrefix, first name:aFirstName, ¬
                middle name:aMiddleName, last name:aLastName, ¬
                suffix:aSuffix, job title:aPosition, ¬
                department:aDepartment, organization:aCompany} then ¬
            set aExists to true
        on error errMsg number errNum
            -- do some sort of error processing here
            display dialog "An error occurred with the following number and description: " & return & errNum & return & errMsg with title "Data paste section."
            error errMsg number errNum
        end try
        --if we opened the AB, we'll close it
        if not ABactive then quit
    end tell
    --clear address variables content in case of repeat use
    set aPrefix to ""
    set aFirstName to ""
    set aMiddleName to ""
    set aLastName to ""
    set aSuffix to ""
    set aPosition to ""
    set aDepartment to ""
    set aCompany to ""
    set aCompany2 to ""
    set aStreet to ""
    set aStreet2 to ""
    set aPostbox to ""
    set aPlace to ""
    set aState to ""
    set aZip to ""
    set aPostboxCode to ""
    set aCountry to ""
    set aPhone to ""
    set aPhone2 to ""
    set aMobile to ""
    set aFax to ""
    set aEmail to ""
    set aWebsite to ""
    set aNote to ""
    -- Delete original file if contents have been successfully added
    if aExists then
        try
            tell application "Finder"
                if exists file addressFile then
                    delete file addressFile --moves it to the trash
                end if
            end tell
        on error errMsg number errNum
            display dialog "Inserting new address was successfiul, however an error occurred while deleting the original file:" & return & addressFile buttons {"Cancel"} default button 1 with title "Error!" with icon stop
            display dialog ""
        end try
    end if
    -- End of 'add address' script

    Well, after a few days of restoring my cellphone (The C6-01 I mentioned before), I came to this:
    - After Hard resetting, the Lock Code is still erroneous;
    - After firmware reinstalling, Lock Code is erroneous;
    - Pulling out the battery, leaving the cellphone with no power for several hours, give the same result;
    - Downgrading firmware (previous version) did not fix the problem;
    Interesting thing is, after power on, the cellphone asks for the code lock: entering ANY number, returns "Code Error", and simply goes back to normal operation.
    Everything is working, except I can no use de Lock Code, or any function related to it.
    Of course, is pretty annoying to enter the lock code every time I power-on the cell.

  • Reading a large file?  I created an Applescript to read an XML document...

    I created an Applescript to read an XML document that had been exported from Final Cut Pro but it has trouble reading anything larger than a 1mb. Even 500kb takes a long time.
    My code is most likely very ineffecient, but I have little experience with Applescript. The script reads an XML document one line at a time then breaks down each line into it's componenents and literally reads each character looking for "<name>" then it checks to see if "<reel>" came before it. It then records the name in between "<name>" and "</name>." Then I get my list of tapes that are in the Final Cut Pro project. Does anyone have any advice on how to improve this code?
    property type_list : {"TEXT", "XML"}
    property extension_list : {"TXT", "XML"}
    on open these_items
    tell application "Finder"
    set my_file to these_items as string
    set file_ref to (open for access my_file) read
    close access file my_file
    set AppleScript's text item delimiters to ASCII character 10
    set new_list to every text item of file_ref
    set lengthofarray to length of new_list
    set h to 1
    set shotcount to 0
    set finalShots to {"You have ", "", " shots in your project."}
    set finalListoftapes to {"Your list of tapes are:", ""}
    repeat lengthofarray times
    set i to 1
    set x to 1
    set switch to 0
    set z to {""}
    set reelName to {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}
    set letter_list to item h of new_list
    set AppleScript's text item delimiters to ""
    set final_list to every text item of letter_list
    set lengthofletter_list to length of final_list
    repeat lengthofletter_list times
    if item i of final_list is "<"a" then
    if item (i + 3) of final_list is "m" then
    set letter_list2 to item (h - 1) of new_list
    set final_list2 to every text item of letter_list2
    set lengthofletter_list2 to length of final_list2
    set j to 1
    repeat lengthofletter_list2 times
    if item j of final_list2 is "<" then
    if item (j + 1) of final_list2 is "r" then
    if item (j + 2) of final_list2 is "e" then
    set x to (i + 6)
    set y to 1
    repeat while item 1 of z is not "<"
    set item y of reelName to item x of final_list
    set x to (x + 1)
    set y to (y + 1)
    set item 1 of z to item x of final_list as string
    end repeat
    if item 1 of reelName is not "" then
    set displayText to reelName as string
    set lengthofListoftapes to length of finalListoftapes
    set shotcount to (shotcount + 1)
    set k to 1
    repeat lengthofListoftapes times
    if item k of finalListoftapes is equal to displayText then
    set switch to 1
    end if
    set k to (k + 1)
    end repeat
    if switch is 0 then
    set finalListoftapes to (finalListoftapes & displayText)
    set check to finalListoftapes as string
    end if
    set switch to 0
    end if
    end if
    end if
    end if
    set j to (j + 1)
    end repeat
    end if
    end if
    end if
    end if
    set i to (i + 1)
    end repeat
    set h to (h + 1)
    end repeat
    set item 2 of finalShots to shotcount
    set finalShots to finalShots as string
    set AppleScript's text item delimiters to ASCII character 10
    set finalListoftapes to finalListoftapes as string
    set finalListoftapes to finalShots & (ASCII character 10) & (ASCII character 10) & finalListoftapes & (ASCII character 10) & (ASCII character 10) & "This list of tapes has been saved on your desktop."
    set path_list to these_items as string
    set filepath to path_list & "_listoffiles.txt"
    set outputFile to (open for access file filepath with write permission)
    write finalListoftapes to outputFile
    close access outputFile
    display dialog finalListoftapes
    end tell
    end open

    Try changing your approach - don't read it into an array, process it one line at a time. Obviously any approach where you have the whole file in memory is going to exceed memory at some size of the file.

  • Issue with assistive access not keeping permissions

    Since a recent upgrade (likely from OS X 10.9.x to 10.10.2) I've had issues with Assistive Access blocking Automator and Applescript from interaction with dialogs.
    If I run my script or my Automator workflow (which basically has the same script in it) I get the error:
    System Events got an error: Automator is not allowed assistive access. (in the case of Automator).
    If I open Automator, and then untick and retick the Automator entry in the Accessibility options within Security & Privacy (System Preferences), then workflow can run again. It continues to work until I Quit Automator. Then it's as if OS X no longer trusts Automator to be the same app I gave Accessibility permissions to.  And the situation repeats. It's much as if it were not code-signed. The exact same issue plays out with Apple Script.
    I came across this info, which I hoped would solve the problem, but it made no difference: http://macscripter.net/viewtopic.php?id=43394 and http://bit.ly/1x3SRmc
    In my Accessibility permissions I now have:
    Script Editor
    Automator
    1Password 5 (which the script interacts with)
    com.apple.security.agentStub.xpc (in case that's being called up and triggering the Accessibility issue)
    osascript (in case that's handling the script and triggering the Accessibility issue)
    SecurityAgent.xpc (in case that was triggering the Accessibility issue)
    I added all these because the post at http://bit.ly/1x3SRmc     indicated that anything Apple Script is interacting with needs Accessibility access permissions.
    My script is as follows:
    set appName to "SecurityAgent"
    set passApp to "1Password 5" (* set this to the name of your password manager *)
    tell application "System Events"
      if not (exists window 1 of process appName) then -- test if SecurityAgent window exists
      set answer to display dialog "The password dialog was not found. Please check." buttons {"Ok"}
      return -- abort if SecurityAgent window does not exist
      end if
    end tell
    tell application "System Events"
      set position of window 1 of process appName to {10, 10}
    -- move SecurityAgent window out of the way
    end tell
    activate application passApp
    tell application "System Events"
      tell application "SystemUIServer"
      set answer to display dialog "Make sure correct 1Password item is actively selected (i.e. click it again if it was previously selected), then click “Continue” to proceed." buttons {"Continue"}
      end tell
      tell process passApp
      (* If you are not using 1Password, you may need to change the menu item clicks, below, to whatever is correct in your particular password manager *)
      click menu item "copy password" of menu "item" of menu bar 1
      delay 1
      set appData to the clipboard
      end tell
      tell application "System Events"
      tell process appName
      set value of text field 1 of window 1 to appData
      if exists (text field 2 of window 1) then
      set value of text field 2 of window 1 to appData
      if exists checkbox 1 of window 1 then
      if value of checkbox 1 of window 1 is 1 then
      click checkbox 1 of window 1
      end if
      end if
      set value of checkbox 1 of window 1 to 0
      delay 1 (* gives  a moment to see what's going on *)
      click button "OK" of window 1
      else
      if value of checkbox 1 of window 1 is 1 then
      click checkbox 1 of window 1
      end if
      delay 1 (* gives  a moment to see what's going on *)
      click button "OK" of window 1
      end if
      end tell
      end tell
    end tell
    In Automator it would appear the script is generating an error as soon as it reaches line 5, "if not (exists window 1 of process appName) then"
    I would greatly appreciate some assistance in resolving this issue.

    Starting with Mavericks, Apple changed the way that the accessibility works (see Using AppleScript with Accessibility and Security features in Mavericks) - each individual application needs to be given access, instead of a global option.  A regular AppleScript application saves properties and global variables with the script, which makes it a new application as far as the system security is concerned, so it needs to be re-added to the accessibility list.  To work with this new security feature, you need to code-sign your AppleScript application or make the script(s) in the bundle read-only so that they don't get changed (note that an AppleScript-based project in Xcode does not modify the application bundle by saving properties and globals).

  • RD Web Access using HAProxy

    I setup an AIO RDS Windows Server 2012 R2 server farm, added a CA Certificate and everything runs fine including Web Access and RemoteApp. I decided to add an reverse proxy (HAProxy) as I want users to have access to a web application from home. HAProxy
    has the same CA certificate which I had to convert to pem from the pfx as the server is Ubuntu Server 14.4
    Now HAProxy is working correctly for the most part, I can actually reach the root folder of the default web site. BUT I can not access the subfolder "RDWeb" on that default web site.
    Works:  https://remote.myserver.com/
    Fails: https://remote.myserver.com/RDWeb/Pages/en-US/default.aspx
    I get the following error:
    Server Error in '/' Application.
    The resource cannot be found.
    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure
    that it is spelled correctly. 
    Requested URL: /RDWeb/Pages/en-US/default.aspx
    I did check authentication (link), but I am not sure as the problem seems to permissions/security. THe SSL certificate works and if I access the RDS Server directly bypassing the HAProxy
    server everything works.
    What is blocking access to that RDWeb webpage?
    -- Frank

    Hi,
    Thank you for posting in Windows Server Forum.
    From the error it seems that there is some permission issue or might blocking the RD Web access. You can check the firewall setting whether it is blocked by firewall end during proxy selection. Please check defined rules and setting related to firewall. 
    Apart from that, by default when we install RD Web Access, the RD Web Access Web site installs to the Default Web Site in IIS (to the /TS virtual path). However, if you specify a different Web site to install RD Web Access, you need to configure a different
    target Web site in the registry. You must do this before you install the RD Web Access role service. 
    To change the location of the TS Web Access Web site
    http://technet.microsoft.com/en-us/library/ff519183(v=ws.10).aspx
    Hope it helps!
    Thanks.
    Dharmesh Solanki

  • Some more guideance on whether to use Applescript/JS?

    This is, in rough outline, what I want to do:
    1. From within InDesign, extract the effective ppi of an image in the 'x' and 'y' directions.
    2. In Photoshop, apply those numbers in a certain way to the image so that the effective ppi becomes 300 in Indesign. It's a simple formula that you apply to the Image Resolution.
    3. Then I want to apply an Unsharp Mask with an edge mask to sharpen the image. This involves quite a number of simple steps.
    I have written out the whole procedure in Pidgin Applescript (a combination of Applescript, BASIC and English) and it works perfectly. I have to do Step 1 manually, but for steps 2 & 3 I have generated an Action, with a modal control for step 2, which pauses and asks for input.
    I want to know the best way to approach this task. Someone has told me (outside of these forums):
    Your best bet will be to post in the scripting forum. It would need to be Applescript because I don't think Javascript can do multiple applications at once.
    However, I'm not positive, but I don't think Open as Smart Object is available in the Photoshop CS3 Applescript dictionary. Maybe that's changed with CS4? Also, when I worked on the script dealing with layered Photoshop files, it created many seemingly insurmountable problems...
    Michael Hale responded to a previous thread of mine (http://forums.adobe.com/thread/457438) suggesting JS instead of Applescript:
    I would recommend that you use javascript for several reasons. First it is cross platform, second there seems to be more people on the forums using JS than AS, and last but not least in this case you can not work with the Action Manager API using AS. You would have to create and call JS functions from AS.
    So, I am left with: Applescript because it can handle multiple applications at once, but JS because it can handle Actions. What is the best way to approach this task? AS or JS?
    1. Extract some variables from a selected image in an open InDesign document.
    2. Open that same image in Photoshop and change the Image Resolution (a calculation is involved)
    3. Call up my Action to do the rest.
    4. Ask if more sharpening is required, and the amount. Loop at this step until the answer is "No".
    5. Save and close the image in Photoshop, and return to the selected image in InDesign to see the effect.
    Any suggestions most appreciated.

    Guy Burns wrote:
    2. Call upon JS (from within AS) with something like: app.doAction ("SHARPEN", "MY ACTIONS")
    OPTIONAL:
    * Upon return from JS, ask: More sharpening? If "Yes" apply new amount to Unsharp Mask.
    * Loop until "No"
    Guy there is NO need to call upon AppleScript to do JavaScript to have your action played out. You have direct access to this via AppleScript.
    I've had a quick stab at what I think you want and here is a bare bones script that may get you out of the blocks (only did a quick test)
    It expects you to have an image selected NOT its containing rectangle. Hope this helps…
    tell application "Adobe InDesign CS2"
    activate
    tell active document
    set This_Image to get selection
    set EPPI to effective ppi of item 1 of This_Image
    set {Hoz_PPI, Vert_PPI} to {item 1 of EPPI, item 2 of EPPI}
    if Hoz_PPI ≤ Vert_PPI then
    set Resample to Hoz_PPI
    else
    set Resample to Vert_PPI
    end if
    set Image_Path to file path of item link of (item 1 of This_Image) as alias
    end tell
    end tell
    tell application "Adobe Photoshop CS2"
    set display dialogs to never
    set User_Rulers to ruler units of settings
    set ruler units of settings to pixel units
    activate
    open Image_Path
    set ID_Image to the current document
    tell ID_Image
    set Image_Res to resolution
    set Image_Height to height
    -- set Image_Width to width
    if Resample < 270 then
    resize image height (Image_Height * (300 / Resample)) ¬
    resolution (Image_Res * (300 / Resample)) resample method bicubic smoother
    end if
    if Resample > 330 then
    resize image height (Image_Height * (300 / Resample)) ¬
    resolution (Image_Res * (300 / Resample)) resample method bicubic sharper
    end if
    -- do action "Action Name String" from "Action Set Name String"
    close with saving
    end tell
    set ruler units of settings to User_Rulers
    end tell
    tell application "Adobe InDesign CS2"
    activate
    tell active document
    update item link of (item 1 of This_Image)
    end tell
    end tell

  • Accessing the iPhoto '09 face.db

    Is it possible to access the iPhoto '09 face.db file from applescript?
    I pulled the file out of the bundle and placed it on my desktop.
    Using SQLite database browser, I verified that there are records and tables of interest in the file face.db.
    I can't, however, access the contents of the database using Database Events. What gives? Shouldn't I be able to do that? After I open the database, applescript tells me there are no records in it.
    tell application "Database Events"
    launch
    set the_database to open database "~/Desktop/face.db"
    set the_records to records of the_database
    repeat with i from 1 to number of the_records
    end repeat
    quit
    end tell

    Thanks for the suggestion to access photo information via applescript.
    I want to sync the thumbnails shown for each face, which is the key photo for the person, with my apple address book. Can't access the thumbnail via applescript, from my limited knowledge, so I'm accessing the underlying database iPhoto utilizes.
    Thus I'm learning how to access the database directly

  • Troubleshooting file access problem

    using finder, going into a sub folder in my documents folder, finder blows up... disappears, no message, nothing, just goes away. If I go in via terminal, everything is there in the correct folder and accessible. I can even gently go in using finder and opening up the folder hierarchy clicking on the delta flags I can see the listing.
    this is a restored directory from time machine. I ran the disk utility to check permissions, that didn't seem to help. any suggestions?
    Thanks

    So Finder relaunches when you try to access a subfolder - or quits but fails to relaunch - but only on the documents folder? You might try looking at the system logs in console but first I'd do the basic thing and blame a corrupted .plist for Finder.
    I would then move the files out of the documents folder - since you can get at them in terminal - and try making a new folder. You might have to do it in parts, half and then half and if the second half crashes do that half by half, etc.
    I wonder if it's possible that some folder action has been attached to a subfolder and that script is crashing Finder. You might be able to see that in console logs.

  • Need applescript studio older version

    I have been asked to program for a company. what I would like to do is go back to an older version of Applescript studio what actually uses Applescript so I can create on interface with drop down windows and that cool floating gray-ish window. I dont know Obj-C.
    what version of AS would that be. thanks for the info.

    AppleScript is a set of system components, so you can't just drop in an older set.
    AppleScriptObjC does use AppleScript, the main difference is in the way it accesses the Cocoa frameworks - AppleScript Studio essentially uses a bunch of terminology and handler wrappers around Cocoa methods that the Studio development team have gotten around to including, while ASOC can call Cocoa methods directly (a bit cleaner than Studio's call method kludge). You don't really need to know Objective C, but it does help a little when looking at the documentation - I know just enough to get an idea what some code snippet is doing, but don't ask me much more than that.
    Older AppleScript Studio projects can still be edited and compiled in Snow Leopard's Xcode, so the components are still in there. Since Apple wants everyone to start using the new framework, the older project templates have been removed, but they can also still be used. If you really need to develop a new Studio application, for example to use on older systems, you just need to do a couple of things.
    1) The AppleScript Studio palette can be enabled in Interface Builder by using defaults write com.apple.InterfaceBuilder3 IBEnableAppleScriptStudioSupport -bool YES
    2) You need to get a copy of an AppleScript Studio project template. If you have access to a Leopard system installation, the easiest way would be to make a copy of the desired template from the */Developer/Library/Xcode/Project Templates/Application* folder there, for example the *AppleScript Application* template (you can also download the old templates from my iDisk here). You probably shouldn't modify anything in the /Developer folder, but you can use custom project templates from your user's *~/Library/Application Support/Developer/Shared/Xcode/Project Templates/Application* folder, so copy your project template there (make intermediate folders as needed).
    Once the template is copied, you can select it when making a new project and use the old terminology as usual.

  • Creating a share in 10.5 and connecting  with XP or Vista - My Experience

    Here was my situation.
    Client has a machine now running 10.5 on it that is sharing an external drive on the network for other mac users in the office to use as well as 3 Windows machines. I tested with an xp machine as well as a vista machine.
    The problem I was facing was that I had to set up the windows machines to be able to access the shared drive on the machine running 10.5. On 10.4 this was done with sharepoints, which breaks in 10.5. Luckily, Apple incorporated a lot of sharepoints functions into 10.5.
    First I had to create a Standard or Admin user for each unique user that will be connecting to the share, on the machine that the external drive is connected to. You have the option of creating a "share only" user, but that seems to only be for mac sharing because those accounts do not show up as available when you enable accounts to access the SMB.
    Once I had the new accounts made, I had to go to "Sharing" in the System Preferences and click on "File Sharing". When selected you see "Shared Folders" and "Users" panes. I clicked the + symbol and pointed it to the shared drive, since one of the accounts will have access to the whole drive. In the user pane I clicked the + and added the user I created for that access.
    Note at this point. If you use the same username and password of the user account in windows (case sensitive I believe) you will not have to specify a special username and password for access to the share. I did this with the first machine with complete access because he was the owner of the share.
    So after I gave that user access to the whole drive he was able to find the 10.5 machine on the network and connect to the share without prompt of a password.
    I then tried to set up the other two users who were not on the same subnet so they had to use "map network drive" on their PCs.
    Again I added the target folder that they would have access to on the shared drive. I added their user as having permission to access it. But when I went to map the network drive, it could see the folder if I entered \\ip.add.res.s\foldername and clicked "browse" but when I tried to add it, the system said it was not found. I also made sure to click "change user name" and entered the username and password for the account with access to the folder.
    So after tinkering a while I finally found that you must add the users to the main share drive list of users, even if they are set to "read only (dropbox)" or else they will not be able to access the subfolder assigned to them. It also did not make a difference if I removed the share drive completely and added just the subfolders and users individually.
    I hope this might help somone out there who might be having a similar issue with getting xp or vista to use shared folders in 10.5.

    Was not a question.

  • HD no longer exists

    I'm in the unfortunate situation where my Hard Drive has simply ceased to exist. This does not mean that I simply can't see it from my desktop - this means that I cannot see it ANYWHERE. I can only turn on my computer from external or disk drives, and if I try to search for the internal drive through a disk utility (from my install disk), it simply does not show up. It won't even start up in Target Disk mode, so i can't just erase and restore.
    How it happened:
    I was in the middle of reinstalling my operating system because the computer's performance had diminished substantially from a plethora of 3rd-party software. About 3/5 into the installation, my external display (which for some stupid reason i had left connected) came unplugged just enough to make the computer angry. Instantaneously, the progress bar froze up and the gray spinny circle thing appeared over it. I left it like this for about an hour hoping it would find its way back to progress, but unfortunately it did not. I forced it to shut down with no other option, and when I rebooted it, I found myself in this position.
    Obviously, given what happened, my situation comes as no surprise. Hopefully because of that, I can find a quick and easy way to repair my computer without having to leave it with some service store for a few days. Does anyone know how I can fix this or know where I might get the information?

    Unfortunately, I don't think that's the problem - I don't have access to my system at all, I can't do the spotlight searches, I can't access my terminal or applescript... for all intents and purposes, the brain of my computer is empty, as was the plan when began the reinstall. Thanks for the help though
    Maybe there is some sort of intense disk repair software that, through another computer, can find the drive? Or maybe it's something much simpler that I'm not thinking of - but I am almost positive that it's not a problem of mere invisibility...

Maybe you are looking for

  • Why is iTunes 7.6 no longer grouping TV shows by season / show?

    I'm running iTunes 7.6 and have noticed that for the first time ever, purchased shows all within one season are now not grouped together. This happens in "Cover Flow" view and in "Grouped with Artwork" view. Some shows are unaffected. Others seem to

  • Service does not exist in loaded JCL registry

    i have this problem at jpos.loader.simple.SimpleServiceManager.createConnection(Unknown Source)   at jpos.loader.JposServiceLoader.findService(Unknown Source)   at jpos.BaseJposControl.open(Unknown Source) someone can tell me how i can solve this im

  • Assign file types back to CS6 Applications

    At this point I had to let go of my CC subscription. I've been waiting on a big contract to get finalized so I could justify renewing the whole suite of apps. I left CC on my machine so I wouldn't have to re-download it all if I start it up again in

  • Funny images in video recording with N70

    I have a n70 with version of V2.0536.0.2... When I record a video of the people with the distance of 2 meters ,the shapes of faces and the bodies get longer than normal shapes.If the distance is more than 6 metres ,the shapes become normal..I made a

  • To suppress "WBS HIERARCHY" for every WBS Element Node

    Hi All, Below are WBS nodes in the report. For every node, "WBS HIERARCHY" is repeating. WBS HIERARCHY C-11-5210 WBS HIERARCHY C-11-5214 WBS HIERARCHY C-11-5216 WBS HIERARCHY C-11-8521 WBS HIERARCHY C-15-1000 Is there any way to suppress this, so tha


HashFlare