Skip to content

Commit 54dd27b

Browse files
committed
Update device_Komplete Kontrol.py
Fixed an exeption that made the entire script to stop on the device detection in case a device with an unexpected name is used with the script
1 parent 3646687 commit 54dd27b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

device_Komplete Kontrol.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,13 @@ def detectDevice():
333333
# Retrieves the device name from FL Studio
334334
deviceName = device.getName()
335335

336+
# Saves the 22th character of the device name for the S-Series check to isolate the extraction and avoid errors stopping the execution of the script
337+
char21 = None
338+
try:
339+
char21 = deviceName[21]
340+
except:
341+
char21 = None
342+
336343
# Sets DEVICE_NAME depending on the retrieved name
337344
if deviceName == "Komplete Kontrol A DAW":
338345
DEVICE_SERIES = "A_SERIES"
@@ -342,13 +349,12 @@ def detectDevice():
342349
DEVICE_SERIES = "M_SERIES"
343350
print("Detected device: Komplete Kontrol M-Series")
344351

345-
elif deviceName[21] == "-": # Gets the 18th char on the name to see if it matches the "Komplete Kontrol DAW - X" naming scheme S-Series devices follow
352+
elif char21 == "-": # Gets the 18th char on the name to see if it matches the "Komplete Kontrol DAW - X" naming scheme S-Series devices follow
346353
DEVICE_SERIES = "S_SERIES"
347354
print("Detected device: Komplete Kontrol S-Series")
348355

349356
else:
350-
DEVICE_SERIES = "S_SERIES"
351-
print("Device detection failed. Going with Komplete Kontrol S-Series.")
357+
print("Device detection failed. Going with the manually specified device on the script:", DEVICE_SERIES)
352358

353359

354360
######################################################################################################################

0 commit comments

Comments
 (0)