Author Topic: Development of a program for automatic search for music and movies  (Read 21744 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Development of a program for automatic search for music and movies
« Reply #90 on: June 27, 2020, 05:09:26 pm »
yep! That worked! Good thinking, @bplus ! Your code finished in 4.66 seconds on my machine, simply building and sorting the array whereas Steve's took over 9 seconds to do it. Nice! See, in this case, with PowerShell, mine works faster because it is a huge directory. Mine wins against yours coming in at 3.15 seconds because the large process can be handled by PowerShell much quicker. Small folders, your code. Big folders, my code. I wish I had a way to figure out whether or not to use yours or mine in a program depending on the number of subdirectories..... Hmmm.... I could do a PowerShell call to return the number of subdirectories and if it was greater than 1000 then run mine. Less than, run yours

Well we'll see some better times I think when/if Steve can find still another fix for using the DirEntry.h method. I sure hope so because of cross platform potential but I bet we have some other issues to settle with Linux (at least) once we get Windows part working to it's full potential.

In meantime, what's 2-3 secs anyway? ;-))

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Development of a program for automatic search for music and movies
« Reply #91 on: June 27, 2020, 05:10:41 pm »
Well we'll see some better times I think when/if Steve can find still another fix for using the DirEntry.h method. I sure hope so because of cross platform potential but I bet we have some other issues to settle with Linux (at least) once we get Windows part working to it's full potential.

In meantime, what's 2-3 secs anyway? ;-))
Like I was telling Steve, PowerShell IS cross-platform now! I haven't had a chance to try it on Linux yet but I'll be sure to give it a whirl next week.
Shuwatch!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Development of a program for automatic search for music and movies
« Reply #92 on: June 27, 2020, 05:14:42 pm »
Like I was telling Steve, PowerShell IS cross-platform now! I haven't had a chance to try it on Linux yet but I'll be sure to give it a whirl next week.

Hey you have Linux? Do you have QB64 up and running in there?

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Development of a program for automatic search for music and movies
« Reply #93 on: June 27, 2020, 05:19:47 pm »
Hey you have Linux? Do you have QB64 up and running in there?
Yes, and yes, but it's a small laptop. It does, however, have a solid state drive so it might get good numbers.
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Development of a program for automatic search for music and movies
« Reply #94 on: June 27, 2020, 05:56:51 pm »
I get many failures trying to compile in Linux Ubuntu 18.04. Lots of "No such file or directory" Not sure how to get past that. Not a direntry issue, specifically. I'm not able to compile anything. Latest version of QB64 Linux from the website. Wait, I think I found the issue. Didn't run setup_lnx.sh. DURR!
Also, it looks like your ( @bplus ) program isn't displaying anything more than the first level of folders. It doesn't CHDIR to the next folder. Not sure if that is a Linux incompatibility with QB64. Trying Steve's next.... So I tried mine next and while I can use almost the exact same PowerShell command in Linux to get all directories (292 of them, so far), I can't get it to call PowerShell correctly from QB64. Not sure what the hang up is. So it seems like neither mine or bplus's code is compatible, just yet, which would probably mean that Steve's isn't either. I will check later this evening/tonight.
« Last Edit: June 27, 2020, 06:40:46 pm by SpriggsySpriggs »
Shuwatch!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Development of a program for automatic search for music and movies
« Reply #95 on: June 27, 2020, 06:44:53 pm »
I know 2 things about Linux, it is case sensitive and it it is slash sensitive. I m sure we have been using the wrong slashes for it.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Development of a program for automatic search for music and movies
« Reply #96 on: June 27, 2020, 07:02:46 pm »
@bplus But it does grab the first few directories from your program. So that can't be it. And my function for PowerShell works perfectly but not directly from QB64. This will take much investigation
Shuwatch!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Development of a program for automatic search for music and movies
« Reply #97 on: July 05, 2020, 11:42:56 am »
Hi guys,

I did not sleep. I really continued to develop and I will continue to do so. I used BPlus' method to create a directory tree and then my own procedure to divide into file name / folder name. I am shocked, when found that even though the file on the disk is named track01.mp3, the listing will return it with the name from ID3 (I don't understand where DirEntry read it) but it is a valid file name, it is accessible for both QB64 and Windows Media Player. So the confusion is absolutely perfect :)

Here is another intermediate development stage, now with a known bug, the first file is not displayed in the file list (this happens during development). The program screen is a very rough preview of what I mean by that. At the top there will be icons for color settings, for print output settings and so on, in the right part of the screen there will be information read from files. For the scrolling speed, I set the condition in future version, that the file selection must take 0.3 seconds and only then the information for the file will be read.

Since last time, the program has gained for us a bit. It now creates a configuration INI file (which cannot be set otherwise yet), reads the locale code, and sets unicode characters relative to it. So you should all have legible file names in your national alphabet. What do we have next? Labels in the program. They will be adjustable according to your speech settings. The configuration already thinks about this setting. So instead of English labels you will be able to set any other, for example German, Italian and so on.

The current version does not retrieve any detailed information from the files, it only displays file names. The enter key starts the default player. There will be a lot of work to be done.

Code: QB64: [Select]
  1. 'Tree builder recursive.bas  b+ Petr 2020-06-26  now with SMCNeill Fix!! add CHR$(0) to C string
  2.  
  3. _TITLE "Video and music detective V0.1 alpha"
  4. DEFLNG A-Z
  5.     FUNCTION load_dir& (s AS STRING)
  6.     FUNCTION has_next_entry& ()
  7.     SUB close_dir ()
  8.     SUB get_next_entry (s AS STRING, flags AS LONG, file_size AS LONG)
  9.  
  10. REDIM mask(0) AS STRING
  11. DIM SHARED ForegroundColor~&, BackgroundColor~&, UsedCOUNTRY AS STRING * 20
  12. mask$ = "AVI,MPG,MKV,MPG,MPEG,WAV,ACC,MP4,MP3,MP2,VOC,S3M,MOD,XM,TS,MOV,AC3,WMA,WMV,FLAC,M3U," '           on end must be comma!
  13. ReturnMASK mask(), mask$
  14. path$ = SelectDIR$
  15. t = TIMER(0.001)
  16. PRINT "Loading config..."
  17. LoadINI SortStyle&, ViewStyle&
  18. PRINT "Detecting country (for MAPUNICODE use)...";
  19. IF WIN THEN COUNTRY = GetLCiD
  20. PRINT "Dynamic Library output: "; COUNTRY
  21. PRINT "Creating subdirectories + files list in "; path$
  22. MakeTree path$
  23. PRINT "Subdirectories + files list created in"; TIMER - t
  24. PRINT "total records: "; UBOUND(tree) 'is match with real number files and folders
  25.  
  26. PRINT "Sorting files by mask:"
  27.  
  28. REDIM SHARED RealFiles(100) AS STRING
  29. FOR m = LBOUND(mask) TO UBOUND(mask)
  30.     FOR s = LBOUND(tree) TO UBOUND(tree)
  31.         IF LCASE$(RIGHT$(Tree(s), 3)) = LCASE$(mask(m)) THEN
  32.             RealFiles(RealCount) = Tree(s)
  33.             RealCount = RealCount + 1
  34.             IF RealCount > UBOUND(realfiles) THEN REDIM _PRESERVE RealFiles(RealCount + 100) AS STRING
  35.         END IF
  36.     NEXT s
  37. REDIM _PRESERVE RealFiles(RealCount) AS STRING
  38. PRINT "Valid files now writed to array RealFiles. Size: "; UBOUND(realfiles)
  39. ERASE Tree
  40. PRINT "Loading font arial.ttf..."
  41. font = _LOADFONT("arial.ttf", 18, "bold")
  42. my& = _NEWIMAGE(1920, 1080, 32)
  43. _FONT font, my&
  44. REDIM FileName(0) AS STRING
  45. REDIM FolderName(0) AS STRING
  46. PRINT "Sorting..."
  47. SORT RealFiles(), SortStyle&
  48. PRINT "Sort done, Separating name to file name, folder name and full path..."
  49. SeparateFileName RealFiles(), FileName(), FolderName() 'RealFiles obsahuje plnou cestu k souboru.  FileName osahuje jen jmeno souboru. FolderName obsahuje jen jmeno prvniho nadrazeneho adresare. Indexy vsech se shoduji.
  50. PRINT "Mapping characters by country..."
  51.  
  52. CountryA
  53. SCREEN my&
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. DrawMyScreen ForegroundColor~&, BackgroundColor~& 'static draw
  61. REDIM arr(0) AS STRING
  62. CopyARR FileName(), arr()
  63.  
  64.  
  65. '----------------------------------------------------------------------------------- file browsing init (now contains bug, first file in the list is not visible)
  66. x = 25: Y = 120: Lenght = 112: Height = 40: NumDirs = 0: UseWheel = 1: first = 1
  67. Lb = 0
  68. Le = Lb + Height
  69.  
  70.  
  71.  
  72.  
  73.  
  74. DO UNTIL k$ = CHR$(27)
  75.     ListColor& = Black '_RGB32(166, 244, 244)   nema ucinek
  76.     InPosColor& = Red '_RGB32(67, 72, 238)
  77.     DirColor& = Green '_RGB32(238, 22, 28)
  78.  
  79.     IF INSTR(1, _OS$, "WINDOWS") THEN sel$ = CHR$(92)
  80.     IF INSTR(1, _OS$, "LINUX") THEN sel$ = "/"
  81.     IF first = 0 THEN first = 1
  82.  
  83.     Up$ = CHR$(0) + CHR$(72)
  84.     Dn$ = CHR$(0) + CHR$(80)
  85.     PgUp$ = CHR$(0) + CHR$(73)
  86.     PgDn$ = CHR$(0) + CHR$(81)
  87.     Home$ = CHR$(0) + CHR$(71)
  88.     End$ = CHR$(0) + CHR$(79)
  89.     k$ = INKEY$
  90.  
  91.     oldposX = posX
  92.     IF first = 1 THEN oldposX = -1 ': first = 0
  93.  
  94.  
  95.     'mouse support ---
  96.         MoX = _MOUSEX: MoY = _MOUSEY
  97.         IF MoX > x AND MoX < x + ((Lenght + 4) * 8) AND MoY > Y AND MoY < Y + (Height * 20) + 40 THEN 'podle LINE
  98.             Poloha = _CEIL((MoY - Y - 20) / 20) 'pro mys
  99.             IF UseWheel THEN ' in function last parameter: 0 = use wheel, 1 = not use wheel
  100.                 SELECT CASE SGN(_MOUSEWHEEL)
  101.                     CASE -1: k$ = Up$
  102.                     CASE 1: k$ = Dn$
  103.                 END SELECT
  104.  
  105.             ELSE
  106.  
  107.  
  108.                 IF Poloha < posX - Lb THEN k$ = Up$
  109.                 IF Poloha > posX - Lb THEN k$ = Dn$
  110.             END IF
  111.             IF _MOUSEBUTTON(1) AND Poloha >= Lb AND Poloha <= Le THEN
  112.                 IF MoX < (8 * Lenght) + x THEN K& = 13: _DELAY .1
  113.  
  114.             END IF
  115.             IF _MOUSEBUTTON(1) AND MoX > (8 * Lenght) + x AND MoY < Y + 16 THEN 'mouse / up arrow
  116.                 k$ = Up$
  117.             END IF
  118.             IF _MOUSEBUTTON(1) AND MoX > (8 * Lenght) + x AND MoY > Y + (Height * 20) + 24 THEN 'mouse / down arrow
  119.                 k$ = Dn$
  120.             END IF
  121.         END IF
  122.  
  123.     WEND
  124.  
  125.     '------------------
  126.  
  127.  
  128.     ' --- keyboard inputs
  129.  
  130.  
  131.     SELECT CASE k$
  132.         CASE IS = Up$: posX = posX - 1: GU = 1: GD = 0: act = 1 'marks: Go down disabled, go up enbabled, act = clear screen and print it again
  133.         CASE IS = Dn$: posX = posX + 1: GU = 0: GD = 1: act = 1 'marks: Go down enabled, go up disabled
  134.         CASE IS = End$: posX = UBOUND(arr) - 1: Le = UBOUND(arr): Lb = UBOUND(arr) - Height: act = 1
  135.         CASE IS = Home$: posX = LBOUND(arr) + 1: Le = Height: Lb = LBOUND(arr): act = 1
  136.         CASE IS = PgUp$: posX = posX - Height: Lb = Lb - Height: Le = Lb + Height: act = 1
  137.         CASE IS = PgDn$: posX = posX + Height: Lb = Lb + Height: Le = Lb + Height: act = 1
  138.  
  139.  
  140.         CASE IS = CHR$(13): command = posX
  141.     END SELECT
  142.     ' -------------------
  143.  
  144.     'if is link selected (not dir):
  145.     IF UBOUND(arr) < 0 THEN PRINT "Invalid array size!!!": SLEEP 2: END
  146.     'end of bug repair
  147.  
  148.     IF posX <= 0 THEN posX = 0 ': Lb = 0: Le = Lb + height
  149.     IF posX > UBOUND(arr) THEN posX = UBOUND(arr)
  150.     IF oldposX <> posX OR first THEN
  151.         IF posX > Le AND GD THEN Lb = Lb + 1: Le = Le + 1
  152.         IF GU AND posX < Lb THEN Lb = Lb - 1: Le = Le - 1
  153.         textpos = 0
  154.         IF Lb < LBOUND(arr) THEN Lb = LBOUND(arr)
  155.  
  156.         IF Lb > UBOUND(arr) - Height THEN Lb = UBOUND(arr) - Height
  157.         IF Le > UBOUND(arr) THEN Le = UBOUND(arr)
  158.         '   IF Le - Lb > height THEN Le = Lb + height
  159.         REM     IF Lb > Le THEN EXIT FUNCTION
  160.  
  161.         IF first = 1 OR act THEN
  162.             LINE (x + 1, Y + 1)-(x + 3 + (8 * Lenght) + 16, Y + 3 + (20 * Height) + 38), White, BF 'erase screen
  163.             LINE (29, 1019)-(_WIDTH - 11, _HEIGHT - 11), White, BF
  164.  
  165.             rfs$ = RealFiles(posX)
  166.             IF LEN(rfs$) > 200 THEN rfs$ = LEFT$(rfs$, 197) + "..."
  167.             _PRINTSTRING (30, 1020), rfs$
  168.  
  169.             FOR V = Lb TO Le 'List Begin to List End
  170.                 '  K& = _KEYHIT
  171.  
  172.                 textpos = textpos + 20 'row is 20 pixel height
  173.                 IF V = posX THEN COLOR InPosColor&, ListColor&
  174.                 text$ = arr(V)
  175.                 IF LEN(text$) > Lenght - 20 THEN text$ = LEFT$(text$, Lenght - 20) + LTRIM$("...") ELSE text$ = text$ + SPACE$(Lenght - LEN(text$) - 1)
  176.                 _PRINTSTRING (x + 10, Y + textpos), text$
  177.                 COLOR ListColor&, Black '_RGB32(0, 0, 0)
  178.  
  179.  
  180.                 possss = posX + 1
  181.  
  182.                 GOTO notthia
  183.                 Posuvnik_V_Procentech! = (possss / UBOUND(arr))
  184.  
  185.                 '----------------------------------------------------------------------- extremne zpomaluje pri bezpodminecnem tisku
  186.                 WindowHeight = (23 + Height * 20) - 40
  187.                 OldGC = GC
  188.                 GC = Y + WindowHeight * Posuvnik_V_Procentech!
  189.  
  190.                 COLOR Black '_RGB32(0, 0, 0)
  191.                 _PRINTSTRING (x + 5 + Lenght * _PRINTWIDTH(STRING$(Lenght, "x")), OldGC + 22), CHR$(222)
  192.                 COLOR Black '_RGB32(127, 127, 127)
  193.                 _PRINTSTRING (x + 5 + Lenght * _FONTWIDTH, GC + 22), CHR$(222)
  194.  
  195.                 _PRINTSTRING (x + 5 + Lenght * _FONTWIDTH, Y + 7), CHR$(24)
  196.                 _PRINTSTRING (x + 5 + Lenght * _FONTWIDTH, 3 + Y + 20 + Height * 20), CHR$(25)
  197.                 '---------------------------------------------------------------------------
  198.                 notthia:
  199.             NEXT V
  200.             act = 0
  201.             k$ = ""
  202.             first = 2
  203.         END IF
  204.  
  205.     END IF
  206.  
  207.     LINE (x + 1, Y + 1)-(x + 3 + (8 * Lenght) + 16, Y + 3 + (20 * Height) + 38), , B
  208.     LINE (x + 4, Y + 4)-(x + (8 * Lenght) + 16, Y + (20 * Height) + 38), , B
  209.     Browse = posX
  210.  
  211.  
  212.     IF command THEN
  213.         SHELL _DONTWAIT RealFiles(command)
  214.         _SCREENCLICK MoX, MoY 'aby okno bylo stale aktivni a neprebiral ho Windows media player (moznost toto nastavit)      For stay your program window still active
  215.         command = 0
  216.         _DELAY .3
  217.     END IF
  218.     _DISPLAY
  219.     _LIMIT 100
  220.  
  221.  
  222.  
  223. SUB DrawMyScreen (backgroundcolor~&, foregroundcolor~&)
  224.     B = backgroundcolor~&
  225.     F = foregroundcolor~&
  226.     CLS , B
  227.  
  228.     LINE (10, 60)-(_WIDTH - 10, _HEIGHT - 10), F, B
  229.     LINE (10, 60)-(_WIDTH / 2, _HEIGHT - 110), F, B
  230.  
  231.     'Labels. Labels in this program can be set to your own language, use SETUP icon in program for creating own language file. NOT IMPLANTED IN THIS ALPHA VERSION
  232.     'index list:   (in english lng file)
  233.     '0 = file list:
  234.     '1 = file details:
  235.     '2 = Full path to file:
  236.  
  237.     COLOR Black, White
  238.     _PRINTSTRING (30, 80), Label(0) 'files list
  239.     _PRINTSTRING (990, 80), Label(1) 'file details
  240.     _PRINTSTRING (30, 990), Label(2) 'full path
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252. FUNCTION GetLCiD
  253.     DECLARE DYNAMIC LIBRARY "Kernel32"
  254.         FUNCTION GetUserDefaultLCID%
  255.         FUNCTION GetSystemDefaultLangID%
  256.         SUB GetTimeZoneInformation (a AS INTEGER)
  257.     END DECLARE
  258.     GetLCiD = GetUserDefaultLCID%
  259.     IF GetUserDefaultLCID% = 0 AND GetSystemDefaultLangID% THEN GetLCiD = GetSystemDefaultLangID%
  260.     IF GetUserDefaultLCID% = 0 AND GetSystemDefaultLangID% = 0 THEN GetLCiD = -1 'error finding LCID
  261.  
  262.  
  263.  
  264.  
  265. SUB LoadINI (SortStyle&, ViewStyle&)
  266.     ff = FREEFILE
  267.  
  268.     IF _FILEEXISTS("MaV.ini") THEN
  269.         OPEN "MaV.ini" FOR BINARY AS ff
  270.         GET ff, , SortStyle&
  271.         GET ff, , ViewStyle&
  272.         GET ff, , ForegroundColor~&
  273.         GET ff, , BackgroundColor~&
  274.         GET ff, , UsedCOUNTRY$
  275.  
  276.     ELSE
  277.         OPEN "MaV.ini" FOR BINARY AS ff
  278.         SortStyle& = 1
  279.         ViewStyle& = 1
  280.         PUT ff, , SortStyle&
  281.         PUT ff, , ViewStyle&
  282.         BackgroundColor~& = Black
  283.         ForegroundColor~& = White
  284.         PUT #ff, , ForegroundColor~&
  285.         PUT #ff, , BackgroundColor~&
  286.         UsedCOUNTRY$ = "english"
  287.         PUT #ff, , UsedCOUNTRY$
  288.     END IF
  289.     CLOSE ff
  290.     LoadNationalLabels "MaV-" + _TRIM$(UsedCOUNTRY$) + ".lng"
  291.     REM  showarr Label()   'developing helper
  292.  
  293.  
  294.  
  295. SUB showarr (s() AS STRING)
  296.     FOR q = LBOUND(s) TO UBOUND(s)
  297.         PRINT s(q)
  298.         SLEEP
  299.     NEXT
  300.  
  301.  
  302.  
  303.  
  304.  
  305. SUB LoadNationalLabels (file AS STRING)
  306.     IF _FILEEXISTS(file$) THEN
  307.         ff = FREEFILE
  308.         OPEN file$ FOR INPUT AS ff
  309.         WHILE NOT EOF(ff)
  310.             LINE INPUT #ff, Label$
  311.             IF LEFT$(Label$, 2) <> "//" THEN
  312.                 Label(i) = Label$
  313.                 i = i + 1
  314.                 REDIM _PRESERVE Label(i) AS STRING
  315.             END IF
  316.         WEND
  317.     ELSE
  318.         _AUTODISPLAY
  319.         BEEP: PRINT file$; " - this language file not found. Starting in english!"
  320.         SLEEP 2
  321.         LoadNationalLabels "MaV-english.lng"
  322.     END IF
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329. SUB SORT (arr() AS STRING, HOW AS _BYTE) ' If is HOW zero, sort descending, if is HOW <> 0, sort ascending (this is modified Eoredson method).
  330.     DIM X AS LONG, Y AS LONG '
  331.     U& = UBOUND(arr)
  332.     DO UNTIL X = U&
  333.         Y = X + 1
  334.         DO UNTIL Y = U&
  335.             IF HOW THEN
  336.                 IF arr(X) > arr(Y) THEN SWAP arr(X), arr(Y)
  337.             ELSE
  338.                 IF arr(X) < arr(Y) THEN SWAP arr(X), arr(Y)
  339.             END IF
  340.             Y = Y + 1
  341.         LOOP
  342.         X = X + 1
  343.     LOOP
  344.  
  345. SUB ReturnMASK (mask() AS STRING, mask AS STRING)
  346.     P = INSTR(mask$, ",")
  347.     DO UNTIL P = 0
  348.         f$ = MID$(mask$, 1, P - 1)
  349.         mask$ = MID$(mask$, P + 1)
  350.         REDIM _PRESERVE mask(i) AS STRING
  351.         mask(i) = f$
  352.         i = i + 1
  353.         P = INSTR(mask$, ",")
  354.     LOOP
  355.  
  356. SUB SeparateFileName (SOURCEarr() AS STRING, DESTarrFileName() AS STRING, DESTarrFolderName() AS STRING) 'vse OK     (for case, when Folder name is album name and file name is soundtrack name)  Source is array with full path.
  357.     $IF WIN THEN
  358.         s$ = "\"
  359.     $ELSE
  360.         S$ = "/"
  361.     $END IF
  362.     REDIM DESTarrFileName(UBOUND(sourcearr)) AS STRING
  363.     REDIM DESTarrFolderName(UBOUND(sourcearr)) AS STRING
  364.     FOR sep = LBOUND(sourcearr) TO UBOUND(sourcearr)
  365.         DESTarrFileName(sep) = MID$(SOURCEarr(sep), _INSTRREV(SOURCEarr(sep), s$) + 1, LEN(SOURCEarr(sep)) - _INSTRREV(SOURCEarr(sep), s$))
  366.  
  367.         '        PRINT "Full path: ";
  368.         '        PRINT SOURCEarr(sep)
  369.  
  370.         '        PRINT "File name: ";
  371.         '        PRINT DESTarrFileName(sep)
  372.  
  373.         Miss$ = LEFT$(SOURCEarr(sep), LEN(SOURCEarr(sep)) - 1 - LEN(DESTarrFileName(sep)))
  374.         '        PRINT Miss$
  375.         DESTarrFolderName(sep) = MID$(Miss$, _INSTRREV(Miss$, s$) + 1, LEN(Miss$) - _INSTRREV(Miss$, s$))
  376.         '        PRINT "Folder name: ";
  377.         '        PRINT DESTarrFolderName(sep)
  378.         '        PRINT Miss(sep)
  379.     NEXT
  380.  
  381.  
  382. FUNCTION SelectDIR$
  383.         FUNCTION FindWindow& (BYVAL ClassName AS _OFFSET, WindowName$)
  384.     END DECLARE
  385.     hwnd& = _WINDOWHANDLE
  386.     TYPE BROWSEINFO '                    typedef struct _browseinfo 'Microsoft MSDN
  387.         hwndOwner AS _OFFSET '           HWND
  388.         pidlRoot AS _OFFSET '            PCIDLIST_ABSOLUTE
  389.         pszDisplayName AS _OFFSET '      LPTSTR
  390.         lpszTitle AS _OFFSET '           LPCTSTR
  391.         ulFlags AS _UNSIGNED LONG '      UINT
  392.         lpfn AS _OFFSET '                BFFCALLBACK
  393.         lParam AS _OFFSET '              LPARAM
  394.         iImage AS LONG '                 int
  395.     END TYPE '                           BROWSEINFO, *PBROWSEINFO, *LPBROWSEINFO;
  396.  
  397.     DECLARE DYNAMIC LIBRARY "shell32"
  398.         FUNCTION SHBrowseForFolder%& (x AS BROWSEINFO) '                           Microsoft MSDN
  399.         SUB SHGetPathFromIDList (BYVAL lpItem AS _OFFSET, BYVAL szDir AS _OFFSET) 'Microsoft MSDN
  400.     END DECLARE
  401.  
  402.     DIM b AS BROWSEINFO
  403.     b.hwndOwner = hwnd
  404.     DIM s AS STRING * 1024
  405.     b.pszDisplayName = _OFFSET(s$)
  406.     a$ = "Select folder for searching movies and music:" + CHR$(0)
  407.     b.lpszTitle = _OFFSET(a$)
  408.     DIM o AS _OFFSET
  409.     '    _SCREENHIDE
  410.     o = SHBrowseForFolder(b)
  411.     '    _SCREENSHOW
  412.     IF o THEN
  413.         '   Path$ = LEFT$(s$, INSTR(s$, CHR$(0)) - 1)
  414.         DIM s2 AS STRING * 1024
  415.         SHGetPathFromIDList o, _OFFSET(s2$)
  416.         SelectDIR$ = LEFT$(s2$, INSTR(s2$, CHR$(0)) - 1)
  417.     ELSE
  418.         PRINT "Directory not selected, using current directory"
  419.         SelectDIR$ = _CWD$
  420.     END IF
  421.  
  422.  
  423. SUB sAppend (arr() AS STRING, addItem$)
  424.     REDIM _PRESERVE arr(LBOUND(arr) TO UBOUND(arr) + 1) AS STRING
  425.     arr(UBOUND(arr)) = addItem$
  426.  
  427. SUB GetSubDirs (SearchDirectory AS STRING, DirList() AS STRING)
  428.     CONST IS_DIR = 1
  429.     DIM flags AS LONG, file_size AS LONG, length, nam$
  430.     IF load_dir(SearchDirectory + CHR$(0)) THEN 'Steve's fix here with CHR$(0) for C call
  431.         DO
  432.             length = has_next_entry
  433.             IF length > -1 THEN
  434.                 nam$ = SPACE$(length)
  435.                 get_next_entry nam$, flags, file_size
  436.                 IF nam$ <> "." AND nam$ <> ".." THEN
  437.                     'IF _DIREXISTS(SearchDirectory + "\" + nam$) THEN
  438.                     DirCount = DirCount + 1
  439.                     IF DirCount > UBOUND(DirList) THEN REDIM _PRESERVE DirList(UBOUND(DirList) + 100)
  440.                     DirList(DirCount) = SearchDirectory + "\" + nam$
  441.                     'END IF
  442.                 END IF
  443.             END IF
  444.         LOOP UNTIL length = -1
  445.     END IF
  446.     close_dir 'Steve first fix that got navigator working
  447.     REDIM _PRESERVE DirList(DirCount)
  448.  
  449. SUB MakeTree (startDir AS STRING)
  450.     copyStart$ = startDir
  451.     REDIM D(100) AS STRING
  452.     GetSubDirs copyStart$, D()
  453.     FOR i = 1 TO UBOUND(D)
  454.         sAppend Tree(), D(i)
  455.         MakeTree D(i)
  456.     NEXT
  457.  
  458.  
  459. 'nation.bm   my FIRST attempt for INTERNATIONAL QB64 language support.
  460. 'function find code page need for correct text show on screen and set (if is right font used) unicode characters.
  461.  
  462.  
  463.  
  464. SUB CountryA
  465.     IF WIN THEN
  466.         SHELL _HIDE "powershell get-culture > nation.txt"
  467.         IF _FILEEXISTS("nation.txt") THEN
  468.             c = FREEFILE
  469.             OPEN "nation.txt" FOR BINARY AS #c
  470.             LINE$ = SPACE$(LOF(c))
  471.             GET #c, , LINE$
  472.             REM            IF lin = 4 THEN LCID_DECIMAL = VAL(LEFT$(LINE$, 4)): EXIT DO
  473.             CLOSE c
  474.  
  475.  
  476.             FOR numbers = 1 TO LEN(LINE$)
  477.                 char = ASC(LINE$, numbers)
  478.                 IF char >= 47 AND char <= 58 THEN nr$ = nr$ + CHR$(char)
  479.             NEXT
  480.  
  481.             LCID_DECIMAL = VAL(nr$)
  482.  
  483.             PRINT "Alpha version developing: CountryA PowerShell output is: "; LCID_DECIMAL
  484.  
  485.         ELSE
  486.             'try find with dynamic library:
  487.             LCID_DECIMAL = GetLCiD
  488.  
  489.         END IF
  490.     ELSE 'LINUX
  491.         SHELL _HIDE ("echo $LANG |cut -c1,2,4,5 > nation.txt")
  492.         ch = FREEFILE
  493.         OPEN "nation.txt" FOR INPUT AS ch
  494.         LINE INPUT #ch, nation$
  495.         CLOSE ch
  496.     END IF
  497.  
  498.     IF WIN THEN
  499.         SELECT CASE LCID_DECIMAL
  500.             '        language               code page
  501.             REM        CASE 0: lang$ = "English"
  502.             CASE 1078: lang$ = "Afrikaans": CP = 1252
  503.             CASE 1052: lang$ = "Albanian": CP = 1250
  504.             CASE 1118: lang$ = "Amharic": 'CP unknown
  505.             CASE 5121: lang$ = "Arabic - Algeria": CP = 1401: CPW = 1256
  506.             CASE 15361: lang$ = "Arabic - Bahrain": CP = 1256
  507.             CASE 3073: lang$ = "Arabic - Egypt": CP = 1256
  508.             CASE 2049: lang$ = "Arabic - Iraq": CP = 801: CPW = 1256
  509.             CASE 11265: lang$ = "Arabic - Jordan": CP = 1256
  510.             CASE 13313: lang$ = "Arabic - Kuwait": CP = 3401: CPW = 1256
  511.             CASE 12289: lang$ = "Arabic - Lebanon": CP = 3001: CPW = 1256
  512.             CASE 4097: lang$ = "Arabic - Libya": CP = 1001: CPW = 1256
  513.             CASE 6145: lang$ = "Arabic - Morocco": CP = 1801: CPW = 1256
  514.             CASE 8193: lang$ = "Arabic - Oman": CP = 2001: CP2 = 1256
  515.             CASE 16385: lang$ = "Arabic - Qatar": CP = 4001: CP2 = 1256
  516.             CASE 1025: lang$ = "Arabic - Saudi Arabia": CP = 401: CP2 = 1256
  517.             CASE 10241: lang$ = "Arabic - Syria": CP = 2801: CP2 = 1256
  518.             CASE 7169: lang$ = "Arabic - Tunisia": CP = 1256
  519.             CASE 14337: lang$ = "Arabic - United Arab Emirates": CP = 3801: CP2 = 1256
  520.             CASE 9217: lang$ = "Arabic - Yemen": CP = 2401: CP2 = 1256
  521.             CASE 1067: lang$ = "Armenian" 'CP unknown
  522.             CASE 1101: lang$ = "Assamese" 'CP uunknown
  523.             CASE 2092: lang$ = "Azeri - Cyrillic": CP = 1251
  524.             CASE 1068: lang$ = "Azeri - Latin": CP = 1254
  525.             CASE 1069: lang$ = "Basque": CP = 1252
  526.             CASE 1059: lang$ = "Belarusian": CP = 423: CP2 = 1251
  527.             CASE 2117: lang$ = "Bengali - Bangladesh": CP = 2117: CP2 = 845
  528.             CASE 1093: lang$ = "Bengali - India": CP = 445
  529.             CASE 5146: lang$ = "Bosnian" 'CP unknown
  530.             CASE 1026: lang$ = "Bulgarian": CP = 402: CP2 = 1251
  531.             CASE 1109: lang$ = "Burmese": CP = 455
  532.             CASE 1027: lang$ = "Catalan": CP = 403: CP2 = 1252
  533.             CASE 2052: lang$ = "Chinese - China": CP = 804
  534.             CASE 3076: lang$ = "Chinese - Hong Kong": 'CP unknown
  535.             CASE 5124: lang$ = "Chinese - Macau": CP = 1404
  536.             CASE 4100: lang$ = "Chinese - Singapore": CP = 1004
  537.             CASE 1028: lang$ = "Chinese - Taiwan": CP = 404
  538.             CASE 1050: lang$ = "Croatian": CP = 1250
  539.             CASE 1029: lang$ = "Czech": CP = 405: CP2 = 1250
  540.             CASE 1030: lang$ = "Danish": CP = 406: CP2 = 1252
  541.                 'Divehi  Dhivehi Maldivian   dv  dv unknown code and CP
  542.             CASE 2067: lang$ = "Dutch - Belgium": CP = 813: CP2 = 1252
  543.             CASE 1043: lang$ = "Dutch - Netherlands": CP = 413: CP2 = 1252
  544.             CASE 1126: lang$ = "Edo": CP = 466
  545.             CASE 3081: lang$ = "English - Australia": CP = 1252
  546.             CASE 10249: lang$ = "English - Belize": CP = 2809: CP2 = 1252
  547.             CASE 4105: lang$ = "English - Canada": CP = 1009: CP2 = 1252
  548.             CASE 9225: lang$ = "English - Caribbean": CP = 2409: CP2 = 1252
  549.             CASE 2057: lang$ = "English - Great Britain": CP = 809: CP2 = 1252
  550.             CASE 16393: lang$ = "English - India": CP = 4009
  551.             CASE 6153: lang$ = "English - Ireland": CP = 1809: CP2 = 1252
  552.             CASE 8201: lang$ = "English - Jamaica": CP = 2009: CP2 = 1252
  553.             CASE 5129: lang$ = "English - New Zealand": CP = 1409: CP2 = 1252
  554.             CASE 13321: lang$ = "English - Phillippines": CP = 3409: CP2 = 1252
  555.             CASE 7177: lang$ = "English - Southern Africa": CP = 1252
  556.             CASE 11273: lang$ = "English - Trinidad": CP = 1252
  557.             CASE 1033: lang$ = "English - United States": CP = 409: CP2 = 1252
  558.             CASE 12297: lang$ = "English - Zimbabwe": CP = 3009: CP2 = 1252
  559.             CASE 1061: lang$ = "Estonian": CP = 425: CP2 = 1257
  560.             CASE 1071: lang$ = "FYRO Macedonia": CP = 1251
  561.             CASE 1080: lang$ = "Faroese": CP = 438: CP2 = 1252
  562.             CASE 1065: lang$ = "Farsi - Persian": CP = 429: CP2 = 1256
  563.             CASE 1124: lang$ = "Filipino": CP = 464
  564.             CASE 1035: lang$ = "Finnish": CP = 1252
  565.             CASE 2060: lang$ = "French - Belgium": CP = 1252
  566.             CASE 11276: lang$ = "French - Cameron": 'unknown CP
  567.             CASE 3084: lang$ = "French - Canada": CP = 1252
  568.             CASE 9228: lang$ = "French - Congo": 'unknown CP
  569.             CASE 12300: lang$ = "French - Cote d'Ivoire" 'unknown CP
  570.             CASE 1036: lang$ = "French - France": CP = 1252
  571.             CASE 5132: lang$ = "French - Luxembourg": CP = 1252
  572.             CASE 13324: lang$ = "French - Mali" 'unknown CP
  573.             CASE 6156: lang$ = "French - Monaco": CP = 1252
  574.             CASE 14348: lang$ = "French - Morocco" 'cp unknown
  575.             CASE 10252: lang$ = "French - Senegal" 'cp unknown
  576.             CASE 4108: lang$ = "French - Switzerland": CP = 1252
  577.             CASE 7180: lang$ = "French - West Indies" 'CP unknown
  578.             CASE 1122: lang$ = "Frisian - Netherlands": CP = 462
  579.             CASE 2108: lang$ = "Gaelic - Ireland" 'CP unknown
  580.             CASE 1084: lang$ = "Gaelic - Scotland" 'CP unknown
  581.             CASE 1110: lang$ = "Galician": CP = 456: CP2 = 1252
  582.             CASE 1079: lang$ = "Georgian": CP = 437
  583.             CASE 3079: lang$ = "German - Austria": CP = 1252
  584.             CASE 1031: lang$ = "German - Germany": CP = 407: CP2 = 1252
  585.             CASE 5127: lang$ = "German - Liechtenstein": CP = 1407: CP2 = 1252
  586.             CASE 4103: lang$ = "German - Luxembourg": CP = 1007: CP2 = 1252
  587.             CASE 2055: lang$ = "German - Switzerland": CP = 807: CP2 = 1252
  588.             CASE 1032: lang$ = "Greek": CP = 408: CP2 = 1253
  589.             CASE 1140: lang$ = "Guarani - Paraguay": CP = 474
  590.             CASE 1095: lang$ = "Gujarati": CP = 447
  591.             CASE 1279: lang$ = "HID (Human Interface Device)": CP = -1
  592.             CASE 1037: lang$ = "Hebrew": CP = 1255
  593.             CASE 1081: lang$ = "Hindi": CP = 439
  594.             CASE 1038: lang$ = "Hungarian": CP = 1250
  595.             CASE 1039: lang$ = "Icelandic": CP = 1252
  596.             CASE 1136: lang$ = "Igbo - Nigeria": CP = 470
  597.             CASE 1057: lang$ = "Indonesian": CP = 421: CP2 = 1252
  598.             CASE 1040: lang$ = "Italian - Italy": CP = 410: CP2 = 1252
  599.             CASE 2064: lang$ = "Italian - Switzerland": CP = 810: CP2 = 1252
  600.             CASE 1041: lang$ = "Japanese ": CP = 411
  601.             CASE 1099: lang$ = "Kannada" ' CP unknown
  602.             CASE 1120: lang$ = "Kashmiri": CP = 460
  603.             CASE 1087: lang$ = "Kazakh": CP = 1251
  604.             CASE 1107: lang$ = "Khmer": CP = 453
  605.             CASE 1111: lang$ = "Konkani": CP = 457
  606.             CASE 1042: lang$ = "Korean": CP = 412
  607.             CASE 1088: lang$ = "Kyrgyz - Cyrillic": CP = 440: CP2 = 1251
  608.             CASE 1108: lang$ = "Lao": CP = 454
  609.             CASE 1142: lang$ = "Latin": CP = 476
  610.             CASE 1062: lang$ = "Latvian": CP = 426: CP2 = 1257
  611.             CASE 1063: lang$ = "Lithuanian": CP = 427: CP2 = 1257
  612.             CASE 2110: lang$ = "Malay - Brunei": CP = 1252
  613.             CASE 1086: lang$ = "Malay - Malaysia": CP = 1252
  614.             CASE 1100: lang$ = "Malayalam" 'unknown CP
  615.             CASE 1082: lang$ = "Maltese" 'unknown CP
  616.             CASE 1112: lang$ = "Manipuri": CP = 458
  617.             CASE 1153: lang$ = "Maori": CP = 481
  618.             CASE 1102: lang$ = "Marathi" 'unknown CP
  619.             CASE 2128: lang$ = "Mongolian": CP = 850
  620.             CASE 1104: lang$ = "Mongolian": CP = 450: CP2 = 1251
  621.             CASE 1121: lang$ = "Nepali": CP = 461
  622.             CASE 1044: lang$ = "Norwegian - Bokml": CP = 414: CP2 = 1252
  623.             CASE 2068: lang$ = "Norwegian - Nynorsk": CP = 814: CP2 = 1252
  624.             CASE 1096: lang$ = "Oriya": CP = 448
  625.             CASE 1045: lang$ = "Polish": CP = 415: CP2 = 1250
  626.             CASE 1046: lang$ = "Portuguese - Brazil": CP = 416: CP2 = 1252
  627.             CASE 2070: lang$ = "Portuguese - Portugal": CP = 816: CP2 = 1252
  628.             CASE 1094: lang$ = "Punjabi": CP = 446
  629.             CASE 1047: lang$ = "Raeto-Romance": CP = 417
  630.             CASE 2072: lang$ = "Romanian - Moldova": CP = 818
  631.             CASE 1048: lang$ = "Romanian - Romania": CP = 418: CP2 = 1250
  632.             CASE 1049: lang$ = "Russian": CP = 419: CP2 = 1251
  633.             CASE 2073: lang$ = "Russian - Moldova": CP = 2073: CP2 = 819
  634.             CASE 1083: lang$ = "Sami Lappish" 'CP unknown
  635.             CASE 1103: lang$ = "Sanskrit" 'CP unknown
  636.             CASE 3098: lang$ = "Serbian - Cyrillic": CP = 1251
  637.             CASE 2074: lang$ = "Serbian - Latin": CP = 1250
  638.             CASE 1072: lang$ = "Sesotho (Sutu)": CP = 430
  639.             CASE 1074: lang$ = "Setsuana": CP = 432
  640.             CASE 1113: lang$ = "Sindhi": CP = 459
  641.             CASE 1115: lang$ = "Sinhala Sinhalese" ' cp unknown
  642.             CASE 1051: lang$ = "Slovak": CP = 1250
  643.             CASE 1060: lang$ = "Slovenian": CP = 424: CP2 = 1250
  644.             CASE 1143: lang$ = "Somali": CP = 477
  645.             CASE 1070: lang$ = "Sorbian" 'unknown CP
  646.             CASE 11274: lang$ = "Spanish - Argentina": CP = 1252
  647.             CASE 16394: lang$ = "Spanish - Bolivia": CP = 1252
  648.             CASE 13322: lang$ = "Spanish - Chile": CP = 1252
  649.             CASE 9226: lang$ = "Spanish - Colombia": CP = 1252
  650.             CASE 5130: lang$ = "Spanish - Costa Rica": CP = 1252
  651.             CASE 7178: lang$ = "Spanish - Dominican Republic": CP = 1252
  652.             CASE 12298: lang$ = "Spanish - Ecuador": CP = 1252
  653.             CASE 17418: lang$ = "Spanish - El Salvador": CP = 1252
  654.             CASE 4106: lang$ = "Spanish - Guatemala": CP = 1252
  655.             CASE 18442: lang$ = "Spanish - Honduras": CP = 1252
  656.             CASE 2058: lang$ = "Spanish - Mexico": CP = 1252
  657.             CASE 19466: lang$ = "Spanish - Nicaragua": CP = 1252
  658.             CASE 6154: lang$ = "Spanish - Panama": CP = 1252
  659.             CASE 15370: lang$ = "Spanish - Paraguay": CP = 1252
  660.             CASE 10250: lang$ = "Spanish - Peru": CP = 1252
  661.             CASE 20490: lang$ = "Spanish - Puerto Rico": CP = 1252
  662.             CASE 1034: lang$ = "Spanish - Spain (Traditional)": CP = 1252
  663.             CASE 14346: lang$ = "Spanish - Uruguay": CP = 1252
  664.             CASE 8202: lang$ = "Spanish - Venezuela": CP = 1252
  665.             CASE 1089: lang$ = "Swahili": CP = 441: CP2 = 1252
  666.             CASE 2077: lang$ = "Swedish - Finland": CP = 1252
  667.             CASE 1053: lang$ = "Swedish - Sweden": CP = 1252
  668.             CASE 1114: lang$ = "Syriac" 'unknown CP
  669.             CASE 1064: lang$ = "Tajik": CP = 428
  670.             CASE 1097: lang$ = "Tamil": CP = 449
  671.             CASE 1092: lang$ = "Tatar": CP = 444: CP2 = 1251
  672.             CASE 1098: lang$ = "Telugu" 'CP unknown
  673.             CASE 1054: lang$ = "Thai" 'CP unkown
  674.             CASE 1105: lang$ = "Tibetan": CP = 451
  675.             CASE 1073: lang$ = "Tsonga": CP = 431
  676.             CASE 1055: lang$ = "Turkish": CP = 1254
  677.             CASE 1090: lang$ = "Turkmen": CP = 442
  678.             CASE 1058: lang$ = "Ukrainian": CP = 422: CP2 = 1251
  679.             CASE 8: lang$ = "Unicode": CP = -2 '    UTF-8
  680.             CASE 1056: lang$ = "Urdu": CP = 420: CP2 = 1256
  681.             CASE 2115: lang$ = "Uzbek - Cyrillic": CP = 843: CP2 = 1251
  682.             CASE 1091: lang$ = "Uzbek - Latin": CP = 443: CP2 = 1254
  683.             CASE 1075: lang$ = "Venda": CP = 433
  684.             CASE 1066: lang$ = "Vietnamese": CP = 1258
  685.             CASE 1106: lang$ = "Welsh": CP = 452
  686.             CASE 1076: lang$ = "Xhosa": CP = 434
  687.             CASE 1085: lang$ = "Yiddish" 'unknown CP
  688.             CASE 1077: lang$ = "Zulu": CP = 435
  689.         END SELECT
  690.     ELSE
  691.         SELECT CASE LCASE$(nation$) '                     without warranty! Here are NOT all countries!
  692.             CASE "af": lang$ = "Afrikaans": CP = 1252
  693.             CASE "sq": lang$ = "Albanian": CP = 1250
  694.             CASE "am": lang$ = "Amharic": 'CP unknown
  695.             CASE "ardz": lang$ = "Arabic - Algeria": CP = 1401: CPW = 1256
  696.             CASE "arbh": lang$ = "Arabic - Bahrain": CP = 1256
  697.             CASE "areg": lang$ = "Arabic - Egypt": CP = 1256
  698.             CASE "ariq": lang$ = "Arabic - Iraq": CP = 801: CPW = 1256
  699.             CASE "arjo": lang$ = "Arabic - Jordan": CP = 1256
  700.             CASE "arkw": lang$ = "Arabic - Kuwait": CP = 3401: CPW = 1256
  701.             CASE "arlb": lang$ = "Arabic - Lebanon": CP = 3001: CPW = 1256
  702.             CASE "arly": lang$ = "Arabic - Libya": CP = 1001: CPW = 1256
  703.             CASE "arma": lang$ = "Arabic - Morocco": CP = 1801: CPW = 1256
  704.             CASE "arom": lang$ = "Arabic - Oman": CP = 2001: CP2 = 1256
  705.             CASE "arqa": lang$ = "Arabic - Qatar": CP = 4001: CP2 = 1256
  706.             CASE "arsa": lang$ = "Arabic - Saudi Arabia": CP = 401: CP2 = 1256
  707.             CASE "arsy": lang$ = "Arabic - Syria": CP = 2801: CP2 = 1256
  708.             CASE "artn": lang$ = "Arabic - Tunisia": CP = 1256
  709.             CASE "arae": lang$ = "Arabic - United Arab Emirates": CP = 3801: CP2 = 1256
  710.             CASE "arye": lang$ = "Arabic - Yemen": CP = 2401: CP2 = 1256
  711.             CASE "hy": lang$ = "Armenian" 'CP unknown
  712.             CASE "as": lang$ = "Assamese" 'CP uunknown
  713.             CASE "asaz": lang$ = "Azeri - Cyrillic": CP = 1251
  714.             CASE "asaz": lang$ = "Azeri - Latin": CP = 1254
  715.             CASE "eu": lang$ = "Basque": CP = 1252
  716.             CASE "be": lang$ = "Belarusian": CP = 423: CP2 = 1251
  717.             CASE "bn": lang$ = "Bengali - Bangladesh": CP = 2117: CP2 = 845
  718.             CASE "bn": lang$ = "Bengali - India": CP = 445
  719.             CASE "bs": lang$ = "Bosnian" 'CP unknown
  720.             CASE "bg": lang$ = "Bulgarian": CP = 402: CP2 = 1251
  721.             CASE "my": lang$ = "Burmese": CP = 455
  722.             CASE "ca": lang$ = "Catalan": CP = 403: CP2 = 1252
  723.             CASE "zhcn": lang$ = "Chinese - China": CP = 804
  724.             CASE "zhhk": lang$ = "Chinese - Hong Kong": 'CP unknown
  725.             CASE "zhmo": lang$ = "Chinese - Macau": CP = 1404
  726.             CASE "zhsg": lang$ = "Chinese - Singapore": CP = 1004
  727.             CASE "zhtw": lang$ = "Chinese - Taiwan": CP = 404
  728.             CASE "hr": lang$ = "Croatian": CP = 1250
  729.             CASE "cscz": lang$ = "Czech": CP = 405: CP2 = 1250
  730.             CASE "da": lang$ = "Danish": CP = 406: CP2 = 1252
  731.                 'Divehi  Dhivehi Maldivian   dv  dv unknown code and CP
  732.             CASE "nlbe": lang$ = "Dutch - Belgium": CP = 813: CP2 = 1252
  733.             CASE "nlnl": lang$ = "Dutch - Netherlands": CP = 413: CP2 = 1252
  734.             CASE "": lang$ = "Edo": CP = 466
  735.             CASE "enau": lang$ = "English - Australia": CP = 1252
  736.             CASE "enbz": lang$ = "English - Belize": CP = 2809: CP2 = 1252
  737.             CASE "enca": lang$ = "English - Canada": CP = 1009: CP2 = 1252
  738.             CASE "encb": lang$ = "English - Caribbean": CP = 2409: CP2 = 1252
  739.             CASE "engb": lang$ = "English - Great Britain": CP = 809: CP2 = 1252
  740.             CASE "enin": lang$ = "English - India": CP = 4009
  741.             CASE "enie": lang$ = "English - Ireland": CP = 1809: CP2 = 1252
  742.             CASE "enjm": lang$ = "English - Jamaica": CP = 2009: CP2 = 1252
  743.             CASE "ennz": lang$ = "English - New Zealand": CP = 1409: CP2 = 1252
  744.             CASE "enph": lang$ = "English - Phillippines": CP = 3409: CP2 = 1252
  745.             CASE "enza": lang$ = "English - Southern Africa": CP = 1252
  746.             CASE "entt": lang$ = "English - Trinidad": CP = 1252
  747.             CASE "enus": lang$ = "English - United States": CP = 409: CP2 = 1252
  748.             CASE "": lang$ = "English - Zimbabwe": CP = 3009: CP2 = 1252
  749.             CASE "et": lang$ = "Estonian": CP = 425: CP2 = 1257
  750.             CASE "fo": lang$ = "Faroese": CP = 438: CP2 = 1252
  751.             CASE "fa": lang$ = "Farsi - Persian": CP = 429: CP2 = 1256
  752.             CASE "": lang$ = "Filipino": CP = 464
  753.             CASE "fi": lang$ = "Finnish": CP = 1252
  754.             CASE "frbe", "frca", "frfr", "frlu", "frch": lang$ = "French": CP = 1252
  755.             CASE "mk": lang$ = "FYRO Macedonia": CP = 1251
  756.             CASE "gdie": lang$ = "Gaelic - Ireland" 'CP unknown
  757.             CASE "gd": lang$ = "Gaelic - Scotland" 'CP unknown
  758.             CASE "gl": lang$ = "Galician": CP = 456: CP2 = 1252
  759.             CASE "ka": lang$ = "Georgian": CP = 437
  760.             CASE "deat", "dede", "deli", "delu", "dech": lang$ = "German": CP = 1252
  761.             CASE "el": lang$ = "Greek": CP = 408: CP2 = 1253
  762.             CASE "gn": lang$ = "Guarani - Paraguay": CP = 474
  763.             CASE "gu": lang$ = "Gujarati": CP = 447
  764.             CASE "he": lang$ = "Hebrew": CP = 1255
  765.             CASE "hi": lang$ = "Hindi": CP = 439
  766.             CASE "hu": lang$ = "Hungarian": CP = 1250
  767.             CASE "is": lang$ = "Icelandic": CP = 1252
  768.             CASE "id": lang$ = "Indonesian": CP = 421: CP2 = 1252
  769.             CASE "itit": lang$ = "Italian - Italy": CP = 410: CP2 = 1252
  770.             CASE "itch": lang$ = "Italian - Switzerland": CP = 810: CP2 = 1252
  771.             CASE "ja": lang$ = "Japanese ": CP = 411
  772.             CASE "kn": lang$ = "Kannada" ' CP unknown
  773.             CASE "ks": lang$ = "Kashmiri": CP = 460
  774.             CASE "kk": lang$ = "Kazakh": CP = 1251
  775.             CASE "km": lang$ = "Khmer": CP = 453
  776.             CASE "ko": lang$ = "Korean": CP = 412
  777.             CASE "lo": lang$ = "Lao": CP = 454
  778.             CASE "la": lang$ = "Latin": CP = 476
  779.             CASE "lv": lang$ = "Latvian": CP = 426: CP2 = 1257
  780.             CASE "lt": lang$ = "Lithuanian": CP = 427: CP2 = 1257
  781.             CASE "msbn": lang$ = "Malay - Brunei": CP = 1252
  782.             CASE "msmy": lang$ = "Malay - Malaysia": CP = 1252
  783.             CASE "ml": lang$ = "Malayalam" 'unknown CP
  784.             CASE "mt": lang$ = "Maltese" 'unknown CP
  785.             CASE "mi": lang$ = "Maori": CP = 481
  786.             CASE "mr": lang$ = "Marathi" 'unknown CP
  787.             CASE "mn": lang$ = "Mongolian": CP = 450: CP2 = 1251
  788.             CASE "ne": lang$ = "Nepali": CP = 461
  789.             CASE "nono": lang$ = "Norwegian - Bokml": CP = 414: CP2 = 1252
  790.             CASE "or": lang$ = "Oriya": CP = 448
  791.             CASE "pl": lang$ = "Polish": CP = 415: CP2 = 1250
  792.             CASE "ptbr": lang$ = "Portuguese - Brazil": CP = 416: CP2 = 1252
  793.             CASE "ptpt": lang$ = "Portuguese - Portugal": CP = 816: CP2 = 1252
  794.             CASE "pa": lang$ = "Punjabi": CP = 446
  795.             CASE "rm": lang$ = "Raeto-Romance": CP = 417
  796.             CASE "romo": lang$ = "Romanian - Moldova": CP = 818
  797.             CASE "ro": lang$ = "Romanian - Romania": CP = 418: CP2 = 1250
  798.             CASE "ru": lang$ = "Russian": CP = 419: CP2 = 1251
  799.             CASE "rumo": lang$ = "Russian - Moldova": CP = 2073: CP2 = 819
  800.             CASE "sa": lang$ = "Sanskrit" 'CP unknown
  801.             CASE "srsp": lang$ = "Serbian - Cyrillic": CP = 1251
  802.             CASE "tn": lang$ = "Setsuana": CP = 432
  803.             CASE "sd": lang$ = "Sindhi": CP = 459
  804.             CASE "si": lang$ = "Sinhala Sinhalese" ' cp unknown
  805.             CASE "sk": lang$ = "Slovak": CP = 1250
  806.             CASE "sl": lang$ = "Slovenian": CP = 424: CP2 = 1250
  807.             CASE "so": lang$ = "Somali": CP = 477
  808.             CASE "sb": lang$ = "Sorbian" 'unknown CP
  809.             CASE "esar": lang$ = "Spanish - Argentina": CP = 1252
  810.             CASE "esbo": lang$ = "Spanish - Bolivia": CP = 1252
  811.             CASE "escl": lang$ = "Spanish - Chile": CP = 1252
  812.             CASE "esco": lang$ = "Spanish - Colombia": CP = 1252
  813.             CASE "escr": lang$ = "Spanish - Costa Rica": CP = 1252
  814.             CASE "esdo": lang$ = "Spanish - Dominican Republic": CP = 1252
  815.             CASE "esec": lang$ = "Spanish - Ecuador": CP = 1252
  816.             CASE "essv": lang$ = "Spanish - El Salvador": CP = 1252
  817.             CASE "esgt": lang$ = "Spanish - Guatemala": CP = 1252
  818.             CASE "eshn": lang$ = "Spanish - Honduras": CP = 1252
  819.             CASE "esmx": lang$ = "Spanish - Mexico": CP = 1252
  820.             CASE "esni": lang$ = "Spanish - Nicaragua": CP = 1252
  821.             CASE "espa": lang$ = "Spanish - Panama": CP = 1252
  822.             CASE "espy": lang$ = "Spanish - Paraguay": CP = 1252
  823.             CASE "espe": lang$ = "Spanish - Peru": CP = 1252
  824.             CASE "espr": lang$ = "Spanish - Puerto Rico": CP = 1252
  825.             CASE "eses": lang$ = "Spanish - Spain (Traditional)": CP = 1252
  826.             CASE "esuy": lang$ = "Spanish - Uruguay": CP = 1252
  827.             CASE "esve": lang$ = "Spanish - Venezuela": CP = 1252
  828.             CASE "sw": lang$ = "Swahili": CP = 441: CP2 = 1252
  829.             CASE "swfi": lang$ = "Swedish - Finland": CP = 1252
  830.             CASE "svse": lang$ = "Swedish - Sweden": CP = 1252
  831.             CASE "tg": lang$ = "Tajik": CP = 428
  832.             CASE "ta": lang$ = "Tamil": CP = 449
  833.             CASE "tr": lang$ = "Tatar": CP = 444: CP2 = 1251
  834.             CASE "te": lang$ = "Telugu" 'CP unknown
  835.             CASE "th": lang$ = "Thai" 'CP unkown
  836.             CASE "bo": lang$ = "Tibetan": CP = 451
  837.             CASE "ts": lang$ = "Tsonga": CP = 431
  838.             CASE "tr": lang$ = "Turkish": CP = 1254
  839.             CASE "tk": lang$ = "Turkmen": CP = 442
  840.             CASE "uk": lang$ = "Ukrainian": CP = 422: CP2 = 1251
  841.             CASE "utf8": lang$ = "Unicode": CP = -2 '    UTF-8
  842.             CASE "ur": lang$ = "Urdu": CP = 420: CP2 = 1256
  843.             CASE "uzuz": lang$ = "Uzbek - Cyrillic": CP = 843: CP2 = 1251
  844.             CASE "vi": lang$ = "Vietnamese": CP = 1258
  845.             CASE "cy": lang$ = "Welsh": CP = 452
  846.             CASE "xh": lang$ = "Xhosa": CP = 434
  847.             CASE "yi": lang$ = "Yiddish" 'unknown CP
  848.             CASE "zu": lang$ = "Zulu": CP = 435
  849.         END SELECT
  850.     END IF
  851.  
  852.     IF CPW THEN CP2 = CPW
  853.     IF CP2 THEN language = CP2 ELSE language = CP
  854.     IF language = 0 THEN PRINT "Sorry, unknown Code Page for your country.": END
  855.  
  856.  
  857.     REM _FONT _LOADFONT("cyberbit.ttf", 15, "monospace")
  858.  
  859.     SELECT CASE language '                                  set DATA READ to correct position (without it read READ first DATA block and ignore his name)
  860.         CASE 437: RESTORE Microsoft_pc_cp437
  861.         CASE 737: RESTORE Microsoft_pc_cp737
  862.         CASE 775: RESTORE Microsoft_pc_cp775
  863.         CASE 850: RESTORE Microsoft_pc_cp850
  864.         CASE 852: RESTORE Microsoft_pc_cp852
  865.         CASE 855: RESTORE Microsoft_pc_cp855
  866.         CASE 857: RESTORE Microsoft_pc_cp857
  867.         CASE 860: RESTORE Microsoft_pc_cp860
  868.         CASE 861: RESTORE Microsoft_pc_cp861
  869.         CASE 862: RESTORE Microsoft_pc_cp862
  870.         CASE 863: RESTORE Microsoft_pc_cp863
  871.         CASE 864: RESTORE Microsoft_pc_cp864
  872.         CASE 865: RESTORE Microsoft_pc_cp865
  873.         CASE 866: RESTORE Microsoft_pc_cp866
  874.         CASE 869: RESTORE Microsoft_pc_cp869
  875.         CASE 874: RESTORE Microsoft_pc_cp874
  876.         CASE 1250: RESTORE Microsoft_windows_cp1250
  877.         CASE 1251: RESTORE Microsoft_windows_cp1251
  878.         CASE 1252: RESTORE Microsoft_windows_cp1252
  879.         CASE 1253: RESTORE Microsoft_windows_cp1253
  880.         CASE 1254: RESTORE Microsoft_windows_cp1254
  881.         CASE 1255: RESTORE Microsoft_windows_cp1255
  882.         CASE 1256: RESTORE Microsoft_windows_cp1256
  883.         CASE 1257: RESTORE Microsoft_windows_cp1257
  884.         CASE 1258: RESTORE Microsoft_windows_cp1258
  885.     END SELECT
  886.  
  887.  
  888.  
  889.  
  890.     FOR ASCIIcode = 128 TO 255
  891.         SELECT CASE language
  892.             CASE 437: READ Microsoft_pc_cp437: _MAPUNICODE Microsoft_pc_cp437 TO ASCIIcode
  893.             CASE 737: READ Microsoft_pc_cp737: _MAPUNICODE Microsoft_pc_cp737 TO ASCIIcode
  894.             CASE 775: READ Microsoft_pc_cp775: _MAPUNICODE Microsoft_pc_cp775 TO ASCIIcode
  895.             CASE 850: READ Microsoft_pc_cp850: _MAPUNICODE Microsoft_pc_cp850 TO ASCIIcode
  896.             CASE 852: READ Microsoft_pc_cp852: _MAPUNICODE Microsoft_pc_cp852 TO ASCIIcode
  897.             CASE 855: READ Microsoft_pc_cp855: _MAPUNICODE Microsoft_pc_cp855 TO ASCIIcode
  898.             CASE 857: READ Microsoft_pc_cp857: _MAPUNICODE Microsoft_pc_cp857 TO ASCIIcode
  899.             CASE 860: READ Microsoft_pc_cp860: _MAPUNICODE Microsoft_pc_cp860 TO ASCIIcode
  900.             CASE 861: READ Microsoft_pc_cp861: _MAPUNICODE Microsoft_pc_cp861 TO ASCIIcode
  901.             CASE 862: READ Microsoft_pc_cp862: _MAPUNICODE Microsoft_pc_cp862 TO ASCIIcode
  902.             CASE 863: READ Microsoft_pc_cp863: _MAPUNICODE Microsoft_pc_cp863 TO ASCIIcode
  903.             CASE 864: READ Microsoft_pc_cp864: _MAPUNICODE Microsoft_pc_cp864 TO ASCIIcode
  904.             CASE 865: READ Microsoft_pc_cp865: _MAPUNICODE Microsoft_pc_cp865 TO ASCIIcode
  905.             CASE 866: READ Microsoft_pc_cp866: _MAPUNICODE Microsoft_pc_cp866 TO ASCIIcode
  906.             CASE 869: READ Microsoft_pc_cp869: _MAPUNICODE Microsoft_pc_cp869 TO ASCIIcode
  907.             CASE 874: READ Microsoft_pc_cp874: _MAPUNICODE Microsoft_pc_cp874 TO ASCIIcode
  908.             CASE 1250: READ Microsoft_windows_cp1250: _MAPUNICODE Microsoft_windows_cp1250 TO ASCIIcode
  909.             CASE 1251: READ Microsoft_windows_cp1251: _MAPUNICODE Microsoft_windows_cp1251 TO ASCIIcode
  910.             CASE 1252: READ Microsoft_windows_cp1252: _MAPUNICODE Microsoft_windows_cp1252 TO ASCIIcode
  911.             CASE 1253: READ Microsoft_windows_cp1253: _MAPUNICODE Microsoft_windows_cp1253 TO ASCIIcode
  912.             CASE 1254: READ Microsoft_windows_cp1254: _MAPUNICODE Microsoft_windows_cp1254 TO ASCIIcode
  913.             CASE 1255: READ Microsoft_windows_cp1255: _MAPUNICODE Microsoft_windows_cp1255 TO ASCIIcode
  914.             CASE 1256: READ Microsoft_windows_cp1256: _MAPUNICODE Microsoft_windows_cp1256 TO ASCIIcode
  915.             CASE 1257: READ Microsoft_windows_cp1257: _MAPUNICODE Microsoft_windows_cp1257 TO ASCIIcode
  916.             CASE 1258: READ Microsoft_windows_cp1258: _MAPUNICODE Microsoft_windows_cp1258 TO ASCIIcode
  917.         END SELECT
  918.     NEXT
  919.     KILL "nation.txt"
  920.  
  921.     PRINT "Detected nation:"; lang$; ", code pages: "; CP; ", "; CP2
  922.     'INPUT "input text with your national characters, if is displayed wrong, try other font (set it in line 392):"; text$
  923.  
  924.  
  925.     f2 = FREEFILE
  926.     OPEN "test.txt" FOR INPUT AS #f2
  927.     WHILE NOT EOF(f2)
  928.         LINE INPUT #f2, text$
  929.         PRINT text$
  930.     WEND
  931.     CLOSE f2
  932.  
  933.     Microsoft_pc_cp437:
  934.     DATA 199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197
  935.     DATA 201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402
  936.     DATA 225,237,243,250,241,209,170,186,191,8976,172,189,188,161,171,187
  937.     DATA 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
  938.     DATA 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
  939.     DATA 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
  940.     DATA 945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745
  941.     DATA 8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,160
  942.  
  943.     Microsoft_pc_cp737:
  944.     DATA 913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928
  945.     DATA 929,931,932,933,934,935,936,937,945,946,947,948,949,950,951,952
  946.     DATA 953,954,955,956,957,958,959,960,961,963,962,964,965,966,967,968
  947.     DATA 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
  948.     DATA 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
  949.     DATA 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
  950.     DATA 969,940,941,942,970,943,972,973,971,974,902,904,905,906,908,910
  951.     DATA 911,177,8805,8804,938,939,247,8776,176,8729,183,8730,8319,178,9632,160
  952.  
  953.     Microsoft_pc_cp775:
  954.     DATA 262,252,233,257,228,291,229,263,322,275,342,343,299,377,196,197
  955.     DATA 201,230,198,333,246,290,162,346,347,214,220,248,163,216,215,164
  956.     DATA 256,298,243,379,380,378,8221,166,169,174,172,189,188,321,171,187
  957.     DATA 9617,9618,9619,9474,9508,260,268,280,278,9571,9553,9559,9565,302,352,9488
  958.     DATA 9492,9524,9516,9500,9472,9532,370,362,9562,9556,9577,9574,9568,9552,9580,381
  959.     DATA 261,269,281,279,303,353,371,363,382,9496,9484,9608,9604,9612,9616,9600
  960.     DATA 211,223,332,323,245,213,181,324,310,311,315,316,326,274,325,8217
  961.     DATA 173,177,8220,190,182,167,247,8222,176,8729,183,185,179,178,9632,160
  962.  
  963.     Microsoft_pc_cp850:
  964.     DATA 199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197
  965.     DATA 201,230,198,244,246,242,251,249,255,214,220,248,163,216,215,402
  966.     DATA 225,237,243,250,241,209,170,186,191,174,172,189,188,161,171,187
  967.     DATA 9617,9618,9619,9474,9508,193,194,192,169,9571,9553,9559,9565,162,165,9488
  968.     DATA 9492,9524,9516,9500,9472,9532,227,195,9562,9556,9577,9574,9568,9552,9580,164
  969.     DATA 240,208,202,203,200,305,205,206,207,9496,9484,9608,9604,166,204,9600
  970.     DATA 211,223,212,210,245,213,181,254,222,218,219,217,253,221,175,180
  971.     DATA 173,177,8215,190,182,167,247,184,176,168,183,185,179,178,9632,160
  972.  
  973.     Microsoft_pc_cp852:
  974.     DATA 199,252,233,226,228,367,263,231,322,235,336,337,238,377,196,262
  975.     DATA 201,313,314,244,246,317,318,346,347,214,220,356,357,321,215,269
  976.     DATA 225,237,243,250,260,261,381,382,280,281,172,378,268,351,171,187
  977.     DATA 9617,9618,9619,9474,9508,193,194,282,350,9571,9553,9559,9565,379,380,9488
  978.     DATA 9492,9524,9516,9500,9472,9532,258,259,9562,9556,9577,9574,9568,9552,9580,164
  979.     DATA 273,272,270,203,271,327,205,206,283,9496,9484,9608,9604,354,366,9600
  980.     DATA 211,223,212,323,324,328,352,353,340,218,341,368,253,221,355,180
  981.     DATA 173,733,731,711,728,167,247,184,176,168,729,369,344,345,9632,160
  982.  
  983.     Microsoft_pc_cp855:
  984.     DATA 1106,1026,1107,1027,1105,1025,1108,1028,1109,1029,1110,1030,1111,1031,1112,1032
  985.     DATA 1113,1033,1114,1034,1115,1035,1116,1036,1118,1038,1119,1039,1102,1070,1098,1066
  986.     DATA 1072,1040,1073,1041,1094,1062,1076,1044,1077,1045,1092,1060,1075,1043,171,187
  987.     DATA 9617,9618,9619,9474,9508,1093,1061,1080,1048,9571,9553,9559,9565,1081,1049,9488
  988.     DATA 9492,9524,9516,9500,9472,9532,1082,1050,9562,9556,9577,9574,9568,9552,9580,164
  989.     DATA 1083,1051,1084,1052,1085,1053,1086,1054,1087,9496,9484,9608,9604,1055,1103,9600
  990.     DATA 1071,1088,1056,1089,1057,1090,1058,1091,1059,1078,1046,1074,1042,1100,1068,8470
  991.     DATA 173,1099,1067,1079,1047,1096,1064,1101,1069,1097,1065,1095,1063,167,9632,160
  992.  
  993.     Microsoft_pc_cp857:
  994.     DATA 199,252,233,226,228,224,229,231,234,235,232,239,238,305,196,197
  995.     DATA 201,230,198,244,246,242,251,249,304,214,220,248,163,216,350,351
  996.     DATA 225,237,243,250,241,209,286,287,191,174,172,189,188,161,171,187
  997.     DATA 9617,9618,9619,9474,9508,193,194,192,169,9571,9553,9559,9565,162,165,9488
  998.     DATA 9492,9524,9516,9500,9472,9532,227,195,9562,9556,9577,9574,9568,9552,9580,164
  999.     DATA 186,170,202,203,200,0,205,206,207,9496,9484,9608,9604,166,204,9600
  1000.     DATA 211,223,212,210,245,213,181,0,215,218,219,217,236,255,175,180
  1001.     DATA 173,177,0,190,182,167,247,184,176,168,183,185,179,178,9632,160
  1002.  
  1003.     Microsoft_pc_cp860:
  1004.     DATA 199,252,233,226,227,224,193,231,234,202,232,205,212,236,195,194
  1005.     DATA 201,192,200,244,245,242,218,249,204,213,220,162,163,217,8359,211
  1006.     DATA 225,237,243,250,241,209,170,186,191,210,172,189,188,161,171,187
  1007.     DATA 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
  1008.     DATA 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
  1009.     DATA 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
  1010.     DATA 945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745
  1011.     DATA 8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,160
  1012.  
  1013.     Microsoft_pc_cp861:
  1014.     DATA 199,252,233,226,228,224,229,231,234,235,232,208,240,222,196,197
  1015.     DATA 201,230,198,244,246,254,251,221,253,214,220,248,163,216,8359,402
  1016.     DATA 225,237,243,250,193,205,211,218,191,8976,172,189,188,161,171,187
  1017.     DATA 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
  1018.     DATA 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
  1019.     DATA 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
  1020.     DATA 945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745
  1021.     DATA 8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,160
  1022.  
  1023.     Microsoft_pc_cp862:
  1024.     DATA 1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503
  1025.     DATA 1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,162,163,165,8359,402
  1026.     DATA 225,237,243,250,241,209,170,186,191,8976,172,189,188,161,171,187
  1027.     DATA 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
  1028.     DATA 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
  1029.     DATA 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
  1030.     DATA 945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745
  1031.     DATA 8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,160
  1032.  
  1033.     Microsoft_pc_cp863:
  1034.     DATA 199,252,233,226,194,224,182,231,234,235,232,239,238,8215,192,167
  1035.     DATA 201,200,202,244,203,207,251,249,164,212,220,162,163,217,219,402
  1036.     DATA 166,180,243,250,168,184,179,175,206,8976,172,189,188,190,171,187
  1037.     DATA 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
  1038.     DATA 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
  1039.     DATA 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
  1040.     DATA 4023,945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745
  1041.     DATA 8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,160
  1042.  
  1043.     Microsoft_pc_cp864:
  1044.     DATA 176,183,8729,8730,9618,9472,9474,9532,9508,9516,9500,9524,9488,9484,9492,9496
  1045.     DATA 946,8734,966,177,189,188,8776,171,187,65271,65272,0,0,65275,65276,0
  1046.     DATA 160,173,65154,163,164,65156,0,0,65166,65167,65173,65177,1548,65181,65185,65189
  1047.     DATA 1632,1633,1634,1635,1636,1637,1638,1639,1640,1641,65233,1563,65201,65205,65209,1567
  1048.     DATA 162,65152,65153,65155,65157,65226,65163,65165,65169,65171,65175,65179,65183,65187,65191,65193
  1049.     DATA 65195,65197,65199,65203,65207,65211,65215,65217,65221,65227,65231,166,172,247,215,65225
  1050.     DATA 1600,65235,65239,65243,65247,65251,65255,65259,65261,65263,65267,65213,65228,65230,65229,65249
  1051.     DATA 65149,1617,65253,65257,65260,65264,65266,65232,65237,65269,65270,65245,65241,65265,9632,0
  1052.  
  1053.     Microsoft_pc_cp865:
  1054.     DATA 199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197
  1055.     DATA 201,230,198,244,246,242,251,249,255,214,220,248,163,216,8359,402
  1056.     DATA 225,237,243,250,241,209,170,186,191,8976,172,189,188,161,171,164
  1057.     DATA 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
  1058.     DATA 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
  1059.     DATA 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
  1060.     DATA 945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745
  1061.     DATA 8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,160
  1062.  
  1063.     Microsoft_pc_cp866:
  1064.     DATA 1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055
  1065.     DATA 1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071
  1066.     DATA 1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087
  1067.     DATA 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
  1068.     DATA 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
  1069.     DATA 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
  1070.     DATA 1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103
  1071.     DATA 1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160
  1072.  
  1073.     Microsoft_pc_cp869:
  1074.     DATA 0,0,0,0,0,0,902,0,183,172,166,8216,8217,904,8213,905
  1075.     DATA 906,938,908,0,0,910,939,169,911,178,179,940,163,941,942,943
  1076.     DATA 970,912,972,973,913,914,915,916,917,918,919,189,920,921,171,187
  1077.     DATA 9617,9618,9619,9474,9508,922,923,924,925,9571,9553,9559,9565,926,927,9488
  1078.     DATA 9492,9524,9516,9500,9472,9532,928,929,9562,9556,9577,9574,9568,9552,9580,931
  1079.     DATA 932,933,934,935,936,937,945,946,947,9496,9484,9608,9604,948,949,9600
  1080.     DATA 950,951,952,953,954,955,956,957,958,959,960,961,963,962,964,900
  1081.     DATA 173,177,965,966,967,167,968,901,176,168,969,971,944,974,9632,160
  1082.  
  1083.     Microsoft_pc_cp874:
  1084.     DATA 8364,0,0,0,0,8230,0,0,0,0,0,0,0,0,0,0
  1085.     DATA 0,8216,8217,8220,8221,8226,8211,8212,0,0,0,0,0,0,0,0
  1086.     DATA 160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599
  1087.     DATA 3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615
  1088.     DATA 3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631
  1089.     DATA 3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,0,0,0,0,3647
  1090.     DATA 3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663
  1091.     DATA 3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,0,0,0,0
  1092.  
  1093.     Microsoft_windows_cp1250:
  1094.     DATA 8364,0,8218,0,8222,8230,8224,8225,0,8240,352,8249,346,356,381,377
  1095.     DATA 0,8216,8217,8220,8221,8226,8211,8212,0,8482,353,8250,347,357,382,378
  1096.     DATA 160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379
  1097.     DATA 176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380
  1098.     DATA 340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270
  1099.     DATA 272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223
  1100.     DATA 341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271
  1101.     DATA 273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729
  1102.  
  1103.     Microsoft_windows_cp1251:
  1104.     DATA 1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039
  1105.     DATA 1106,8216,8217,8220,8221,8226,8211,8212,0,8482,1113,8250,1114,1116,1115,1119
  1106.     DATA 160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031
  1107.     DATA 176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111
  1108.     DATA 1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055
  1109.     DATA 1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071
  1110.     DATA 1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087
  1111.     DATA 1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103
  1112.  
  1113.     Microsoft_windows_cp1252:
  1114.     DATA 8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,381,0
  1115.     DATA 0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,382,376
  1116.     DATA 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175
  1117.     DATA 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191
  1118.     DATA 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207
  1119.     DATA 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223
  1120.     DATA 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239
  1121.     DATA 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
  1122.  
  1123.     Microsoft_windows_cp1253:
  1124.     DATA 8364,0,8218,402,8222,8230,8224,8225,0,8240,0,8249,0,0,0,0
  1125.     DATA 0,8216,8217,8220,8221,8226,8211,8212,0,8482,0,8250,0,0,0,0
  1126.     DATA 160,901,902,163,164,165,166,167,168,169,0,171,172,173,174,8213
  1127.     DATA 176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911
  1128.     DATA 912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927
  1129.     DATA 928,929,0,931,932,933,934,935,936,937,938,939,940,941,942,943
  1130.     DATA 944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959
  1131.     DATA 960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,0
  1132.  
  1133.     Microsoft_windows_cp1254:
  1134.     DATA 8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,0,0
  1135.     DATA 0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,0,376
  1136.     DATA 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175
  1137.     DATA 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191
  1138.     DATA 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207
  1139.     DATA 286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223
  1140.     DATA 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239
  1141.     DATA 287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255
  1142.  
  1143.     Microsoft_windows_cp1255:
  1144.     DATA 8364,0,8218,402,8222,8230,8224,8225,710,8240,0,8249,0,0,0,0
  1145.     DATA 0,8216,8217,8220,8221,8226,8211,8212,732,8482,0,8250,0,0,0,0
  1146.     DATA 160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175
  1147.     DATA 176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191
  1148.     DATA 1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,0,1467,1468,1469,1470,1471
  1149.     DATA 1472,1473,1474,1475,1520,1521,1522,1523,1524,0,0,0,0,0,0,0
  1150.     DATA 1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503
  1151.     DATA 1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,0,0,8206,8207,0
  1152.  
  1153.     Microsoft_windows_cp1256:
  1154.     DATA 8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672
  1155.     DATA 1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722
  1156.     DATA 160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175
  1157.     DATA 176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567
  1158.     DATA 1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583
  1159.     DATA 1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603
  1160.     DATA 224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239
  1161.     DATA 1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746
  1162.  
  1163.     Microsoft_windows_cp1257:
  1164.     DATA 8364,0,8218,0,8222,8230,8224,8225,0,8240,0,8249,0,168,711,184
  1165.     DATA 0,8216,8217,8220,8221,8226,8211,8212,0,8482,0,8250,0,175,731,0
  1166.     DATA 160,0,162,163,164,0,166,167,216,169,342,171,172,173,174,198
  1167.     DATA 176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230
  1168.     DATA 260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315
  1169.     DATA 352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223
  1170.     DATA 261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316
  1171.     DATA 353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729
  1172.  
  1173.     Microsoft_windows_cp1258:
  1174.     DATA 8364,0,8218,402,8222,8230,8224,8225,710,8240,0,8249,338,0,0,0
  1175.     DATA 0,8216,8217,8220,8221,8226,8211,8212,732,8482,0,8250,339,0,0,376
  1176.     DATA 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175
  1177.     DATA 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191
  1178.     DATA 192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207
  1179.     DATA 272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223
  1180.     DATA 224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239
  1181.     DATA 273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255
  1182.  
  1183.     IF INSTR(_OS$, "WINDOWS") THEN WIN = 1 ELSE WIN = 0
  1184.  
  1185. SUB CopyARR (s() AS STRING, d() AS STRING)
  1186.     REDIM d(UBOUND(s)) AS STRING
  1187.     start = LBOUND(s)
  1188.     DO UNTIL start = UBOUND(s)
  1189.         start = start + 1
  1190.         d(start) = s(start)
  1191.  
  1192.     LOOP
  1193.  
  1194.  

* MaV.zip (Filesize: 1.03 KB, Downloads: 169)

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Development of a program for automatic search for music and movies
« Reply #98 on: August 17, 2020, 08:26:46 pm »
Hey guys! So I made up some code using my API functions I've been working on that might come in handy with this project for a program that keeps track of movies and such.

Here is a screenshot of the demo app working:
 
omdb api.png


And here is the source code for the demo:
Code: QB64: [Select]
  1.  
  2. _TITLE "OMDB API - Poster"
  3. _CONSOLETITLE "OMDB API - Movie Info"
  4.  
  5. DIM poster AS STRING
  6. URL = "http://www.omdbapi.com/?apikey=a6984482&t="
  7. DIM movietitle AS STRING
  8.  
  9. LINE INPUT "Title of Movie: ", movietitle
  10.  
  11. omdb = API_request(URL + FormatAsHTTP(movietitle), "omdbreq")
  12. poster = GetKey(omdb, "Poster")
  13. DIM i&
  14. i& = OnlineImage(poster, "testposter")
  15. IF i& <> -1 AND i& <> 0 THEN
  16.     SCREEN i&
  17.  
  18. PRINT "Movie:        "; GetKey(omdb, "Title")
  19. PRINT "Release Date: "; GetKey(omdb, "Released")
  20. PRINT GetKey(omdb, "Plot")
  21.  
  22.  
  23.  
  24.  
  25.     FUNCTION URLDownloadToFileA (BYVAL pCaller AS LONG, szURL AS STRING, szFileName AS STRING, BYVAL dwReserved AS LONG, BYVAL lpfnCB AS LONG)
  26.  
  27. FUNCTION OnlineImage& (URL AS STRING, File AS STRING)
  28.     DIM apireq AS STRING
  29.     DIM a%
  30.     DIM i&
  31.     a% = URLDownloadToFileA(0, URL + CHR$(0), File + CHR$(0), 0, 0)
  32.     DIM U AS INTEGER
  33.     U = FREEFILE
  34.     OPEN File FOR BINARY AS #U
  35.     IF LOF(U) <> 0 THEN
  36.         CLOSE #U
  37.         i& = _LOADIMAGE(File, 32)
  38.         KILL File
  39.     ELSE
  40.         i& = 0
  41.         CLOSE #U
  42.         KILL File
  43.     END IF
  44.     OnlineImage = i&
  45.  
  46. FUNCTION API_request$ (URL AS STRING, File AS STRING)
  47.     DIM apireq AS STRING
  48.     DIM a%
  49.     a% = URLDownloadToFileA(0, URL + CHR$(0), File + CHR$(0), 0, 0)
  50.     DIM U AS INTEGER
  51.     U = FREEFILE
  52.     OPEN File FOR BINARY AS #U
  53.     IF LOF(U) <> 0 THEN
  54.         apireq = SPACE$(LOF(U))
  55.         GET #U, , apireq
  56.         CLOSE #U
  57.         KILL File
  58.     ELSE
  59.         CLOSE #U
  60.         KILL File
  61.         API_request = ""
  62.         EXIT FUNCTION
  63.     END IF
  64.     API_request = apireq
  65.  
  66. 'FUNCTION CURL$ (URL AS STRING, File AS STRING)
  67. '    DIM curlrequest AS STRING
  68. '    SHELL _HIDE "curl " + CHR$(34) + URL + CHR$(34) + " -o " + CHR$(34) + File + CHR$(34)
  69. '    DIM U AS INTEGER
  70. '    U = FREEFILE
  71. '    OPEN File FOR BINARY AS #U
  72. '    IF LOF(U) <> 0 THEN
  73. '        curlrequest = SPACE$(LOF(U))
  74. '        GET #U, , curlrequest
  75. '        CLOSE #U
  76. '        KILL File
  77. '    ELSE
  78. '        CLOSE #U
  79. '        KILL File
  80. '        CURL = ""
  81. '        EXIT FUNCTION
  82. '    END IF
  83. '    CURL = curlrequest
  84. 'END FUNCTION
  85.  
  86. FUNCTION GetKey$ (JSON AS STRING, keyname AS STRING)
  87.     DIM jkey AS STRING
  88.     jkey = JSON
  89.     IF INSTR(jkey, CHR$(34) + keyname + CHR$(34)) THEN
  90.         jkey = MID$(jkey, INSTR(jkey, CHR$(34) + keyname + CHR$(34)) + LEN(keyname))
  91.         jkey = MID$(jkey, INSTR(jkey, ":") + 1)
  92.         jkey = String.Replace(jkey, "\" + CHR$(34), "'")
  93.         IF MID$(jkey, 1, 1) = CHR$(34) THEN
  94.             jkey = MID$(jkey, 2)
  95.         END IF
  96.         jkey = MID$(jkey, 1, INSTR(jkey, CHR$(34)) - 1)
  97.         IF RIGHT$(jkey, 1) = "," THEN
  98.             jkey = MID$(jkey, 1, LEN(jkey) - 1)
  99.         END IF
  100.     ELSE
  101.         GetKey = ""
  102.     END IF
  103.     GetKey = jkey
  104.  
  105. SUB GetAllKey (JSON AS STRING, keyname AS STRING, ParseKey() AS STRING)
  106.     DIM unchangejson AS STRING
  107.     DIM jkey AS STRING
  108.     DIM x
  109.     unchangejson = JSON
  110.     DO
  111.         IF INSTR(unchangejson, CHR$(34) + keyname + CHR$(34)) THEN
  112.             x = x + 1
  113.             REDIM _PRESERVE ParseKey(x) AS STRING
  114.             unchangejson = MID$(unchangejson, INSTR(unchangejson, CHR$(34) + keyname + CHR$(34)) + LEN(keyname))
  115.             jkey = unchangejson
  116.             jkey = MID$(jkey, INSTR(jkey, ":") + 1)
  117.             jkey = String.Replace(jkey, "\" + CHR$(34), "'")
  118.             IF MID$(jkey, 1, 1) = CHR$(34) THEN
  119.                 jkey = MID$(jkey, 2)
  120.             END IF
  121.             jkey = MID$(jkey, 1, INSTR(jkey, CHR$(34)) - 1)
  122.             IF RIGHT$(jkey, 1) = "," THEN
  123.                 jkey = MID$(jkey, 1, LEN(jkey) - 1)
  124.             END IF
  125.             ParseKey(x) = jkey
  126.         END IF
  127.     LOOP UNTIL INSTR(unchangejson, CHR$(34) + keyname + CHR$(34)) = 0
  128.  
  129. FUNCTION String.Replace$ (a AS STRING, b AS STRING, c AS STRING)
  130.     DIM j
  131.     DIM r
  132.     DIM r$
  133.     j = INSTR(a, b)
  134.     IF j > 0 THEN
  135.         r$ = LEFT$(a, j - 1) + c + String.Replace(RIGHT$(a, LEN(a) - j + 1 - LEN(b)), b, c)
  136.     ELSE
  137.         r$ = a
  138.     END IF
  139.     String.Replace = r$
  140.  
  141. FUNCTION FormatAsHTTP$ (paramater AS STRING)
  142.     DIM Request AS STRING
  143.     Request = paramater
  144.     DIM start%
  145.     DIM position%
  146.     start% = 1
  147.     DO
  148.         position% = INSTR(start%, Request, " ")
  149.         IF position% THEN
  150.             MID$(Request, position%, 1) = "+"
  151.             start% = position% + 1
  152.         END IF
  153.     LOOP UNTIL position% = 0
  154.     Request = String.Replace(Request, "'", "%27")
  155.     FormatAsHTTP = Request
Shuwatch!