/GPS Donne la position GPS d'une ville et un lien vers une carte interactive.
/GPS Marseille
/GPS 75002
/GPS
Source / Exemple :
menu menubar,channel,query {
gps
.Gps...:/gps
.$submenu($Gps.menu($1))
}
alias Gps.Menu {
if ( $1 == begin) return -
if ( $1 <= $numtok( %GpsList,33) ) return GPS $gettok(%GpsList, $1 ,33 ) $+ ... : /Gps $gettok(%GpsList, $1 ,33 )
if ( $1 == end) return -
}
alias F2 { /gps }
alias gps {
%Gps.Active = $active
if ( $dialog( Gps.Dlg ) == $null ) { /dialog -m Gps.Dlg Gps.table }
if ( $1- == $null ) || ( %Gps.OQP ) /return
/did -i Gps.Dlg 111 0 $replace( $$1-, $chr(32), - )
/Gps.Echo Je cherche les informations sur $did( Gps.Dlg, 111 ).text $+ ...
/sockopen Gps.Sock fr.maps.yahoo.com 80
}
alias Gps.echo {
if ( $dialog( Gps.Dlg ) != $null ) {
/did -ri Gps.Dlg 11 1 $$1-
}
}
;--------------------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------------------
dialog Gps.Table {
; /did -b Gps.Dlg 112,201,211,221,231,301 ; Disable Button et text
title Gps By Nestor
size -1 -1 226 237
menu "?", 900
item "Version", 901
item "Mail a Nestor", 902 ;/run mailto:jf_nestor@hotmail.com
text "Gps By Nestor",011 , 6 168 210 36, center
button "&Sortir",001, 66 213 90 18,cancel
tab "Localité" , 100, -1 -1 225 169
button "Recherche" , 101, 66 138 90 18, default, tab 100
box "Ville ou Code postal",110, 6 24 210 42, tab 100
combo 111, 12 42 162 18, focus, sort , edit , drop , tab 100
button "Del" , 112, 180 42 30 18, disable, tab 100
tab "Coord" , 200
button "Message" , 201, 66 138 90 18, disable, tab 200
box "Ville et Code postal",210, 6 24 210 42, tab 200
text ,211, 12 42 198 18, edit, drop, disable, tab 200
box "Nord Sud",220, 6 72 102 42, tab 200
text ,221, 12 90 90 18, disable, tab 200
box "Est Ouest",230, 114 72 102 42, tab 200
text ,231, 120 90 90 18, disable, tab 200
tab "Plan", 300
button "Plan" , 301, 66 138 90 18, disable, tab 300
box "Options",310, 6 24 210 42, tab 300
combo 311, 12 42 48 18, drop, sort, tab 300
text "X",312, 60 42 12 18, center tab 300
combo 313, 72 42 48 18, drop, sort, tab 300
combo 315, 142 42 48 18, drop, sort, tab 300
box "Nord Sud",320, 6 72 102 42, tab 300
edit ,321, 12 90 90 18, tab 300
box "Est Ouest",330, 114 72 102 42, tab 300
edit ,331, 120 90 90 18, tab 300
tab "Infos", 400
box "Cartes",410, 6 24 210 42, tab 400
button "IsMap" , 411, 12 42 60 18, disable, tab 400
}
;--------------------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------------------
on *:dialog:Gps.Dlg:init:00:{
/did -f Gps.Dlg 111 ; Focus sur le test
/var %x 1
while ( %x <= $numtok( %GpsList,33) ) {
/did -i Gps.Dlg 111 %x $gettok(%GpsList, %x ,33 )
/inc %x
}
/var %x 1
while ( %x <= 10 ) {
/did -i Gps.Dlg 311,313 %x $calc( %x * 100 )
/inc %x
}
/did -c Gps.Dlg 311,313 4
/var %x 1
while ( %x <= 11 ) {
/did -i Gps.Dlg 315 %x %x
/inc %x
}
/did -c Gps.Dlg 315 9
}
on *:dialog:Gps.Dlg:menu:901: /Gps.Echo Gps Ver: 2.00 Nestor Nov 2003
on *:dialog:Gps.Dlg:menu:902: /run mailto:Nestor_Script@yahoogroupes.fr
on *:dialog:Gps.Dlg:sclick:001: /unset %Gps.*
on *:dialog:Gps.Dlg:sclick:101:{
if ( %Gps.OQP ) /return
if ( !$did( 111 ).text ) {
/Gps.Echo Entrez une ville ou code postal
/did -f Gps.Dlg 111 ; Focus sur le test
/did -t Gps.Dlg 101 ; defaut sur recherche
/return
}
/did -b Gps.Dlg 111 ; Disable le text
/did -t Gps.Dlg 001 ; defaut sur Sortir
/gps $did( 111 ).text
}
on *:dialog:Gps.Dlg:edit:111:{
if ( !$did( 111 ).text ) /did -b Gps.Dlg 112,411 ; Disable le button
else /did -e Gps.Dlg 112,411 ; Enable le button
}
on *:dialog:Gps.Dlg:sclick:111:{
if ( !$did( 111 ).text ) /did -b Gps.Dlg 112,411 ; Disable le button
else /did -e Gps.Dlg 112,411 ; Enable le button
}
on *:dialog:Gps.Dlg:sclick:112:{
if ( !$did( 111 ).sel ) /return
%GpsList = $deltok(%GpsList, $findtok( %GpsList, $did( 111 ).text , 1 ,33 ) , 33 )
/did -d Gps.dlg 111 $did( 111 ).sel
/did -c Gps.dlg 111 1
}
on *:dialog:Gps.Dlg:sclick:201:{
/msg %Gps.Active 10,9[GPS] $did( 211 ).text $iif( $did( 221 ).text > 0, Nord:, Sud: ) $remove( $did( 221 ).text, - ) $&
$iif( $did( 231 ).text > 0, Est:, Ouest: ) $remove( $did( 231 ).text, - )
}
on *:dialog:Gps.Dlg:edit:321:{
if ( !$did( 321 ).text ) || ( !$did( 331 ).text ) /did -b Gps.Dlg 301 ; Disable le button
else /did -e Gps.Dlg 301 ; Enable le button
}
on *:dialog:Gps.Dlg:edit:331:{
if ( !$did( 321 ).text ) || ( !$did( 331 ).text ) /did -b Gps.Dlg 301 ; Disable le button
else /did -e Gps.Dlg 301 ; Enable le button
}
on *:dialog:Gps.Dlg:sclick:301:{
/var %sizex $did(311).text
/var %sizey $did(313).text
/var %scale $did(315).text
/var %posNS $pos( $did( 321 ).text, . )
/var %posEO $pos( $did( 331 ).text, . )
/var %coordNS $left( $did( 321 ).text, $calc( %posNS - 1 ) ) $+ $&
$left( $right( $did( 321 ).text, $calc( $len( $did( 321 ).text ) - %posNS ) ), 4 )
/var %coordEO $left( $did( 331 ).text, $calc( %posEO - 1 ) ) $+ $&
$left( $right( $did( 331 ).text, $calc( $len( $did( 331 ).text ) - %posEO ) ), 4 )
/run http://fr.img.maps.yahoo.com/scripts/gcis.dll?sizex= $+ %sizex $+ &sizey= $+ %sizey $+ &XgoSetLogicalScale= $+ %Scale $+ &_XgoPointWGS= $+ %coordEO $+ % $+ 2c $+ %coordNS $+ &_XgoGCAdrWGS= $+ %coordEO $+ % $+ 2c $+ %coordNS $+ &_XgoGCYouAreHereCircleThickness=1&_XgoGCYouAreHereCenterThickness=3&_XgoGCYouAreHereCircleColor=RGB(255,0,0)&_XgoGCYouAreHereCenterColor=RGB(255,0,0)&XgoPageName=XMLOUTFR&XgoAnswer=Bitmap&_XgoScaleMode=0
}
;--------------------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------------------
alias Gps.SockErr {
if ( $SockErr == 4 ) /Gps.Echo Vous n'etes pas connecté.
else /Gps.Echo $sockerr - Petit probleme pour avoir les informations... desolé
/did -ef Gps.Dlg 111 ; Focus sur le text
/did -t Gps.Dlg 101 ; defaut sur recherche
/sockclose GPS
}
on *:sockopen:Gps.Sock:{
if ($sockerr > 0) /Gps.SockErr
else {
%Gps.OQP = $true
/did -r Gps.Dlg 211,221,231, ; Remove le contenue
/did -b Gps.Dlg 301 ; Disable le button
/sockwrite -n Gps.Sock GET http://fr.maps.yahoo.com//?&csz= $+ $did( Gps.Dlg, 111 ).text $+ &country=fr
}
}
on *:sockread:Gps.Sock:{
/var %temp
if ($sockerr > 0) /Gps.SockErr
/sockread -f %temp
while ( $sockbr != 0) {
if ( Mémoriser cette adresse isin %temp ) {
%temp = $right( %temp , $calc( $len( %temp ) - $pos( %temp, city= ) - 4 ) )
%Gps.City = $remove( $left( %temp , $calc( $pos( %temp, % $+ 26 ) - 1) ), %,0,1,2,3,4,5,6,7,8,9 )
%temp = $right( %temp , $calc( $len( %temp ) - $pos( %temp, slt= ) - 3 ) )
/did -ei Gps.Dlg 221,321 1 $left( %temp , $calc( $pos( %temp, % $+ 26 ) - 1) )
%temp = $right( %temp , $calc( $len( %temp ) - $pos( %temp, sln= ) - 3 ) )
/did -ei Gps.Dlg 231,331 1 $left( %temp , $calc( $pos( %temp, % $+ 26 ) - 1) )
%temp = $right( %temp , $calc( $len( %temp ) - $pos( %temp, zip= ) - 3 ) )
/did -ei Gps.Dlg 211 1 %Gps.City $left( %temp , $calc( $pos( %temp, % $+ 26 ) - 1) )
/did -f Gps.Dlg 200 ; Onglet 2
/did -et Gps.Dlg 201 ; Enable button et defaut
/did -e Gps.Dlg 111,301 ; Enable text
/Gps.Echo J'ai trouvé des informations sur %Gps.City $+ .
if ( !$did( Gps.Dlg, 111 ).Sel ) {
%GpsList = $AddTok( %GpsList, $did( Gps.Dlg, 111 ).text, 33 )
/did -i Gps.Dlg 111 $numtok( %GpsList,33) $did( Gps.Dlg, 111 ).text
}
/unset %Gps.OQP
}
/sockread -f %temp
}
}
Conclusion :
Le 20 Nov: Version 2.0
- Version avec Boite de dialogue.
- Un onglet permet de choisir la resolution de la carte et l'echelle.
Merci pour les messages d'encouragement.
Nestor
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.