text stringlengths 0 15.7k | source stringlengths 6 112 |
|---|---|
set TheText to TheText & "Video size: " & PixelHeight & " X " & PixelWidth & return & return | lns2.scpt |
else if ((PixelHeight = missing value) and (PixelWidth = missing value)) then | lns2.scpt |
set TheText to TheText & "Video size: " & "\"Pixel height\" and \"pixel width\" not found." & return & return | lns2.scpt |
else if (PixelHeight = missing value) then | lns2.scpt |
set TheText to TheText & "Video size: " & "\"Pixel height not found.\"" & " X " & PixelWidth & return & return | lns2.scpt |
else if (PixelWidth = missing value) then | lns2.scpt |
set TheText to TheText & "Video size: " & PixelHeight & " X " & "\"Pixel width not found.\"" & return & return | lns2.scpt |
if (ConvertedFileSize ≠ missing value) then | lns2.scpt |
set TheText to TheText & "File size: " & ConvertedFileSize & return & return | lns2.scpt |
set TheText to TheText & "File size: " & "missing value" & return & return | lns2.scpt |
if (VideoLength ≠ missing value) then | lns2.scpt |
set TheText to TheText & "Video length: " & VideoLength & return & return | lns2.scpt |
set TheText to TheText & "Video length: " & "missing value" & return & return | lns2.scpt |
if (ItemKind ≠ missing value) then | lns2.scpt |
set TheText to TheText & "Item Kind: " & ItemKind & return & return | lns2.scpt |
set TheText to TheText & "Item Kind: " & "missing value" & return & return | lns2.scpt |
if (VideoBitRate ≠ missing value) then | lns2.scpt |
set TheText to TheText & "Video Bit Rate: " & VideoBitRate & return & return | lns2.scpt |
set TheText to TheText & "Video Bit Rate: " & "missing value" & return & return | lns2.scpt |
if (AudioBitRate ≠ missing value) then | lns2.scpt |
set TheText to TheText & "Audio Bit Rate: " & AudioBitRate | lns2.scpt |
set TheText to TheText & "Audio Bit Rate: " & "missing value" & return & return | lns2.scpt |
set TheResult to MakeMiniBBEditWin(VideoName, TheText) | lns2.scpt |
if (not (Successful of TheResult)) then | lns2.scpt |
display dialog "Error " & (errNum as string) & " occured while creating the results to display." & return & return & errMsg buttons {"OK"} default button ¬ | lns2.scpt |
"OK" with title "Error" | lns2.scpt |
end CreateResults | lns2.scpt |
on FindMetaData(TheSender) | lns2.scpt |
set TheObject to TheSender's object | lns2.scpt |
TheSender's stopQuery() | lns2.scpt |
current application's NSNotificationCenter's defaultCenter()'s removeObserver:me |name|:(current application's NSMetadataQueryDidFinishGatheringNotification) object:TheObject | lns2.scpt |
set SearchResults to TheObject's results() | lns2.scpt |
end FindMetaData | lns2.scpt |
on Make2Digits(TheNumber) | lns2.scpt |
if (TheNumber < 10) then | lns2.scpt |
return "0" & (TheNumber as text) | lns2.scpt |
return (TheNumber as text) | lns2.scpt |
end Make2Digits | lns2.scpt |
set TheFilePath to (current application's NSString's stringWithString:(POSIX path of (TheFile as text))) | lns2.scpt |
set FileName to TheFilePath's lastPathComponent() | lns2.scpt |
set EnclosingFolderPath to TheFilePath's stringByDeletingLastPathComponent() | lns2.scpt |
set SearchPredicate to current application's NSPredicate's predicateWithFormat_("kMDItemFSName == %@", FileName) | lns2.scpt |
set SearchQuery to current application's NSMetadataQuery's alloc()'s init() | lns2.scpt |
(current application's NSNotificationCenter's defaultCenter()'s addObserver:(me) selector:"FindMetaData:" |name|:(current application's NSMetadataQueryDidFinishGatheringNotification) object:FindMetaData) | lns2.scpt |
(SearchQuery's setPredicate:SearchPredicate) | lns2.scpt |
(SearchQuery's setSearchScopes:{EnclosingFolderPath}) | lns2.scpt |
SearchQuery's startQuery() | lns2.scpt |
repeat while SearchQuery's isGathering() as boolean | lns2.scpt |
SearchQuery's stopQuery() | lns2.scpt |
if ((SearchQuery's results()) as list = {}) then | lns2.scpt |
set ErrorText to "Unable to find any metadata information for the file." | lns2.scpt |
my MakeMiniBBEditWin(FileName as text, ErrorText) | lns2.scpt |
set MetadataItem to (SearchQuery's resultAtIndex:0) | lns2.scpt |
set TheDictionary to (MetadataItem's valuesForAttributes:{current application's kMDItemPixelHeight, current application's kMDItemPixelWidth, current application's kMDItemFSSize, ¬
current application's kMDItemKind, current application's kMDItemAudioBitRate, current application's kMDItemVideoBitRate, current application... | lns2.scpt |
set PixelHeight to (TheDictionary's objectForKey:"kMDItemPixelHeight") as text | lns2.scpt |
set PixelWidth to (TheDictionary's objectForKey:"kMDItemPixelWidth") as text | lns2.scpt |
set FileSize to (TheDictionary's objectForKey:"kMDItemFSSize") | lns2.scpt |
set ItemKind to (TheDictionary's objectForKey:"kMDItemKind") as text | lns2.scpt |
set AudioBitRate to (TheDictionary's objectForKey:"kMDItemAudioBitRate") as text | lns2.scpt |
set VideoBitRate to (TheDictionary's objectForKey:"kMDItemVideoBitRate") as text | lns2.scpt |
set VideoName to (TheDictionary's objectForKey:"kMDItemFSName") as text | lns2.scpt |
set LengthInSeconds to (TheDictionary's objectForKey:"kMDItemDurationSeconds") as real | lns2.scpt |
if ((LengthInSeconds ≠ missing value) and (class of LengthInSeconds = real)) then | lns2.scpt |
set TheHours to LengthInSeconds div hours | lns2.scpt |
set RemainingSeconds to LengthInSeconds - (TheHours * hours) | lns2.scpt |
set TheMinutes to (RemainingSeconds div minutes) | lns2.scpt |
set TheSeconds to (RemainingSeconds mod minutes) div 1 -- The div 1 makes it an integer | lns2.scpt |
set VideoLength to (TheHours as text) & ":" & my Make2Digits(TheMinutes) & ":" & my Make2Digits(TheSeconds) | lns2.scpt |
set VideoLength to missing value | lns2.scpt |
set TheResult to my CreateResults(VideoName, PixelHeight, PixelWidth, FileSize, ItemKind, VideoLength, AudioBitRate, VideoBitRate) | lns2.scpt |
set WindowLevelOffest to WindowLevelOffest + 1 | lns2.scpt |
property AceptableFileExtensions : {"mp4", "3gp"} -- Add more video file extentions as I come across them | lns2.scpt |
set ReturnRecord to {Successful:false} | lns2.scpt |
set Successful of ReturnRecord to true | lns2.scpt |
return ReturnRecord | lns2.scpt |
set Successful of ReturnRecord to false | lns2.scpt |
on CreateResults(VideoName, PixelHeight, PixelWidth, FileSize, ItemKind, LengthInSeconds, AudioBitRate, VideoBitRate) | lns2.scpt |
set SizeFormatter to current application's NSByteCountFormatter's alloc()'s init() | lns2.scpt |
SizeFormatter's setCountStyle:(current application's NSByteCountFormatterCountStyleDecimal) | lns2.scpt |
SizeFormatter's setIncludesActualByteCount:true | lns2.scpt |
set ConvertedFileSize to SizeFormatter's stringFromByteCount:FileSize | lns2.scpt |
if (LengthInSeconds ≠ missing value) then | lns2.scpt |
set TimeFormatter to current application's NSDateComponentsFormatter's alloc()'s init() | lns2.scpt |
TimeFormatter's setIncludesApproximationPhrase:no | lns2.scpt |
TimeFormatter's setIncludesTimeRemainingPhrase:no | lns2.scpt |
TimeFormatter's setUnitsStyle:(current application's NSDateComponentsFormatterUnitsStylePositional) | lns2.scpt |
set TimeString to TimeFormatter's stringFromTimeInterval:LengthInSeconds | lns2.scpt |
set TheText to TheText & "Video length: " & TimeString & return & return | lns2.scpt |
set (Successful of ReturnRecord) to false | lns2.scpt |
set (Successful of ReturnRecord) to true | lns2.scpt |
on SeachAndReplace(SearchStr, ReplaceStr, TheStr) | lns2.scpt |
set OldASDelimiters to text item delimiters of AppleScript | lns2.scpt |
set text item delimiters of AppleScript to {SearchStr as string} | lns2.scpt |
set TheList to text items of TheStr | lns2.scpt |
set text item delimiters of AppleScript to {ReplaceStr as string} | lns2.scpt |
set TheNewStr to TheList as string | lns2.scpt |
set text item delimiters of AppleScript to OldASDelimiters | lns2.scpt |
return TheNewStr | lns2.scpt |
end SeachAndReplace | lns2.scpt |
tell application "Finder" to set TheFilePath to (current application's NSString's stringWithString:(POSIX path of (TheFile as text))) | lns2.scpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.