

Code: Select all
wget -m -p -E -k -np https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/
Code: Select all
<br>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html" id="" title="ASLR_intro">ASLR_intro</a><a>
<br>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_classes.html" id="" title="ASLR_classes">ASLR_classes</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_keywords.html" id="" title="ASLR_keywords">ASLR_keywords</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_control_statements.html" id="" title="ASLR_control_statements">ASLR_control_statements</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_folder_actions.html" id="" title="ASLR_folder_actions">ASLR_folder_actions</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_reference_forms.html" id="" title="ASLR_reference_forms">ASLR_reference_forms</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_handlers.html" id="" title="ASLR_handlers">ASLR_handlers</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_operators.html" id="" title="ASLR_operators">ASLR_operators</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_load_script.html" id="" title="ASLR_load_script">ASLR_load_script</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_error_xmpls.html" id="" title="ASLR_error_xmpls">ASLR_error_xmpls</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html" id="" title="ASLR_cmds">ASLR_cmds</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_unsupported_terms.html" id="" title="ASLR_unsupported_terms">ASLR_unsupported_terms</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_glossary.html" id="" title="ASLR_glossary">ASLR_glossary</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_error_codes.html" id="" title="ASLR_error_codes">ASLR_error_codes</a>
<br>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_raw_data.html" id="" title="ASLR_raw_data">ASLR_raw_data</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_fundamentals.html" id="" title="ASLR_fundamentals">ASLR_fundamentals</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_script_objects.html" id="" title="ASLR_script_objects">ASLR_script_objects</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_lexical_conventions.html" id="" title="ASLR_lexical_conventions">ASLR_lexical_conventions</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_about_handlers.html" id="" title="ASLR_about_handlers">ASLR_about_handlers</a>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_variables.html" id="" title="ASLR_variables">ASLR_variables</a>
<br>
<br>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/Index/index_of_book.html" id="" title="index_of_book">index_of_book</a>
<br>
<br>
<br>
<a href="library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/revision_history/ASLR_rev_history.html" id="" title="ASLR_rev_history">ASLR_rev_history</a>
Code: Select all
javascript:(function(){ var url = window.location.href; url = url.replace("twitter.com", "nitter.net"); window.location = url; })();
Code: Select all
(* -- by Piero 2023
PLEASE BE SURE TO READ BELOW FOR "INSTALLATION" INSTRUCTIONS.
This creates a "Loudmaxed" copy of DROPPED audio or video files.
Audio will be ENHANCED!
You can also choose files via dialog by running it (double click).
Multichannel (surround) sound will be made stereo.
If a video is multi-language/multi-audio, you can choose the right track to process.
If a video is subtitled, you can optionally keep one of the subtitles.
Copies are saved on the same folder of the original, and will be overwritten if you process the original again.
Export this script as an application, after you pasted it on Script Editor...
You can easily change the icon of the exported app:
https://support.apple.com/lv-lv/guide/mac-help/mchlp2313/mac
You need to download and "install" 3 free softwares (put them into the finder window that will open when you run the "incomplete" version of this app).
You can also normally install LoudMax.vst (into /Library/Audio/Plug-Ins/VST/)
Works with Homebrew ffmpeg (/opt/homebrew/bin/ffmpeg) and you can also put mrswatson64 there (/opt/homebrew/bin/)
ffmpeg
https://www.osxexperts.net/ ( https://evermeet.cx/ffmpeg/ https://ffmpeg.org/ )
mrswatson64
https://github.com/teragonaudio/MrsWatson/blob/master/bin/Mac%20OS%20X/mrswatson64
LoudMax.vst
https://pluginguru.net/loudmax-for-mac/ ( https://loudmax.blogspot.com/ )
“STANDING ON THE SHOULDERS OF GIANTS”…
*)
-- Piping + Polling + RAMdisk Version 0.0002a0
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
property outvol : "0.94" -- do not set Loudmax volume to more than 0.94 when using ISP…
property addtoname : "_LM"
property stpstr : "\n\nYou can also hold ⌘. (Command-dot) to stop.\n"
on createRamDisk(sizeInMB, volumeName)
set sizeInSectors to round sizeInMB * 1024 * 1024 / 512 rounding up
do shell script "diskutil erasevolume HFS+ '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "` &> /dev/null &"
end createRamDisk
on ex(ff) -- extists? for posix paths…
try
do shell script "test -e " & ff
return true
on error
return false
end try
end ex
on durtosecs(d, sep)
set asd to AppleScript's text item delimiters
set AppleScript's text item delimiters to sep
set d to text item 2 of d
set AppleScript's text item delimiters to asd
return (3600 * (word 1 of d) + 60 * (word 2 of d) + (word 3 of d)) as integer
end durtosecs
on notinst(sss, ooo)
tell application "Finder"
activate
open (((path to me) as text) & "Contents:Resources:") as alias
display dialog sss & " not installed!\n\nPlease drag into the Finder window that just opened!" & "\n\n\n" & ooo buttons ("OK") default button "OK"
end tell
end notinst
on updpr(stri, nu)
set progress description to stri
set progress completed steps to nu
delay 0.35
end updpr
on open thefiles
tell application "Finder" to set thefiles to selection as alias list -- avoid weird drag and drop bug
try
set ptm to quoted form of POSIX path of (path to me)
if not ex("/Library/Audio/Plug-Ins/VST/LoudMax.vst") then
if not ex(ptm & "Contents/Resources/LoudMax.vst") then
otinst("Loudmax", "...or into /Library/Audio/Plug-Ins/VST/\n\nhttps://loudmax.blogspot.com/")
return
end if
end if
set ffm to "/opt/homebrew/bin/ffmpeg"
if not ex(ffm) then set ffm to ptm & "Contents/Resources/ffmpeg"
if not ex(ffm) then
otinst("Ffmpeg", "...or install with homebrew (/opt/homebrew/bin/)\n\nhttps://www.osxexperts.net/\n\nhttps://ffmpeg.org/\n\nhttps://evermeet.cx/ffmpeg/")
return
end if
set mrs to "/opt/homebrew/bin/mrswatson64"
if not ex(mrs) then set mrs to ptm & "Contents/Resources/mrswatson64"
if not ex(mrs) then
notinst("mrswatson64", "https://github.com/teragonaudio/MrsWatson/blob/master/bin/Mac%20OS%20X/mrswatson64")
return
end if
createRamDisk(1, "lmRAMdisk")
set tmpffm to "/Volumes/lmRAMdisk/ffmplog.txt"
set lmthre to word 1 of text returned of (display dialog "Loudmax Threshold\n\nExample: 0.02 will not enhance very low volumes\n\nSuggested values: from 0.0 to 0.5\n\nNOTE: a TEMPORARY 1MB RAM disk has been mounted" buttons {"Cancel", "OK"} default button "OK" with icon caution default answer "0.0")
set filecount to count thefiles
set ii to 1
set progress total steps to 100
repeat with i in thefiles
set quotedinputfile to quoted form of POSIX path of i
set pad to "Processing File " & ii & " of " & filecount & ":\n\n" & quotedinputfile & "\n\n"
set filname to ((characters 1 thru -((offset of "." in (the reverse of (characters of (POSIX path of i))) as text) + 1) of (POSIX path of i)) as text) & addtoname
set filext to ((characters -1 thru -((offset of "." in (the reverse of (characters of (POSIX path of i))) as text)) of (POSIX path of i)) as text)
set quotfilname to quoted form of (filname & filext)
set progress additional description to pad & "Output File:\n\n" & quotfilname
updpr("Analyzing File Tracks and Processing Audio..." & stpstr, 0)
set atr to "0"
set str to "0"
set sot to "1"
set trstr to "AUDIO TRACKS:" & return
set atrax to ""
try
set atrax to (do shell script ffm & " -i " & quotedinputfile & " 2>&1 | grep -E 'Stream.*Audio' | grep -En '.'") as string
end try
set trstr to trstr & atrax
set stra to ""
try
set stra to (do shell script ffm & " -i " & quotedinputfile & " 2>&1 | grep -E 'Stream.*Subtitle' | grep -En '.'") as string
set trstr to trstr & return & return & "SUBTITLE TRACKS:" & return & stra
on error
set trstr to trstr & return & return & "NO SUBTITLE TRACKS"
set sot to "0"
end try
if ((count paragraphs of atrax) > 1) or ((count paragraphs of stra) > 0) then
if filecount > 1 then beep
activate
set da to text returned of (display dialog quotedinputfile & return & return & trstr & return & return & "PLEASE SELECT:\n\n1 1 means 1st audio track, 1st subtitle track\n1 0 means 1st audio track, no subtitles" buttons {"Cancel", "OK"} default button "OK" default answer "1 " & sot & " " giving up after 6000)
set atr to (word 1 of da as integer) - 1
set str to (word 2 of da as integer) - 1
end if
set dur to durtosecs((do shell script ffm & " -i " & quotedinputfile & " 2>&1 | grep -E 'Duration:'"), "Duration:")
set pp to do shell script "( " & ffm & " -i " & quotedinputfile & " -q:a 0 -map 0:a:" & atr & "\\? -f s16le -ar 44.1k -ac 2 - | " & mrs & " -p loudmax --parameter 0," & lmthre & " --parameter 1," & outvol & " --parameter 3,1.0 -i - -o - | " & ffm & " -y -i " & quotedinputfile & " -f s16le -ar 44.1k -ac 2 -i - -c:v copy -map 0:v:0\\? -map 1:a:0 -map 0:s:" & str & "\\? " & quotfilname & " > /dev/null 2> " & tmpffm & " ) &> /dev/null & echo $!"
set perc to 1
set olperc to 0
set oldlastline to ""
set ett to ""
set seta to 0
set strt to do shell script "date '+%s'"
repeat while (do shell script "ps -p " & pp & " || echo lmended") does not end with "lmended"
delay 0.2
copy last paragraph of ((do shell script "cat " & tmpffm) as string) to lastline -- tail -n 1 doesn't work, so…
if lastline ≠ oldlastline and lastline contains "time=" then -- update only when ffmpeg info changes
do shell script "> " & tmpffm -- empty ffmpeg log file
set perc to ((durtosecs(lastline, "time=") / dur) * 100)
set perc to round (perc) rounding down -- cannot do directly…
if perc ≠ olperc and perc < 101 then
set progress additional description to pad & lastline & "\n\nAudio Encode: " & perc & "% done" & ett
updpr("Encoding Optimal Audio Codec for the " & filext & " Output File..." & stpstr, perc)
set seta to ((do shell script "date +%s") - strt) -- implicit conversion to numbers!
if seta ≥ 10 then -- show ETA if this number of seconds passed
set dff to round ((seta * (100 - perc)) / perc) rounding down
if dff > 0 then set ett to " — ETA: less than " & (dff) & "s"
end if
set olperc to perc
end if
set oldlastline to lastline
end if
end repeat
set ii to ii + 1
end repeat
set progress additional description to ""
updpr("Loudmaxing Done!", 100)
say "Loudmaxing Done!" using "zarvox" volume 1.0
tell application "Finder" to eject "lmRAMdisk"
on error x number n
set gu to 600
if n is -128 then
set gu to 2
say "Loudmaxing Stopped!" using "zarvox" volume 1.0 without waiting until completion
else
say "Loudmaxing Error!" using "zarvox" volume 1.0 without waiting until completion
end if
--activate
display dialog x buttons {"OK"} default button "OK" with icon stop giving up after gu
tell application "Finder" to eject "lmRAMdisk"
end try
end open
on run
set ptm to quoted form of POSIX path of (path to me)
if (not ex(ptm & "Contents/Resources/mrswatson64") and not ex("/opt/homebrew/bin/mrswatson64")) or (not ex("/opt/homebrew/bin/ffmpeg") and not ex(ptm & "Contents/Resources/ffmpeg")) or (not ex("/Library/Audio/Plug-Ins/VST/LoudMax.vst") and not ex(ptm & "Contents/Resources/LoudMax.vst")) then
tell application "Finder"
activate
open (((path to me) as text) & "Contents:Resources:") as alias
display dialog "Please download the needed files\nffmpeg\nLoudMax.vst\nmrswatson64\nand drag them into the Finder window that just opened!\n\nSee Readme file for links" buttons ("OK") default button "OK"
end tell
return
end if
-- Handle the case where the script is launched without any dropped files
open (choose file with prompt "Select audio or video files to Loudmax:" with multiple selections allowed)
end run
Code: Select all
(* -- by Piero 2023
PLEASE BE SURE TO READ BELOW FOR "INSTALLATION" INSTRUCTIONS.
This creates a "Loudmaxed" copy of DROPPED audio or video files.
Audio will be ENHANCED!
You can also choose files via dialog by running it (double click).
Multichannel (surround) sound will be made stereo.
If a video is multi-language/multi-audio, you can choose the right track to process.
If a video is subtitled, you can optionally keep one of the subtitles.
Copies are saved on the same folder of the original, and will be overwritten if you process the original again.
Export this script as an application, after you pasted it on Script Editor...
You can easily change the icon of the exported app:
https://support.apple.com/lv-lv/guide/mac-help/mchlp2313/mac
You need to download and "install" 3 free softwares (put them into the finder window that will open when you run the "incomplete" version of this app).
You can also normally install LoudMax.vst (into /Library/Audio/Plug-Ins/VST/)
Works with Homebrew ffmpeg (/opt/homebrew/bin/ffmpeg) and you can also put mrswatson64 there (/opt/homebrew/bin/)
ffmpeg
https://www.osxexperts.net/ ( https://evermeet.cx/ffmpeg/ https://ffmpeg.org/ )
mrswatson64
https://github.com/teragonaudio/MrsWatson/blob/master/bin/Mac%20OS%20X/mrswatson64
LoudMax.vst
https://pluginguru.net/loudmax-for-mac/ ( https://loudmax.blogspot.com/ )
“STANDING ON THE SHOULDERS OF GIANTS”…
*)
-- Terminal + Pipe Version 0.0001a0
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
property outvol : "0.94" -- do not set Loudmax volume to more than 0.94 when using ISP…
property addtoname : "_LM"
on ex(ff) -- extists? for posix paths…
try
do shell script "test -e " & ff
return true
on error
return false
end try
end ex
on notinst(sss, ooo)
tell application "Finder"
activate
open (((path to me) as text) & "Contents:Resources:") as alias
display dialog sss & " not installed!\n\nPlease drag into the Finder window that just opened!" & "\n\n\n" & ooo buttons ("OK") default button "OK"
end tell
end notinst
on open thefiles
tell application "Finder" to set thefiles to selection as alias list -- avoid weird drag and drop bug
--try
set filecount to (count thefiles)
set ptm to quoted form of POSIX path of (path to me)
if not ex("/Library/Audio/Plug-Ins/VST/LoudMax.vst") then
if not ex(ptm & "Contents/Resources/LoudMax.vst") then
otinst("Loudmax", "...or into /Library/Audio/Plug-Ins/VST/\n\nhttps://loudmax.blogspot.com/")
return
end if
end if
set ffm2 to "/opt/homebrew/bin/ffpb"
if not ex(ffm2) then set ffm2 to "/opt/homebrew/bin/ffmpeg"
set ffm to "/opt/homebrew/bin/ffmpeg"
if not ex(ffm) then set ffm to ptm & "Contents/Resources/ffmpeg"
if not ex(ffm) then
otinst("Ffmpeg", "...or install with homebrew (/opt/homebrew/bin/)\n\nhttps://www.osxexperts.net/\n\nhttps://ffmpeg.org/\n\nhttps://evermeet.cx/ffmpeg/")
return
end if
set mrs to "/opt/homebrew/bin/mrswatson64"
if not ex(mrs) then set mrs to ptm & "Contents/Resources/mrswatson64"
if not ex(mrs) then
notinst("mrswatson64", "https://github.com/teragonaudio/MrsWatson/blob/master/bin/Mac%20OS%20X/mrswatson64")
return
end if
set lmthre to word 1 of text returned of (display dialog "Loudmax Threshold\n\nExample: 0.02 will not enhance very low volumes\n\nSuggested values: from 0.0 to 0.5" buttons {"Cancel", "OK"} default button "OK" with icon caution default answer "0.0")
tell application "Terminal" to launch
tell application "Terminal" to activate
set twins to {}
repeat with i in thefiles
set quotedinputfile to quoted form of POSIX path of i
set filname to ((characters 1 thru -((offset of "." in (the reverse of (characters of (POSIX path of i))) as text) + 1) of (POSIX path of i)) as text) & addtoname
set filext to ((characters -1 thru -((offset of "." in (the reverse of (characters of (POSIX path of i))) as text)) of (POSIX path of i)) as text)
set quotfilname to quoted form of (filname & filext)
set atr to "0"
set str to "0"
set sot to "1"
set trstr to "AUDIO TRACKS:" & return
set atrax to ""
try
set atrax to (do shell script ffm & " -i " & quotedinputfile & " 2>&1 | grep -E 'Stream.*Audio' | grep -En '.'") as string
end try
set trstr to trstr & atrax
set stra to ""
try
set stra to (do shell script ffm & " -i " & quotedinputfile & " 2>&1 | grep -E 'Stream.*Subtitle' | grep -En '.'") as string
set trstr to trstr & return & return & "SUBTITLE TRACKS:" & return & stra
on error
set trstr to trstr & return & return & "NO SUBTITLE TRACKS"
set sot to "0"
end try
if ((count paragraphs of atrax) > 1) or ((count paragraphs of stra) > 0) then
if filecount > 1 then beep
activate
set da to text returned of (display dialog quotedinputfile & return & return & trstr & return & return & "PLEASE SELECT:\n\n1 1 means 1st audio track, 1st subtitle track\n1 0 means 1st audio track, no subtitles" buttons {"Cancel", "OK"} default button "OK" default answer "1 " & sot & " " giving up after 6000)
set atr to (word 1 of da as integer) - 1
set str to (word 2 of da as integer) - 1
tell application "Terminal" to activate
end if
tell application "Terminal"
set aaaaa to do script "clear;echo;echo;echo " & quotfilname & ";echo;echo;" & ffm2 & " -v 32 -hide_banner -i " & quotedinputfile & " -q:a 0 -map 0:a:" & atr & "\\? -f s16le -ar 44.1k -ac 2 - | " & mrs & " --quiet -p loudmax --parameter 0," & lmthre & " --parameter 1," & outvol & " --parameter 3,1.0 -i - -o - | " & ffm2 & " -v 32 -hide_banner -y -i " & quotedinputfile & " -f s16le -ar 44.1k -ac 2 -i - -c:v copy -map 0:v:0\\? -map 1:a:0 -map 0:s:" & str & "\\? " & quotfilname & " || (osascript -e beep;echo;echo 'Press Return to close';read)"
set W to (the id of window 1)
set number of columns of window id W to 120
set number of rows of window id W to 8
set twins to twins & W
end tell
end repeat
tell application "Terminal"
set bz to true
delay 1
repeat while bz
delay 1
set bz to false
repeat with i in twins
try
if true is in ((busy of tabs of window id i) as text) then
set bz to true
else
close (window id i)
end if
end try
end repeat
end repeat
if (count windows) is 0 then quit
end tell
say "Loudmaxing Done!" using "zarvox" volume 1.0
--end try
end open
Piero is not interested in PureBasic at all. Among the 218 messages he posted on this forum up to now, maybe 2 or 3 are about PureBasic ...Mindphazer wrote: Mon Dec 11, 2023 1:27 pm Could you please only post things related to Purebasic here ?
Thanks.