some issue with applescript

hi,
I managed to create a script to enable some sort of presentation mode. The script hides all open apps, mute the volume and turn on Do not disturb.
here is the script:

property HideApps : false

set whitelist to {}

tell application "System Events" to set processList to get the name of every process whose background only is false

set Reluchlist to {}

if HideApps = false then

set HideApps to true

repeat with i from 1 to count processList

if whitelist does not contain item i of processList then

tell application "Finder"

set visible of process ( item i of processList) to false

end tell

end if

end repeat

else

repeat with i from 1 to count processList

set HideApps to false

if whitelist does not contain item i of processList then

tell application "Finder"

set visible of process ( item i of processList) to true

end tell

end if

end repeat

end if

tell application "System Events" to keystroke "d" using { option down , command down , shift down }

set curVolume to get volume settings

if output muted of curVolume is false then

set volume with output muted

else

set volume without output muted

end if

Whenever I run it with the Script-Editor, it workes fine. But when I run it with BTT, I'm only able to hide the Apps and not to show them back.
Does someone have a solution? should I change the script or change settings in BTT?
thanks