use slider to lower volume

can anyone walk me through how to make a slider lower your computer volume.

what operating system? It will be different for each one

Mac

Im sure there are better ways to do this…declares probably. BUT it can also be done using a shell and osascript.

Slider.ValueChanged:

  Dim sh as New Shell
  sh.Execute("osascript -e 'set volume output volume " + Str(me.Value) + "'")

This can be used to get the current volume:

osascript -e 'get volume settings'

(Needs to be parsed…)

Again, declares are probably better :slight_smile:

I can do tons of things in 2 seconds with Applescript, I am getting to love XOJO, love make an interface, figuring out the code is slow for me.

here is how you do it with applescript, the slider goes from 0-100…so does applescript so it a 1-1, works perfect.

here is the applescript script code:
tell application “Finder”
set volume output volume (the clipboard)
end tell

on the slider, add the event handler ‘valuechanged’, add this code to the handler:
Dim c As New Clipboard
c.Text = Slider1.Value.ToText

dim mshell as new shell
mshell.Execute SetVolume

[quote=221821:@Albin Kiland]
This can be used to get the current volume:

osascript -e 'get volume settings'

(Needs to be parsed…)[/quote]

You can make it much more simple with a little more Applescript:

osascript -e 'item 1 of ((get volume settings) as list)'

returns just a single value and no parsing is needed.