[RÉSOLU] Créer un fichier de type Adresse Internet du Web (.webloc) |
Bienvenue invité ( Connexion | Inscription )
[RÉSOLU] Créer un fichier de type Adresse Internet du Web (.webloc) |
22 Feb 2024, 15:50
Message
#1
|
|
Macbidouilleur de bronze ! Groupe : Membres Messages : 311 Inscrit : 17 Oct 2006 Lieu : Strasbourg, France Membre no 70 694 |
Salut,
J'arrive à créer un fichier et écrire dedans mais ça ne fonctionne pas correctement. Seul Safari peut ouvrir ce type de fichier. Qu'est-ce qui cloche dans le code suivant ? Merci Code tell application "Finder"
set myNAME to "apple" set myURL to "http://www.apple.com" set the myFILE to ((path to downloads folder) as text) & myNAME make new file at ((path to downloads folder)) with properties {name:myNAME, file type:"ilht", creator type:"MACS"} open for access file the myFILE with write permission write (myURL) to file the myFILE starting at eof close access file the myFILE end tell Ce message a été modifié par clarusad - 22 Feb 2024, 18:21. |
|
|
22 Feb 2024, 18:20
Message
#2
|
|
Macbidouilleur de bronze ! Groupe : Membres Messages : 311 Inscrit : 17 Oct 2006 Lieu : Strasbourg, France Membre no 70 694 |
Pour que ça fonctionne, il faut déjà ajouter l'extension .webloc au nom de fichier ; ensuite il semble qu'il faille écrire { URL = "https://www.apple.com"; } à l'intérieur du fichier. Voilà le code final :
Code tell application "Finder"
set myNAME to "apple.webloc" set myTEXT to "{ URL = " & quote & "http://www.apple.com" & quote & "; }" set the myFILE to ((path to downloads folder) as text) & myNAME make new file at ((path to downloads folder)) with properties {name:myNAME, file type:"ilht", creator type:"MACS"} open for access file the myFILE with write permission write (myTEXT) to file the myFILE starting at eof close access file the myFILE end tell Ce message a été modifié par clarusad - 22 Feb 2024, 19:03. |
|
|
Nous sommes le : 25th September 2024 - 00:12 |