ExportFile to a MAC
Posted: Wed Mar 01, 2017 8:00 pm
Hello All.
My first post ever on any forum and a newcomer to SpiderBasic.
I've written an app to generate a short MIDI file template which is then modified via a User interface. I used the 'Web' tab in the Compiler menu to create the app.
The modified data is held in an array (MDhd) and the following snippet, lifted from SB Help, writes the array contents to the 'Screen_Config.mid' file when triggered by a mouse click:
;Write array to file
Result = CreateFile(0,"Screen_Config.mid",#PB_UTF8)
For i = 1 To ArraySize(MDhd())
WriteByte(0,MDhd(i))
Next
;Export file And close
ExportFile(0,"audio/midi", #PB_LocalFile)
CloseFile(0)
On a PC the MIDI file downloads perfectly into the 'Downloads' folder - all is good.
However, on a MAC as soon as my ExportHandler procedure is triggered, the MAC just opens a new blank browser instance with no clues as to what happened to the MIDI file! This happens with both Fire Fox and Safari.
Am I right in thinking that as the code is embedded in the web page it should work across all platforms identically or does it need to be compiled differently to suit a browser running on a MAC?
I’ve assumed, rightly or wrongly, that the ‘iOS’ tab in the Compiler's ‘Create App’ menu only applies to iPads and iPhones similar to the Android option for Android tablets and phones.
Any help would be most gratefully received. I should add that I'm totally ignorant of the workings of a MAC (in case you hadn't already guessed!).
Thank you.
Cheers, Ron.
My first post ever on any forum and a newcomer to SpiderBasic.
I've written an app to generate a short MIDI file template which is then modified via a User interface. I used the 'Web' tab in the Compiler menu to create the app.
The modified data is held in an array (MDhd) and the following snippet, lifted from SB Help, writes the array contents to the 'Screen_Config.mid' file when triggered by a mouse click:
;Write array to file
Result = CreateFile(0,"Screen_Config.mid",#PB_UTF8)
For i = 1 To ArraySize(MDhd())
WriteByte(0,MDhd(i))
Next
;Export file And close
ExportFile(0,"audio/midi", #PB_LocalFile)
CloseFile(0)
On a PC the MIDI file downloads perfectly into the 'Downloads' folder - all is good.
However, on a MAC as soon as my ExportHandler procedure is triggered, the MAC just opens a new blank browser instance with no clues as to what happened to the MIDI file! This happens with both Fire Fox and Safari.
Am I right in thinking that as the code is embedded in the web page it should work across all platforms identically or does it need to be compiled differently to suit a browser running on a MAC?
I’ve assumed, rightly or wrongly, that the ‘iOS’ tab in the Compiler's ‘Create App’ menu only applies to iPads and iPhones similar to the Android option for Android tablets and phones.
Any help would be most gratefully received. I should add that I'm totally ignorant of the workings of a MAC (in case you hadn't already guessed!).
Thank you.
Cheers, Ron.