buon giorno a tutto sono nuovo di Gambas , e della programmazione in genere , ho installato gambas 3 su linux mint e tutti i suoi componenti aggiuntivi.
ho provato a copiare il seguente script e a farlo girare , ma mi da errore unknow identifier WebView1 :(
' Gambas module file
Public Sub Form_Open()
' Carica una pagina web:
WebView1.Url = ("http://www.bing.com")
End
Public Sub WebView1_Load() ' Quando la pagina web è stata completamente caricata, viene sollevato questo evento
Dim ss As String[]
Dim s As String
ss = Split(Lower(WebView1.HTML), " ", "", True)
For Each s In ss
If s Like "href=\"*" Then
s = Replace(s, "href=", "")
' Mostra in console un collegamento individuato ad una pagina web esterna:
Print Left(s, RInStr(s, "\""))
Endif
Next
End
qualcuno sa dirmi il perchè???
grazie a tutti
scusa il ritardo, in pratica quello che volevo fare era un webscaraping della foto di bing che poi magari con il shell wget forse lo avrei fatto , ma alla fine poi ho risolto in perl
#!/usr/bin/perl
#--------------------------------------------------------------
# bing-bong by Stefano Cerbioni
# script cambia wallpaper in llinux mint mate
# mail: info@e-officecom.com
#web: www.e-officecom.com
#--------------------------------------------------------------
use strict;
use warnings;
use LWP::Simple;
my $content = get('http://www.bing.com') or die 'Unable to get page';
if ( $content =~ m/url/ ) {
my @matches = $content =~ m{/az/hprichbg/rb/.*?\.jpg}g;
my $percorso = "http://www.bing.com" . "$matches[0]\n";
#print $percorso;
my @matches_1 = $matches[0] =~ m{rb/(.*?\.jpg)}g;
my $path_salavataggio = '/usr/share/backgrounds/bing/'.$matches_1[0];
my $status = getstore( $percorso , $path_salavataggio );
if ( is_success($status) ) {
print "file downloaded correctly in file:///$path_salavataggio\n";
`gsettings set org.mate.background picture-filename $path_salavataggio`;
# `gsettings set org.gnome.desktop.background picture-uri "file:///$path_salavataggio"`;
}
else {
print "error downloading file: $status\n";
}
}
else {
print "no match\n";
}
exit 0;
grazie a tutti
...sono sufficienti poche righe di Gambas (bisogna attivare preliminarmente i seguenti Componenti: gb.gui.qt, gb.gui.qt.webview, gb.net e gb.net.curl).
Private wv As WebView
Private miohttp As New HttpClient As "Miohttp"
Public Sub Button1_Click()
With wv = New WebView(Me) As "WV"
.Url = "http://www.bing.com"
End With
End
Public Sub WV_Load()
Dim percorso As String
percorso = Scan(wv.HTML, "*\"Image\":*\"Url\":\"*[\\]*")[2]
With miohttp
If .Status == Net.Inactive Then
.URL = "www.bing.com" &/ percorso
.Timeout = 15
' Scarica i dati e ricrea il file immagine nella cartella temporale:'
.Get(Null, "/tmp" &/ File.Name(percorso))
Endif
End With
End
Public Sub Miohttp_Finished()
miohttp.Close
End