HI again!
I have another issue with using data from the API properly.
When searching for a movie and the result is only one match everything works fine, but when there are more movies which could match the query my StringRegExp code doesn't work anymore. I have to confess I'm not very familiar with StringRegExp :/
The result with only one match looks like this:
{"page":1,"results":[{"adult":false,"backdrop_path":"/vuHG8VlYnvw4gUKtS7GY5kZol69.jpg","id":59967,"original_title":"Looper","release_date":"2012-09-28","poster_path":"/g9FW5mfDN26sNjOcDPB5mIGe8jv.jpg","popularity":10.040000000000001,"title":"Looper","vote_average":7.6,"vote_count":50}],"total_pages":1,"total_results":1}
The result with more matching movies looks like this:
{"page":1,"results":[{"adult":false,"backdrop_path":"/lVA7gi0DOJ5UoxNf56UVAml7BY6.jpg","id":74074,"original_title":"The Raid","release_date":"1954-08-04","poster_path":"/mbSuGsYtubSKWHYiqSwvwhKIYQu.jpg","popularity":0.7200000000000001,"title":"The Raid","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":172460,"original_title":"The Raid","release_date":"2012-02-06","poster_path":"/hUMLyquzx6DoKTrpQmHAxpdwrbt.jpg","popularity":3.4000000000000004,"title":"The Raid","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":"/i5ubqxYkkqZpwgw6nHHUudOuGTh.jpg","id":85,"original_title":"Raiders of the Lost Ark","release_date":"1981-06-12","poster_path":"/tjGpsV0vKKHECtdsQoVwIXsDj3.jpg","popularity":3.8000000000000003,"title":"Raiders of the Lost Ark","vote_average":8.7,"vote_count":86},{"adult":false,"backdrop_path":"/fCcWGyNgz4pmCdgqQsYVZfAgT1K.jpg","id":94329,"original_title":"Serbuan maut","release_date":"2011-11-20","poster_path":"/tDYXQLLnDhPmeG7hUEJSQ2unAK8.jpg","popularity":2.2,"title":"The Raid: Redemption","vote_average":7.6,"vote_count":19},{"adult":false,"backdrop_path":"/zsTpK6SnVNRyHn31VUA3MmfE5ff.jpg","id":130267,"original_title":"Seal Team Six: The Raid on Osama Bin Laden","release_date":"2012-11-04","poster_path":"/g7siZfF9Whskke5FqikZ5UWOSI4.jpg","popularity":1.7799000000000003,"title":"Seal Team Six: The Raid on Osama Bin Laden","vote_average":6.3,"vote_count":1},{"adult":false,"backdrop_path":null,"id":74691,"original_title":"Raiders of Wu Tang","release_date":"1982-09-20","poster_path":"/sMZsOgwphbgTiPBRO9yiqlY0AcZ.jpg","popularity":0.8,"title":"Raiders of Wu Tang","vote_average":6.0,"vote_count":1},{"adult":false,"backdrop_path":"/lZh04Sxm6ThidqkKZkG71SQmdJm.jpg","id":53657,"original_title":"Raid on Rommel","release_date":"1971-02-12","poster_path":"/2vmuqqg91rE5N6HDvumaEeLVm5N.jpg","popularity":0.2,"title":"Raid on Rommel","vote_average":7.5,"vote_count":1},{"adult":false,"backdrop_path":null,"id":75285,"original_title":"Womb Raider","release_date":"2003-08-03","poster_path":"/uhNpZkCdtGpxDMPBmxdFZPmQTft.jpg","popularity":0.2,"title":"Womb Raider","vote_average":3.0,"vote_count":1},{"adult":false,"backdrop_path":"/c8DpfU2VjXXGxQIX9ME3S30YB4e.jpg","id":27349,"original_title":"The Great Northfield Minnesota Raid","release_date":"1972-06-14","poster_path":"/43oCljfg3cttXOxquST5mHrDZtn.jpg","popularity":0.6000000000000001,"title":"The Great Northfield Minnesota Raid","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":"/8U8L12N9MYE1XlnfX79dfRmD37m.jpg","id":39524,"original_title":"De overval","release_date":"1962-12-21","poster_path":"/lhcoW9NBle0IxNhTojVcKEYD0VI.jpg","popularity":0.2,"title":"De overval","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":"/3bKHlG1KYSdflLYjv0ZtrJ7juEd.jpg","id":46728,"original_title":"Le Raid","release_date":"2002-03-27","poster_path":"/fgueJ3rNlgoYlF6GEIE3soL6AaC.jpg","popularity":0.2,"title":"The Race","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":45507,"original_title":"Zhi zun wu shang","release_date":"1989-01-01","poster_path":"/8Cok3CsaAAh97Wcl9dmwvsw3ODp.jpg","popularity":0.2,"title":"Casino Raiders","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":"/9C3qRg6ZdvjjSnyNWX1Kv2LIcdC.jpg","id":62128,"original_title":"Raiders of the Lost Ark - The Adaptation","release_date":"1989-01-01","poster_path":"/6JwdLafP1tW3RNymMvzNXDKNPGJ.jpg","popularity":0.46,"title":"Raiders of the Lost Ark - The Adaptation","vote_average":8.0,"vote_count":1},{"adult":false,"backdrop_path":null,"id":98237,"original_title":"They Raid by Night","release_date":"1942-06-19","poster_path":"/xanjnY2jOgCHTzq18EBQ4F8mywK.jpg","popularity":0.2,"title":"They Raid by Night","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":"/gsR15RUFRFQWXJZ1932ZSHQMLLn.jpg","id":61525,"original_title":"Air Raid Wardens","release_date":"1943-04-04","poster_path":"/rK0qNBO7aCDsyWp9G2fjnmSXTVW.jpg","popularity":0.6834000000000001,"title":"Air Raid Wardens","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":"/dKgZw3SSorKbTmcduzFCDJcxvnC.jpg","id":13954,"original_title":"Alien Raiders","release_date":"2008-09-21","poster_path":"/l7Pua9InXMr4v9KXfFrTH8sbtLW.jpg","popularity":0.2,"title":"Alien Raiders","vote_average":3.6,"vote_count":4},{"adult":false,"backdrop_path":null,"id":82732,"original_title":"America's Game: 1976 Oakland Raiders","release_date":"2006-12-19","poster_path":"/3gUxbKGT0eyXBkCTsSVc3wY7AbJ.jpg","popularity":0.6000000000000001,"title":"America's Game: 1976 Oakland Raiders","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":82734,"original_title":"America's Game: 1980 Oakland Raiders","release_date":null,"poster_path":"/dnsG36KiCUmjWZtscucOeoK2sYi.jpg","popularity":0.2,"title":"America's Game: 1980 Oakland Raiders","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":82735,"original_title":"America's Game: 1983 Los Angeles Raiders","release_date":"2006-12-19","poster_path":"/89buKbdcfw8IsccR1uXkCIa69zi.jpg","popularity":0.2,"title":"America's Game: 1983 Los Angeles Raiders","vote_average":0.0,"vote_count":0},{"adult":false,"backdrop_path":null,"id":132939,"original_title":"Arizona Raiders","release_date":"1965-08-01","poster_path":"/xpjibth217ARwz9MMuGXGRj5K9M.jpg","popularity":0.2,"title":"Arizona Raiders","vote_average":0.0,"vote_count":0}],"total_pages":5,"total_results":97}
My StringRegExp Code is as follows:
;TMDbID:
$array = StringRegExp($data, '"id":(.*?),"', 2)
If @error Then
;nothing
Else
$idTMDbTXT = $array[1]
MsgBox(0,"TMDB ID",$idTMDbTXT)
;Jahr:
$array = StringRegExp($data, '"release_date":"(.*?)"', 2)
$YearTXT = StringTrimRight($array[1], 6)
MsgBox(0,"Jahr",$YearTXT)
EndIf
$data is the string from above!
How do I have to modifiy my StringRegExp Code for not just getting an error when there are more results? Maybe even with a box that shows all results (Movienames + Year) and the user has to select the right one?