|
|
#1 |
|
How can I set a variable in applescript??
I am trying to set a variable that will hold the length of a movie in quicktime.
Here is my try at it: tell application "QuickTime Player" set movie_length as ?????????? How do I do that??? Pleaaaase help me! |
|
|
|
0
|
|
|
#2 | |
|
Quote:
set movie_length to 120 -- stores an integer set movie_length to "2 hours" -- stores a string display dialog movie_length -- most of the time, AS will convert numbers to string for dd messages display dialog (movie_length as string) -- but sometimes you need to coerce the variable If you're having problems, you do realize that a tell statement needs an "end tell", right? so ... Code:
tell application "QuickTime Player"
set movie_length to 120
end tell
mt
__________________
What looks large from a distance, close up ain't never that big. |
||
|
|
0
|
|
|
#3 |
|
yes thank you that helped. I have another question, I am trying to shorten a video, and I am pretty much done.
Code:
tell application "QuickTime Player" select at 0 to new_time ???????????? end tell Code:
trim front document trim trim document ps- thank you I really appreciate your help ![]()
|
|
|
|
0
|
|
|
#4 |
|
You're not passing the correct arguments.
Open AppleScript Editor, go to File > Open Dictionary and select QuickTime Player. Then search for "trim" and you'll see what arguments that command takes. edit: I merged your threads since they overlap. |
|
|
|
0
|
|
|
#5 |
|
Thanks for merging them
I searched like you said, and I found this: Code:
trim v : Remove all content before and after the current selection trim specifier : movie |
|
|
|
0
|
|
|
#6 |
|
There are two arguments to trim: the start and end time in seconds, so the format is:
Code:
trim movie from seconds to seconds |
|
|
|
0
|
|
|
#7 |
|
Ok I have tried to do what you said, but I get an error when I try to compile. Here is a screenshot:
![]() Just to clear things up, here is version data about the 'script editor' that I am using: ![]() And lastly, here is the whole script, copy and pasted in Code:
with timeout of 86400 seconds
display dialog "Before beginning batch processing, make sure QuickTime Player is set to the desired export settings, and all videos to be processed are in a folder named ‘Input’ on the desktop." with icon note
tell application "Finder"
set the startup_disk to the name of the startup disk
end tell
set amount_to_trim to 30
set user to do shell script "whoami"
set input_folder_name to "Input"
set input_folder to startup_disk & ":Users:" & user & ":Desktop:" & input_folder_name & ":"
set user_desktop to startup_disk & ":Users:" & user & ":Desktop:"
set output_folder to startup_disk & ":Users:" & user & ":Desktop:Output:"
set file_extension to "_export.mp4"
try
tell application "Finder"
make new folder at user_desktop with properties {name:"Output"}
end tell
end try
try
set the_folder_list to list folder input_folder without invisibles
repeat with x from 1 to count of the_folder_list
set the_file to input_folder & item x of the_folder_list
set output_file to output_folder & item x of the_folder_list & file_extension
tell application "QuickTime Player"
activate
try
close front window
end try
open the_file
trim document 1 from 0 to ((duration of document 1) - amount_to_trim)
export front document to output_file as MPEG4 using most recent settings with replacing
close front document
end tell
end repeat
on error
display dialog "This script requires a folder named ‘" & input_folder_name & "‘ located on the desktop." with icon stop
end try
beep
end timeout
|
|
|
|
0
|
|
|
#8 |
|
Looks like there's a difference between Leopard QuickTime Player and Snow Leopard QuickTime Player.
The "trim" line compiles fine on my system. The "export" line following needs some tweaking, however. mt
__________________
What looks large from a distance, close up ain't never that big. |
|
|
|
0
|
|
|
#9 | |
|
Quote:
Code:
tell application "QuickTime Player 7" activate close every window open "/latest.mp3" set end_time to the duration of document 1 tell document 1 trim document from 1 to end_time export to "/latest.wav" as wave using settings preset "8 kHz 16 bit Mono" end tell quit end tell thanks, pugu |
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Setting Environment Variables in login items in workgroup manager | BruisedGhost | Mac OS X Server, Xserve, and Networking | 1 | Apr 28, 2012 03:03 PM |
| Save variables in AppleScript? | JasonZ | Mac Programming | 4 | Aug 29, 2010 07:38 AM |
| How can we access the variables declared in another class without using extern ? | srikanthrongali | iPhone/iPad Programming | 3 | May 14, 2010 01:25 PM |
| Links open in new window with Safari. How can i set it to open in a new tab? | jableskg | Mac Basics and Help | 4 | Aug 8, 2009 02:08 PM |
| How can I set printer paper size in Safari and Preview? | NaN | Mac OS X | 4 | Jan 25, 2008 02:16 PM |
All times are GMT -5. The time now is 01:22 AM.










Linear Mode

