Aide sur applescript
Résolu
alexandre 24
Messages postés
3
Date d'inscription
Statut
Membre
Dernière intervention
-
alexandre 24 Messages postés 3 Date d'inscription Statut Membre Dernière intervention -
alexandre 24 Messages postés 3 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'ai essayer de faire un applescript, mais ca n'a pas marcher.
voici le script :(la description est en bas)
tell application "Finder"
display dialog ¬
" What is your internet navigator ? " default answer "Safari"
end tell
set this_application to the text returned of the result
set this_youtube_link to "https://www.youtube.com/"
set this_adress to "https://www.google.com/webhp?gws_rd=ssl"
set this_text to ""
tell application this_application
display dialog "Search on Google" & return & return & ¬
"Enter your search" default answer ""
set this_text to the text returned of the result
get URL this_adress & this_text
end tell
tell application "Finder"
display dialog ¬
"Did you find what you looked for?" default answer "Yes/No"
end tell
if the text returned of the result is this_no then
display dialog "Try on YouTube then ?"
display dialog "YouTube - Broadcast Yourself™" & return & return ¬
default answer this_text
set this_youtube to text returned of result
get URL this_youtube_link & this_youtube
end if
voila desole le script est en anglais...
normalement le script sert a faire une reherche sur google, et si on ne trouve pas, ca nous propose de chercher sur YouTube.
mais ca ne marche pas.
fonctions:
1ere partie
tell application "Finder"
display dialog ¬
" What is your internet navigator ? " default answer "Safari"
end tell
cette partie doit servir a ouvrir une alerte qui dit "What is your default internet navigator" (Quel est votre client internet ?)
la reponce par defaut est Safari mais si je veux je peux mettre firefox , finder etc ...
2eme partie.
set this_application to the text returned of the result
set this_youtube_link to "https://www.youtube.com/"
set this_adress to "https://www.google.com/webhp?gws_rd=ssl"
set this_text to ""
cette partie sert a donner le nom de tous les identifients:
set this_application to the text returned of the result Cette partie va donner a l'identifiant "set_application" le nom de l'application a utiliser
set this_youtube_link to "https://www.youtube.com/" cette partie va donner le lien pour chercher sur youtube
set this_adress to "https://www.google.com/webhp?gws_rd=ssl" idem que this_youtube_link mais pour google
set this_text to "" va donner a l'identifiant la valeur vierge
partie 3:
tell application this_application
display dialog "Search on Google" & return & return & ¬
"Enter your search" default answer ""
set this_text to the text returned of the result
get URL this_adress & this_text
end tell
tell application "Finder"
display dialog ¬
"Did you find what you looked for?" default answer "Yes/No"
end tell
cette partie est la plus complexe.
elle dit a l'application selectioner par l'utilisateur de s'ouvrir et de faire une alerte "Enter your search" (Entrez votre recherche)
ca ouvre l'URL de la recherche sur google,
ca ouvre une fenetre qui dit : "Did you find what you looked for"(Avez vous trouve ce que vous cherchiez?)
Partie 3
if the text returned of the result is this_no then
display dialog "Try on YouTube then ?"
display dialog "YouTube - Broadcast Yourself™" & return & return ¬
default answer this_text
set this_youtube to text returned of result
get URL this_youtube_link & this_youtube
end if
cette derniere partie dit d'ouvrir une alerte (je fais directement la traduction ) "essayer sur you tube alors?"
si l'utilisateur continue, ca ouvre une fenetre qui demande que rechercher sur you tube, et ca commence la recherche sur youtube.
Voila. si vous trouvez une solution, aidez moi!!!
j'ai essayer de faire un applescript, mais ca n'a pas marcher.
voici le script :(la description est en bas)
tell application "Finder"
display dialog ¬
" What is your internet navigator ? " default answer "Safari"
end tell
set this_application to the text returned of the result
set this_youtube_link to "https://www.youtube.com/"
set this_adress to "https://www.google.com/webhp?gws_rd=ssl"
set this_text to ""
tell application this_application
display dialog "Search on Google" & return & return & ¬
"Enter your search" default answer ""
set this_text to the text returned of the result
get URL this_adress & this_text
end tell
tell application "Finder"
display dialog ¬
"Did you find what you looked for?" default answer "Yes/No"
end tell
if the text returned of the result is this_no then
display dialog "Try on YouTube then ?"
display dialog "YouTube - Broadcast Yourself™" & return & return ¬
default answer this_text
set this_youtube to text returned of result
get URL this_youtube_link & this_youtube
end if
voila desole le script est en anglais...
normalement le script sert a faire une reherche sur google, et si on ne trouve pas, ca nous propose de chercher sur YouTube.
mais ca ne marche pas.
fonctions:
1ere partie
tell application "Finder"
display dialog ¬
" What is your internet navigator ? " default answer "Safari"
end tell
cette partie doit servir a ouvrir une alerte qui dit "What is your default internet navigator" (Quel est votre client internet ?)
la reponce par defaut est Safari mais si je veux je peux mettre firefox , finder etc ...
2eme partie.
set this_application to the text returned of the result
set this_youtube_link to "https://www.youtube.com/"
set this_adress to "https://www.google.com/webhp?gws_rd=ssl"
set this_text to ""
cette partie sert a donner le nom de tous les identifients:
set this_application to the text returned of the result Cette partie va donner a l'identifiant "set_application" le nom de l'application a utiliser
set this_youtube_link to "https://www.youtube.com/" cette partie va donner le lien pour chercher sur youtube
set this_adress to "https://www.google.com/webhp?gws_rd=ssl" idem que this_youtube_link mais pour google
set this_text to "" va donner a l'identifiant la valeur vierge
partie 3:
tell application this_application
display dialog "Search on Google" & return & return & ¬
"Enter your search" default answer ""
set this_text to the text returned of the result
get URL this_adress & this_text
end tell
tell application "Finder"
display dialog ¬
"Did you find what you looked for?" default answer "Yes/No"
end tell
cette partie est la plus complexe.
elle dit a l'application selectioner par l'utilisateur de s'ouvrir et de faire une alerte "Enter your search" (Entrez votre recherche)
ca ouvre l'URL de la recherche sur google,
ca ouvre une fenetre qui dit : "Did you find what you looked for"(Avez vous trouve ce que vous cherchiez?)
Partie 3
if the text returned of the result is this_no then
display dialog "Try on YouTube then ?"
display dialog "YouTube - Broadcast Yourself™" & return & return ¬
default answer this_text
set this_youtube to text returned of result
get URL this_youtube_link & this_youtube
end if
cette derniere partie dit d'ouvrir une alerte (je fais directement la traduction ) "essayer sur you tube alors?"
si l'utilisateur continue, ca ouvre une fenetre qui demande que rechercher sur you tube, et ca commence la recherche sur youtube.
Voila. si vous trouvez une solution, aidez moi!!!
2 réponses
Bonjour, alors ton code n'est pas très bon...
Sinon, tu peux aussi passer par la commande shell : Open. En utilisant : do shell script "open " & this_adress & this_text
tell application "Finder" display dialog ¬ " What is your internet navigator ? " default answer "Safari" end tell set this_application to the text returned of the result set this_youtube_link to "https://www.youtube.com/" set this_adress to "https://www.google.com/webhp?gws_rd=ssl" set this_text to "" tell application this_application display dialog "Search on Google" & return & return & ¬ "Enter your search" default answer "" set this_text to the text returned of the result open location (this_adress & this_text as string) end tell tell application "Finder" display dialog ¬ "Did you find what you looked for?" buttons {"Yes", "No"} default button 1 end tell if the button returned of the result is "No" then display dialog "Try on YouTube then ?" display dialog "YouTube - Broadcast Yourself™" & return & return ¬ default answer this_text set this_youtube to text returned of result open location (this_youtube_link & this_youtube as string) end if
Sinon, tu peux aussi passer par la commande shell : Open. En utilisant : do shell script "open " & this_adress & this_text