dkl
Full Member
Posts: 234
|
Post by dkl on Feb 14, 2021 23:13:17 GMT -5
Rod - After working with the programme you posted, I practised with the following 3 programmes, which are listed below!
V1 works fine and displays downloaded pic (the original links have been edited manually before inserting them into an array$)
V2 works fine too and is just the same basic format as V1 (the original links have been edited manually before inserting them into an array$)
V3 takes the the original file link - converts it to - a downloadable format - inserts it in to an Array$
V3 will not write each individual array$ into a separate pix file even though the edited link is correct and if inserted manually it will download.
I get the following error: - Runtime Error: The resource loader cache doesn't have loaded MUI entry. (OS 16r3B01)
I'm cannot see the problem as I don't think I've changed anything from the other 2 versions - or need to. I'm not sure you'll be able to test the versions as you probably won't be able to access the files directly, but can probably use your own.
They are written into "C:\temp\";"temp";a;".bmp" for V1 & V2.
In V3 the link names are in "C:\temp\TV_BMP.txt"
I'm hoping you may have the time to figure out the problem! ?
Thanks
V1 Dim M$(10),D$(10) a=1:b=1:x=1:q=4
M$(1) = "https://drive.google.com/uc?export=download&id=1-L8X2tcuwZJxP_g9hzlEN9cUAhSkOPNW " M$(2) = "https://drive.google.com/uc?export=download&id=1AAswYYM58I0emAbrZtbQ0disGrG4ZJUP " M$(3) = "https://drive.google.com/uc?export=download&id=1IQ3C9Hd2nP7gkagcrENQY8ZQhNd3QJgC " M$(4) = "https://drive.google.com/uc?export=download&id=1N-c-FXBl1Yz2tD2dRN0Fw7RfUb7Qd99F "
[testIt] for s = 1 to q print M$(s) next s
[writeIt] print "WRITING" print M$(a) f$=httpget$(M$(a)) '<--- My BMP open "C:\temp\";"temp";a;".bmp" for output as #temp #temp f$; close #temp a=a+1 if a>q then [displayIt] goto [writeIt]
[displayIt] print "DISPLAYING" bmpfile$ = "C:\temp\";"temp";b;".bmp"'"C:\Users\kleth\Desktop\GlideApp\temp\";"temp";b;".bmp" loadbmp "temp",bmpfile$ ' nomainwin 'open a window and graphicbox WindowHeight = 700 WindowWidth = 400 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2) button #w.L, "<<", [goLeft], LL,10, 10, 40,40 button #w.R, ">>", [goRight], LR,25, 25, 40,40 button #w.R, "Quit", [quit], LL,180, 10, 40,40 graphicbox #w.g, 0, 0, 400, 600 open "test" for window as #w #w "trapclose [quit]" #w.g "down ; drawbmp temp"' 0 0" wait
[quit] close #w print "DONE" end
[goLeft] close #w b=b-1:if b=0 then b = q goto [displayIt]
[goRight] close #w b=b+1:if b>q then b = 1 goto [displayIt]
V2
Dim M$(10),D$(10) a=1:b=1:q=1':x=1
[readIt] print "READING" read D$ M$(q) = D$ print M$(q) q=q+1 if D$ = "-1" then q = 4:goto [writeIt] goto [readIt] Data "https://drive.google.com/uc?export=download&id=1-L8X2tcuwZJxP_g9hzlEN9cUAhSkOPNW " Data "https://drive.google.com/uc?export=download&id=1AAswYYM58I0emAbrZtbQ0disGrG4ZJUP " Data "https://drive.google.com/uc?export=download&id=1IQ3C9Hd2nP7gkagcrENQY8ZQhNd3QJgC " Data "https://drive.google.com/uc?export=download&id=1N-c-FXBl1Yz2tD2dRN0Fw7RfUb7Qd99F " Data "-1"
[writeIt] print "WRITING" print M$(a) f$=httpget$(M$(a)) '<--- My BMP open "C:\temp\";"temp";a;".bmp" for output as #temp #temp f$; close #temp a=a+1 if a>=4 then [displayIt] goto [writeIt]
[displayIt] print "DISPLAYING" bmpfile$ = "C:\temp\";"temp";b;".bmp"'"C:\Users\kleth\Desktop\GlideApp\temp\";"temp";b;".bmp" loadbmp "temp",bmpfile$ ' nomainwin 'open a window and graphicbox WindowHeight = 700 WindowWidth = 400 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2) button #w.L, "<<", [goLeft], LL,10, 10, 40,40 button #w.R, ">>", [goRight], LR,25, 25, 40,40 button #w.R, "Quit", [quit], LL,180, 10, 40,40 graphicbox #w.g, 0, 0, 400, 600 open "test" for window_nf as #w #w "trapclose [quit]" #w.g "down ; drawbmp temp"' 0 0" wait
[quit] close #w print "DONE" end
[goLeft] close #w b=b-1:if b=0 then b = q goto [displayIt]
[goRight] close #w b=b+1:if b>q then b = 1 goto [displayIt]
V3
Dim M$(500),D1$(500),SH$(100)', M1$(30),M2$(30),M3$(30), M4$(30),tv$(500) a=1'counter for [writeIt] b=1'counter to [showIt] q=1'counter for no of files read into M$ D1$ = "https://drive.google.com/uc?export=download&id="
open "C:\temp\TV_BMP.txt" for input as #1 [readIt] line input #1,tv$:gosub [editIt] if EOF(#1) < 0 then goto [printIt] q=q+1 if EOF(#1) = 0 then [readIt]
[editIt] M1$ = tv$ print "M1$ = -> ";M1$ M2$ = replstr$(M1$,"/view?usp=sharing","")'strip file print "M2$ = -> ";M2$ M3$ = replstr$(M2$,"https://drive.google.com/file/d/","")'strip file print "M3$ = -> ";M3$ M$(q) = "M$(";q;") = -> ";chr$(34)+D1$+M3$+chr$(34) print "M$ = -> ";M$(q) print "----------------------------------------" M1$="":M2$="":M3$="":M4$="":tv$="" return
[printIt] close #1 for s = 1 to q print M$(s) next s print q
[writeIt] print "WRITING" print M$(a) f$=httpget$(M$(a)) open "C:\temp\";"temp";a;".bmp" for output as #temp #temp f$; close #temp a=a+1 if a>q then [displayIt] goto [writeIt]
[displayIt] print "DISPLAYING" bmpfile$ = "C:\temp\";"temp";b;".bmp" loadbmp "temp",bmpfile$ ' nomainwin 'open a window and graphicbox WindowHeight = 700 WindowWidth = 400 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2) button #w.L, "<<", [goLeft], LL,10, 10, 40,40 button #w.R, ">>", [goRight], LR,25, 25, 40,40 button #w.R, "Quit", [quit], LL,180, 10, 40,40
graphicbox #w.g, 0, 0, 400, 600 open "test" for window_nf as #w #w "trapclose [quit]" #w.g "down ; drawbmp temp"' 0 0" 'input z$ 'close #w 'b=b+1:if b>q then b = 1 'goto [displayIt] wait
[quit] close #w print "DONE" end
[goLeft] close #w b=b-1:if b=0 then b = q goto [displayIt]
[goRight] close #w b=b+1:if b>q then b = 1 goto [displayIt]
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Mar 1, 2021 21:36:21 GMT -5
Hi Rod, Sorry to bother you - probably just another incorrect command!
After you pointed out my error when I printing my BMP's to disk I adopted your way of doing it and tranfered the code into another programme. However, I get strange results and have spent 2 weeks trying to figure the problem out and finally need to ask for your assistance please!
I have added the graphics window to a GUI with text boxes and got the programme to read and convert the BMP info, print it to disk and then display the BMP and relevant info that goes with it. Unfortunately, it crashes when the BMP is displayed, giving me the same 'invalid bitmap format' as before. The BMP will display in windows, but not in Liberty Basic even though it was written by LB. If I tell the programme to display an alternative BMP then it works fine, so I can only assume that I've made errors in the writing to disk module, but it is exactly the same as your code and if I print out the converted info of the BMP before it is written to disk, then as far as I can see there is no extra info added on like before.
I've enclose the code for the programme and a short data file to be saved as C:\Test\Test1.csv
I would really appreciate your help.
Many Thanks.
NOTE:- M$ -> & Image$(4) after edit ->
.......in printed display is NOT part of the BMP name. It is simply there to tell me what I'm looking at. That was the mistake I made before!
If you hyphen out the following in [displayIt] - you'll see then GUI displayed
loadbmp "Mybmp",bmpfile$ #main "trapclose [quit.main]" #main.g "down drawbmp Mybmp"' 0 0"
FX$="C:\Test\Test1.csv" 'NAME OF FILE TO READ D1$ = "https://drive.google.com/uc?export=download&id="
Dim TVShow$(322),Creator$(322),Actors$(322),Genre$(322),IMDbRating$(322),Year$(322),Language$(322),Seen$(322),Season$(322),Episodes$(322),IMDbWeblink$(322),Synopsis$(322),Image$(322)
DIM A$(100),B$(100),C$(100),D$(100),E$(100),F$(100),G$(100),H$(100),I$(100),J$(100),K$(100),L$(100),M$(100)
l=200:tb=13:gp=717 x=10:y=10:h=25:ygap=30:margin=20:d=1:q=0:z=1:y=1 'Nomainwin WindowWidth = (l+(margin*2))+500 WindowHeight = gp+60 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'--------------------------------------------------------------------------------MAKE GUI
graphicbox #main.g 250, 0, 400, 600
statictext #main.stb1,"TV Show",10,-14,200,15 textbox #main.tb1,10,1,200,25 statictext #main.stb2,"Creator",10,41,200,15 textbox #main.tb2,10,56,200,25 statictext #main.stb3,"Actors",10,96,200,15 textbox #main.tb3,10,111,200,25 statictext #main.stb4,"Genre",10,151,200,15 textbox #main.tb4,10,166,200,25 statictext #main.stb5,"IMDb Rating",10,206,200,15 textbox #main.tb5,10,221,200,25 statictext #main.stb6,"Year",10,261,200,15 textbox #main.tb6,10,276,200,25 statictext #main.stb7,"Language",10,316,200,15 textbox #main.tb7,10,331,200,25 statictext #main.stb8,"Seen",10,371,200,15 textbox #main.tb8,10,386,200,25 statictext #main.stb9,"Season",10,426,200,15 textbox #main.tb9,10,441,200,25 statictext #main.stb10,"Episodes",10,481,200,15 textbox #main.tb10,10,496,200,25 statictext #main.stb11,"IMDb Weblink",10,536,200,15 textbox #main.tb11,10,551,200,25 statictext #main.stb12,"Synopsis",10,591,200,15 textbox #main.tb12,10,606,200,25 statictext #main.stb13,"Image",10,646,200,15 textbox #main.tb13,10,661,200,25
button #main.Larrow, "<",[Bdata], LL, 10, 5, 40, 20 button #main.Rarrow, ">",[Fdata], LR, 10, 20, 40, 20 button #main.2Larrow, "<<",[2Bdata], LL, 60, 5, 40, 20 button #main.2Rarrow, ">>",[2Fdata], LR, 70, 20, 40, 20
button #main.Start, "Reset",[reset], LL, 10, -20, 40, 20 button #main.Exit, "Exit",[quit.main], LR, 10, -5, 40, 20
'--------------------------------------------------------------------------------------READ DATA
open FX$ for input as #readFile while EOF(#readFile)=0 [read] inputcsv #readFile,A$,B$,C$,D$,E$,F$,G$,H$,I$,J$,K$,L$,M$
TVShow$(q) = A$ print A$,q Creator$(q) = B$ Actors$(q) = C$ Genre$(q) = D$ IMDbRating$(q) = E$ Year$(q) = F$ Language$(q) = G$ Seen$(q) = H$ Season$(q) = I$ Episodes$(q) = J$ IMDbWeblink$(q) = K$ Synopsis$(q) = L$ gosub [editIt]'<- EDIT AND WRITE BMP 'Image$(q) = M$
q=q+1:if q=5 then close #readFile:goto [openIt] '-------------ONLY PRINT & EDIT 5 FILES wend
'---------------------------------------------------------------------------------OPEN GUI and DISPLY INFO [openIt]
open "test" for window as #main
[Start] print #main.tb1,TVShow$(y) print #main.tb2,Creator$(y) print #main.tb3,Actors$(y) print #main.tb4,Genre$(y) print #main.tb5,IMDbRating$(y) print #main.tb6,Year$(y) print #main.tb7,Language$(y) print #main.tb8,Seen$(y) print #main.tb9,Season$(y) print #main.tb10,Episodes$(y) print #main.tb11,IMDbWeblink$(y) print #main.tb12,Synopsis$(y) print #main.tb13,Image$(y)
'-----------------------------------------------------------------------DISPLAY BMP [displayIt] print "DISPLAYING" bmpfile$ = "C:\temp\temp";y;".bmp" 'bmpfile$ = "C:\temp\temp01.bmp" THIS IS TO DISPLAY KNOWN TEST THAT WORKS print bmpfile$ loadbmp "Mybmp",bmpfile$ #main "trapclose [quit.main]" #main.g "down drawbmp Mybmp"' 0 0"
wait '-------------------------------------------------------------MOVE FWD/BWD in GUI
[Bdata] y=y-1:if y <1 then y = 1 goto[Start] wait [Fdata] y=y+1 goto[Start] wait [2Bdata] y=y-10:if y <1 then y = 1 goto[Start] wait [2Fdata] y=y+10 goto[Start] wait [reset] y=1 goto[Start]
'------------------------------------------------------------------------------- EDIT BMP TO WRITE TO DISK then WRITE IT TO DISK
[editIt] print "M$ -> ";M$ Image$(q)="https://drive.google.com/uc?export=download&id="+word$(M$,6,"/") print "Image$(";q;") after edit -> ";Image$(q)
'BOTH VERSIONS PRODUCE THE SAME RESULT - MY OLD CODE TO EDIT BMP LINK 'M1$ = M$ ' print "M1$-> ";M1$ 'M2$ = replstr$(M1$,"/view?usp=sharing","")'strip file ' print "M2$-> ";M2$ 'M3$ = replstr$(M2$,"https://drive.google.com/file/d/","")'strip file ' print "M3$-> ";M3$ 'M$ = D1$+M3$ ' print "M$-> ";M$(q) 'Image$(q) = M$
if q = 0 then Image$(q) = "Image":return
'---------------------------------------------------------WRITE BMP TO DISK 'print "----------------------------------------" print "WRITING" print Image$(q) f$=httpget$(Image$(q)) open "C:\temp\";"temp";q;".bmp" for output as #temp #temp f$; close #temp print "----------------------------------------" return
[quit.main] close #main end
DATA FILE
TV Show,Creator,Actors,Genre,IMDb Rating,Year,Language,Seen,Season,Episodes,IMDb Weblink,Synopsis,Image 24,"Robert Cochran, Joel Surnow","Kiefer Sutherland, Mary Lynn Rajskub, Carlos Bernard","Action, Crime, Drama",83,2001,English,,4,24,https://www.imdb.com/title/tt0285331/,"In this concept drama, each season takes place within one 24 hour period. Day 1: Jack Bauer is the head of field ops for an elite team of CTU agents who uncover an assassination plot targeting Presidential nominee David Palmer. Meanwhile, Jack's strained marriage to his wife, Teri, is pushed to the brink by the sudden disappearance of their troubled teenage daughter. What will the next 24 hours hold?",https://drive.google.com/file/d/1sjE6yNoujEs_1z8P-o9SR36nVrKYXBr6/view?usp=sharing 1864,Ole Bornedal,"Pilou Asbæk, Sarah-Sofie Boussnina, Bent Mejding","Drama, History",67,2014,Danish,Y,1,8,https://www.imdb.com/title/tt1753353/,"When Prussia and Austria declare war on Denmark, two brothers are called to serve in the bloodiest battle in Denmark's history.",https://drive.google.com/file/d/1G--DqzNRyVsAG67LK3tiVTvSE0PaROCE/view?usp=sharing 1983,Joshua Long,"Robert Wieckiewicz, Maciej Musial, Michalina Olszanska","Crime, Drama, Thriller",68,2018,Poland,N,1,8,https://www.imdb.com/title/tt7371666/,"Decades after a 1983 terrorist attack, a law student and a cop uncover a conspiracy that's kept Poland as a police state and the Iron Curtain standing.",https://drive.google.com/file/d/13EbNqMiAG75geIsX2t1kPIcvVgTQxxfV/view?usp=sharing 22-Jul,Paul Greengrass,"Anders Danielsen Lie, Jonas Strand Gravli, Jon Øigarden","Crime, Drama, Thriller, History",68,2018,Norwegian,,,,https://www.imdb.com/title/tt7280898/,"In Norway on 22 July 2011, right-wing terrorist Anders Behring Breivik murdered 77 young people attending a Labour Party Youth Camp on Ut?ya Island outside of Oslo. A three-part story. About the survivors of the attacks, the political leadership of Norway, and the lawyers involved.",https://drive.google.com/file/d/1GCXfAMNhwapBKgbEWhL2ZKKhptbMpnlh/view?usp=sharing 37 Days,,"Ian McDiarmid, Nicholas Farrell, Tim Pigott-Smith",History,82,2014,UK,,1,3,https://www.imdb.com/title/tt3101352/,A TV mini-series that unveils the behind-closed-doors story of the final weeks before the outbreak of World War I.,https://drive.google.com/file/d/1vmjnjsntRHX7OCUyGZvzEJ2JDDeMsPnt/view?usp=sharing
|
|