1 2 3 Previous Next 38 Replies Latest reply: Apr 3, 2013 6:38 AM by mtimmons Go to original post
  • 15. Re: Applescript Input into Automator input...
    mtimmons Level 1 Level 1 (0 points)

    debugging and stuff is going good. a few notes.

     

    1. Just tested on 10.6.8 and it can't find my script resources and errors out.

             ....

               set trackCommand to quoted form of POSIX path of (path to resource "./Scripts/prev_watch.sh")

             ....

              I have messed with /Scripts/ and just 'Scripts/' but nothing. I guess I will retry the (path to me..) bundle? I am certain that is why I did that before. 10.7 and 10.6.8 did not like it.

     

    2. One one action , my shell script watches "in the background" for the encode (appended filename in a specific folder) to complete and then fires the notification, so I still needed that.. but it is working perfectly after I created a new "theNameOnly" without the filename in the extension.

     

    3. On the renamer, I like the mechanism I had to where it would always add just one leading '0' to the digit count as opposed to a bunch of 0000. I was able to adopt your code perfectly.

     

    4. something I tried and failed at was moving the initialization of the progressbar on several actions to after the 'choose folder'.. I found it odd to see a progress bar before you told it to do something. Not a big deal though. This is almost done and I have learned a ton !

     

    4. Lastly, not a necessity, but a request since I can't edit the NIB. would be to remove the unnecessaries (Edit, format...) from the menu bar. And also change the Application > Quit "CocoaApplet" to the bundle name. Not a biggie, but an idea for future users.

     

    you can look at my update here.

  • 16. Re: Applescript Input into Automator input...
    red_menace Level 6 Level 6 (14,610 points)

    1. The path to resource command has an optional parameter that can be used to specify a subdirectory (the resource needs to be just the file name):

     

    set trackCommand to quoted form of POSIX path of (path to resource "prev_watch.sh" in directory "Scripts")

     

    4. The ProgressBarController script in the bundle has a few different routines to initialize and show the progress window so it can be set up in different ways.  You could set it up initially to be a barber pole, or set everything up and then show it, etc, but I was trying to get everything into a common initialization handler - I've moved the initial showing of the progress window to after any other dialogs.  Another thing I changed was getting the name of the file items - System Events can use either POSIX or HFS paths, text or alias by doing something like

     

    tell application "System Events" to set theName to name of disk item (anItem as text)

     

    5. The .xib files are compiled and don't have much to navigate by so I don't know about removing entire menus, but by searching for the text "cocoapplet" you can find the application name in the menu items and replace it.

     

    I've updated my example of your project here.

  • 17. Re: Applescript Input into Automator input...
    red_menace Level 6 Level 6 (14,610 points)

    Correction - the name to search for should be "cocoaapplet" (the original name in the menu items).

  • 18. Re: Applescript Input into Automator input...
    mtimmons Level 1 Level 1 (0 points)

    yeah, they are compiled and there is nothing to search for that. I searched through all the other resources / stuff and nothing. not a big deal.. almost done with this! I am playing now with using the

      setBarberPole_(true)

    for a few ! awesome work here!

  • 19. Re: Applescript Input into Automator input...
    mtimmons Level 1 Level 1 (0 points)

    I changed the bundle name in the info.plst and was able to get the "quit..." menubar to be right. Also since I am using a shell cp command for copies right now, I changed the progress to barberpoll very easily thanks to your great documentation. Terminal in this setup does not give us a true porgress, so a simple barberpoll worked percfect until I change this behavior. I am very happy with my lasted build and am very thank full for all your help! I have learned a lot.

  • 20. Re: Applescript Input into Automator input...
    red_menace Level 6 Level 6 (14,610 points)

    Thanks for the feedback - it helped me add a little bit more documentation to my templates.

  • 21. Re: Applescript Input into Automator input...
    mtimmons Level 1 Level 1 (0 points)

    hello..

    I noticed that the "Cancel" does not work with this new code? Is that the same for you too? here is a block. Let me know if you want the full script again.

     

    on testing(inputObjects) -- test by copying items to the desktop

              set notificationTitle to "Copy to Desktop"

              tell progressController to showProgressWithTopText_bottomText_maxValue_("Testing…", "", (itemCount * 100) + 1)

              tell current application's NSThread to sleepForTimeInterval_(delayTime)

     

              repeat with anItem in inputObjects

                        set fposix to the quoted form of the POSIX path of anItem

                        tell application "System Events" to set theName to name of disk item (anItem as text)

                        tell progressController

      updateProgressByAmount_topText_bottomText_(100, "Testing…", theName)

                                  if its stopProgress then

                                            my cleanup()

                                            return

                                  end if

                        end tell

                        tell current application's NSThread to sleepForTimeInterval_(delayTime)

      -- do shell script "cp -f " & fposix & " ~/Desktop/"

                        set allNames to allNames & return & theName

              end repeat

              notify(notificationTitle, "Files copied to Desktop.", allNames)

    end testing

  • 22. Re: Applescript Input into Automator input...
    red_menace Level 6 Level 6 (14,610 points)

    I finally had a chance to put your code snippet into the FCLauncher4 application and the cancel is still working - did you change something else perhaps?  The progress bar controller's stopProgress property is set when the cancel button is pressed, but it is up to your script to do something about it.

  • 23. Re: Applescript Input into Automator input...
    mtimmons Level 1 Level 1 (0 points)

    I checked it with the ealier builds.. same problem but I know the culprit. The shell script. without the shell script th stop works. but, with the shell script uncommented (which is how I use it obv..)

    do shell script "cp -f " & fposix & " ~/Desktop/"

     

    then it is frozen till the script complete.. urg.

  • 24. Re: Applescript Input into Automator input...
    red_menace Level 6 Level 6 (14,610 points)

    I just tried it with the shell script enabled, and the cancel works OK - you shouldn't rely on shortcuts such as the tilde expansion, though.

  • 25. Re: Applescript Input into Automator input...
    mtimmons Level 1 Level 1 (0 points)

    interesting. I have tried few diffent build and nothing once the shell script starts.. with or without the relative path, which had not showed any problems yet. Perhaps you could shoot me a link to the build you confirmed it on? maybe something crazy is happening. note taken on the tilde.. I may recode for 'active user' instead.

  • 26. Re: Applescript Input into Automator input...
    mtimmons Level 1 Level 1 (0 points)

    wait!

    It is the "X" button that is not working. htting "esp" key cancels it perfectly..

  • 27. Re: Applescript Input into Automator input...
    red_menace Level 6 Level 6 (14,610 points)

    Curious - the cancel button's key equivalent (the escape key) should do the same thing as clicking the button.  The build I am using is the last one you posted a link to, named FCLauncher4.

  • 28. Re: Applescript Input into Automator input...
    mtimmons Level 1 Level 1 (0 points)

    very strange indeed. I have tried a two different macs. including with the build I last posted. Clicking the ''x' while the shell is running does not cancel. but, esc does. ...so the 'x' button works for you?

  • 29. Re: Applescript Input into Automator input...
    red_menace Level 6 Level 6 (14,610 points)

    Yes, the button works for me in 10.8.2.  If your latest version is much different than FCLauncher4, maybe something got corrupted.