So I’m trying to automate the form field data entry for https://www2.mediabase.com/mbapp/NewMusicNotification
and automate / iterate through a csv. This csv (have to keep private) contains all the data needed for this form and my attached example is very close to working. It’s task is to find the song on my HDD and upload with the registration data of the song. I followed the file upload tutorial but couldn’t get iteration to work with a csv. I’ve got it going through the first data entry (which is the last row added in the csv) but not iterating to the next data entry. (row) Is it because it’s starting at the bottom of the csv and doesn’t know how to iterate?
To the person that helps me with this, I’ll send you a six pack, a video game code on steam and some signed albums. I have over 260 songs, and I know other musicians/djs/creators which have large collections that could benefit from this macro. I’d be putting together a github to share all my music form submission / registration macros…
{
“Name”: “MediabasePlusFileUpload”,
“CreationDate”: “2022-1-22”,
“Commands”: [
{
“Command”: “csvReadArray”,
“Target”: “djbigdadtomediabaseresponse_5-1-2022.csv”,
“Value”: “arr”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${arr[0]}.length;”,
“Value”: “col”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “Number of Rows = ${!csvReadMaxRow}”,
“Value”: “green”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “Number of Columns = ${col}”,
“Value”: “pink”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “"Status = ${!csvReadStatus}, line = ${!csvReadLineNumber}"”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “times”,
“Target”: “${!csvReadMaxRow}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “open”,
“Target”: “Mediabase - New Music Notification”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${!times} - 1;”,
“Value”: “i”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “Current CSV Row: col1=${arr[${i}][0]}, col2=${arr[${i}][1]}, col3=${arr[${i}][2]}”,
“Value”: “brown”,
“Description”: “”
},
{
“Command”: “if_v2”,
“Target”: “${arr[${i}][2]} == "done"”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “Row ${!times} is already done, skipping it.”,
“Value”: “green”,
“Description”: “”
},
{
“Command”: “else”,
“Target”: “${arr[${i}][2]} == "done"”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “Row ${!times} – Form filling etc would be here”,
“Value”: “blue”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “${!csvReadMaxRow}”,
“Value”: “!csvReadLineNumber”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “${!csvReadStatus} == \"OK\"”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “csvRead”,
“Target”: “djbigdadtomediabaseresponse_5-1-2022.csv”,
“Value”: “arr”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=Name”,
“Value”: “${!COL10}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=Company”,
“Value”: “${!COL5}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=Phone”,
“Value”: “${!COL11}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=Email”,
“Value”: “${!COL6}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=ExactArtist”,
“Value”: “${!COL2}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=FeaturedArtist”,
“Value”: “${!COL17}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=LabelListing”,
“Value”: “${!COL9}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=ExactTitle”,
“Value”: “${!COL14}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=MixVersion”,
“Value”: “${!COL16}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=OfficialReleaseDate”,
“Value”: “${!COL12}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=TrackIsrc”,
“Value”: “${!COL7}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=CdTitle”,
“Value”: “${!COL1}”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=CdUpc”,
“Value”: “${!COL15}”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//input[@id=‘IsIndependentLabel’ and @name=‘IsIndependentLabel’ and @value=‘true’]”,
“Value”: “true”,
“Description”: “Independent?”
},
{
“Command”: “click”,
“Target”: “id=IsChristmasOrHanukah”,
“Value”: “false”,
“Description”: “Christmas/Hanukah Music?”
},
{
“Command”: “click”,
“Target”: “id=HasCanadianContent”,
“Value”: “false”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=ArtistWebUrl”,
“Value”: “${!COL4}”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “id=AudioFile”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “id=AudioFile”,
“Value”: “${!COL13}”,
“Description”: “File Upload by Path”
},
{
“Command”: “comment”,
“Target”: “XType // ${KEY_ESC}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “XClick”,
“Target”: “submit_dpi_168.png”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “Number of tracks registered: ${!times}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “Change last column to DONE <== HERE IS WHERE THE MAGIC HAPPENS”,
“Value”: “arr”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: "var b = ${arr}; b[${i}][2] = "done"; return b; ",
“Value”: “arr”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “Save array after each loop, use same CSV name”,
“Value”: “arr”,
“Description”: “”
},
{
“Command”: “csvSaveArray”,
“Target”: “djbigdadtomediabaseresponse_5-1-2022.csv”,
“Value”: “arr”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
}
]
}