automatic consecutive numbering
-
That’s pretty awesome! Thanks a lot for that :)
One question though, somehow I can’t select the outcoming text from the box that pops up (autohotkey) if I run the script.
I just installed autohotkey so I’m not familiar with that…Thanks once again - your the man of the hour!
-
Got it by just pressing Ctrl+C while open :)
-
The outcome is already in the clipboard or, as you just discovered, you can copy it from the Message box.
Glad it helped you!
-
Hey Maestro, sorry to “bother” you but I’ve got a different question about the whole script. I’ve got it to make my own changes but now I’ve got a big ?
The lines starting with 117-XXX can only go until 117-127 after that the lines should continue with 118-0 until 128-127 is reached again and then continue with 119-0 etc. Problem now is that all the numbers used in 117 cannot be used again in 118. (There seems to be a link between 117-0 and the number 0 itself - as I really don’t know what the link could be, may you spot the point why the two numbers are linked or even better how I could continue as described above.
Here to showcase the two numbers (linked) in this case number 0
// 117-0 CSS+CSSS vI-vII-va-vlc 0:{ 'trackname':'CSS VL', 'trackarticulations':[]},
Here the whole script for a full overview:
var bank, patch, buttonGrid, labelTexts; var buttons = { 'b1':'/b1/show','b2':'/b2/show','b3':'/b3/show','b4':'/b4/show','b5':'/b5/show', 'b6':'/b6/show','b7':'/b7/show','b8':'/b8/show','b9':'/b9/show','b10':'/b10/show', 'b11':'/b11/show','b12':'/b12/show','b13':'/b13/show','b14':'/b14/show','b15':'/b15/show', 'b16':'/b16/show','b17':'/b17/show','b18':'/b18/show','b19':'/b19/show','b20':'/b20/show', 'b21':'/b21/show','b22':'/b22/show','b23':'/b23/show','b24':'/b24/show','b25':'/b25/show', 'b26':'/b26/show','b27':'/b27/show','b28':'/b28/show','b29':'/b29/show','b30':'/b30/show', 'b31':'/b31/show','b32':'/b32/show','b33':'/b33/show','b34':'/b34/show','b35':'/b35/show', 'b36':'/b36/show','b37':'/b37/show','b38':'/b38/show','b39':'/b39/show','b40':'/b40/show', 'b41':'/b41/show','b42':'/b42/show','b43':'/b43/show','b44':'/b44/show','b45':'/b45/show', 'b46':'/b46/show','b47':'/b47/show','b48':'/b48/show','b49':'/b49/show','b50':'/b50/show', 'b51':'/b51/show','b52':'/b52/show','b53':'/b53/show','b54':'/b54/show','b55':'/b55/show' } var labels = { 'b1':'/b1/label','b2':'/b2/label','b3':'/b3/label','b4':'/b4/label','b5':'/b5/label', 'b6':'/b6/label','b7':'/b7/label','b8':'/b8/label','b9':'/b9/label','b10':'/b10/label', 'b11':'/b11/label','b12':'/b12/label','b13':'/b13/label','b14':'/b14/label','b15':'/b15/label', 'b16':'/b16/label','b17':'/b17/label','b18':'/b18/label','b19':'/b19/label','b20':'/b20/label', 'b21':'/b21/label','b22':'/b22/label','b23':'/b23/label','b24':'/b24/label','b25':'/b25/label', 'b26':'/b26/label','b27':'/b27/label','b28':'/b28/label','b29':'/b29/label','b30':'/b30/label', 'b31':'/b31/label','b32':'/b32/label','b33':'/b33/label','b34':'/b34/label','b35':'/b35/label', 'b36':'/b36/label','b37':'/b37/label','b38':'/b38/label','b39':'/b39/label','b40':'/b40/label', 'b41':'/b41/label','b42':'/b42/label','b43':'/b43/label','b44':'/b44/label','b45':'/b45/label', 'b46':'/b46/label','b47':'/b47/label','b48':'/b48/label','b49':'/b49/label','b50':'/b50/label', 'b51':'/b51/label','b52':'/b52/label','b53':'/b53/label','b54':'/b54/label','b55':'/b55/label' } var instruments = { // 117-0 CSS+CSSS vI-vII-va-vlc 0:{ 'trackname':'CSS VL', 'trackarticulations':[]}, // 117-1 CSS Basses 1:{ 'trackname':'CSS BASSE', 'trackarticulations':[]}, // 117-2 BST Violins 1 2: { 'trackname':'BST Violins 1', 'trackarticulations':[]}, // 117-3 BST Violins 1 x 3: { 'trackname':'BST Violins 1 x', 'trackarticulations':[]}, // 117-4 BST Violins 2 4: { 'trackname':'BST Violins 2', 'trackarticulations':[]}, } module.exports = { oscInFilter:function(data) { var {address, args, host, port} = data if (address !=='/control') return if (args[1].value < 117) return if (args[1].value == 127) { send('midi','OSCtoDAW','/control', 1,126,1) return } else { bank = (args[1].value - 117) patch = (bank * 128) + args[2].value labelTexts=instruments[patch].trackarticulations var len =labelTexts.length for (i = 0; i < len; i++) { receiveOsc({address: Object.values(buttons)[i], args: [{type:'i', value: 1}]}) receiveOsc({address: Object.values(labels)[i], args: [{type:'s', value: labelTexts[i]}]}) } var len2=Object.values(buttons).length for (i = len; i < len2; i++) { receiveOsc({address: Object.values(buttons)[i], args: [{type:'i', value: 0}]}) } // SHOW SELECTED INSTRUMENT receive('/EDIT', 'button_container_id', {html:''+ instruments[patch].trackname }) return } return {address, args, host, port} }, }
Your help would be more than appreciated :)
-
@Andreas-Trösch said in automatic consecutive numbering:
(There seems to be a link between 117-0 and the number 0 itself - as I really don’t know what the link could be, may you spot the point why the two numbers are linked or even better how I could continue as described above.
Sorry, I took a look at the code but I didn’t find anything that can help you. Javascript is not my thing.
Maybe someone else can chime in and give you a clue.
Good Luck!
-
Hello, @andreas-trösch, @astrosofista, and All,
@andreas-trösch, if you have a lot of instruments
Solo Oboe BWW , Eng Horn BWW , Cor Anglais SFWW
, … and that you need to run the sequence117-16 ...... 117-127 , 118-0 ...... 118-127 , 119-0 ......
, I suppose that the followingAutoHotKey
script should work :SampleText := " ( Solo Oboe BWW Eng Horn BWW Cor Anglais SFWW ; Other value ; Other value ; ........... ; ........... ; Other value ; Other value )" Output := "" seq := 117 Pattern = // {}-{} {}`n{}:{{} 'trackname':'{}', 'trackarticulations':[]{}},`n num := 16 ; place here the initial value For _, v in StrSplit(SampleText, "`n") { Output .= Format(Pattern, seq, num, v, num, v) num++ if ( num = 128 ) n := 0 seq++ } MsgBox, % Clipboard := Output return
Of course, replace all comments lines
; other value
with the different names of your instruments’s list !
Please, I do not know the
AutoHotKey
language and I just verified theif statement
syntax ;-)) Hope it works nice !Best regards
guy038
-
Hi guys,
Thanks a lot for your support!
The thing within autohotkey is clear and works perfectly. The only issue I’m having is that the script won’t work anymore as soon as I continue with 118-0. Not because of the 118 but the zero. I don’t get it why the numbers after 117- or 118- cannot be used twice.
-
I found it - it was just a space too much and a fault from my side :) So everything is alright!
Thanks anyway - your support is much appreciated.
-
It looks as I misunderstood OP’s issue :(
Here is a new version of the code: The pattern is the same, just placed the fixed value 117 into a variable to let it grow.
SampleText := " ( ; Place the list of instruments here )" Output := "" Pattern = // {}-{} {}`n{}:{{} 'trackname':'{}', 'trackarticulations':[]{}},`n num_A := 117 ; primary sequence num_B := 0 ; secondary sequence For _, v in StrSplit(SampleText, "`n") { Output .= Format(Pattern, num_A, num_B, v, num_B, v) num_B++ (num_B > 127) ? (num_B := 0, num_A++) : } MsgBox, % Clipboard := Output return
Hope it’s fine now.
-
Hey guys!
It was all good with the first script. I made a mistake by myself. You didn’t misunderstand what I was looking for. English is anyway not my native language so its more likely that I couldn’t explain it correctly. :)
You really helped me and I can proceed with my orchestral template script!
Thanks again.