How to use variable volume control for mac via python?
Question:
I found this code in python to control mac volume:
osascript.osascript("set volume output volume 35")
I want to use a variable to control this volume instead like:
volumes = [35, 35, 30, 35, 45, 45, 45, 45, 45, 40, 45, 45, 45, 45, 55, 45, 50, 45, 50, 55]
for i, n in enumerate(frequencies):
osascript.osascript("set volume output volume %s" (volumes[i]))
I’m getting this error though:
TypeError: 'str' object is not callable
Is there any way I can input volume directly here?
Answers:
Never mind, got it working through:
osascript.osascript("set volume output volume " + str(volumes[i]))
I found this code in python to control mac volume:
osascript.osascript("set volume output volume 35")
I want to use a variable to control this volume instead like:
volumes = [35, 35, 30, 35, 45, 45, 45, 45, 45, 40, 45, 45, 45, 45, 55, 45, 50, 45, 50, 55]
for i, n in enumerate(frequencies):
osascript.osascript("set volume output volume %s" (volumes[i]))
I’m getting this error though:
TypeError: 'str' object is not callable
Is there any way I can input volume directly here?
Never mind, got it working through:
osascript.osascript("set volume output volume " + str(volumes[i]))