Pages

Affichage des articles dont le libellé est AppleScript : UNIX. Afficher tous les articles
Affichage des articles dont le libellé est AppleScript : UNIX. Afficher tous les articles

6 mars 2022

Stockage "Autres"

 

 

 

 

Stockage "Autre". Penser à effacer les instantanés locaux de Time Machine ...

do shell script "tmutil thinlocalsnapshots / 99000000000 4" with administrator privileges

4 déc. 2011

Finder vs System Events vs UNIX

tell application "Finder"
set List1 to the name of every item of startup disk
end tell

tell application "System Events"
set List2 to the name of every item of startup disk
end tell

set List3 to do shell script "ls -a /"

(count of List1) = (count of List2)
--> false

(count of List2) = (count of List3)
--> false

3 mai 2009

AppleScript 1 - UNIX 0

Compte le nombre d'occurences d'un caractère à l'intérieur d'un texte.

AScountChar("hébété", "é")
UNIXcountChar("hébété", "é")

-- Retourne le nombre d'occurence d'un caractère d'un texte.
on AScountChar(theString, charToSearch)
set text item delimiters of AppleScript to charToSearch
set la_liste to text items of theString
set text item delimiters of AppleScript to ""
return (count la_liste) - 1
end AScountChar

Auteur :  Fred;o

-- la même chose en Shell UNIX
on UNIXcountChar(theString, chartoFind)
return (do shell script "echo" & quote & theString & quote & " | tr -cd " & quote & chartoFind & quote & " | wc -c") as number
end UNIXcountChar

>>Ouvrir le script dans l'éditeur