Procedure OnLeftClick_OK()
If( GetGadgetState( #Checkbox_0 ) = #PB_Checkbox_Checked )
;procedure to download moustique
Debug "Downloading book."
If( ReadFile(0, "moustique.pdf", @Callback) )
Length.q = Lof(0)
*Buffer = AllocateMemory(Length);Error here: RangeError: invalid or out-of-range index (http://127.0.0.1:9080/spiderbasic.js?t=1767612810, line: 149)
*Buffer = ExportFileMemory(0)
;ReadData(0, *Buffer, 0, Length)
CreateFile(1, "mosticos.pdf", @Callback)
WriteData(1, *Buffer, 0, Length);There is an error in the documentation for this function. Only 3 parameters are given when 4 are required. Perhaps this should be reported?
ExportFile(1, "application/pdf")
CloseFile(0)
CloseFile(1)
;ExportFile("moustique.pdf", "application/pdf")
EndIf
EndIf
EndProcedure
I don't think you can do that easily, I could add an optional output name for ExportFile(). For now, you can try to create another file with the good filename and use WriteData() to transfert it. Not very simple I agree.