Trucs & astuces TextWrangler / BBEdit

ManUtopiK

Membre confirmé
15 Juin 2008
60
1
Bonjour,

voici quelques scripts que j'utilise. Peut marcher pour d'autres logiciels.

Ouvrir le fichier en cours dans FireFox :
Bloc de code:
tell application "BBEdit" to set theFile to file of document 1
tell application "Finder" to open theFile using (path to application "Firefox")
Ouvrir le fichier en cours dans FireFox en localhost :
Bloc de code:
tell application "BBEdit" to set theFile to file of document 1
set AppleScript's text item delimiters to "Sites"
set theFile to the last item of every text item of (theFile as string)
set thecommandstring to "echo \"" & theFile & "\"|sed \"s/:/\\//g\"" as string
set theFile to do shell script thecommandstring
set theURL to "http://localhost" & theFile
set thecommandstring to "open -a Firefox \"" & theURL & "\"" as string
do shell script thecommandstring
Rechercher la fonction sélectionnée sur php.net :
Bloc de code:
tell application "BBEdit"
    set Laselection to selection as string
    set thecommandstring to "echo \"" & Laselection & "\"|sed \"s/[=\\/'\\$\\(\\) ]//g\"" as string
    set Laselection to do shell script thecommandstring
    set thecommandstring to "echo \"" & Laselection & "\"|sed \"s/_/-/g\"" as string
    set Laselection to do shell script thecommandstring
    set theURL to "open -a Firefox http://fr.php.net/manual/fr/function." & Laselection & ".php"
    do shell script theURL
end tell
Rechercher la fonction sélectionnée dans le codex WordPress :
Bloc de code:
tell application "BBEdit"
    set Laselection to selection as string
    set thecommandstring to "echo \"" & Laselection & "\"|sed \"s/[=\\/'\\$\\(\\) ]//g\"" as string
    set Laselection to do shell script thecommandstring
    set theURL to "open -a Firefox http://codex.wordpress.org/Function_Reference/" & Laselection
    do shell script theURL
end tell
Effacer les lignes contenant :
Sauvegardez avant de lancer ça !
Bloc de code:
tell application "BBEdit"
    activate
    try
        display dialog "Effacer les lignes contenant :" default answer ""
        process lines containing text 1 of text document 1 matching string text returned of result output options {deleting matched lines:true}
    end try
end tell
Vous avez des astuces, partagez !