[GastForen Programmierung/Entwicklung AppleScript komplexe kopierfunktion

  • Suche
  • Hilfe
  • Lesezeichen
  • Benutzerliste
Themen
Beiträge
Moderatoren
Letzter Beitrag

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

22. Mär 2008, 18:36
Beitrag # 16 von 45
Beitrag ID: #422315
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
hallo hans,

hier dein script. es steht doch nicht bei fachhefte.ch, sondern in diesem forum :red: die frage ist halt, ob es sich so anpassen laesst, dass alle unterordner eines ordners die gewaehlte ordneraktion angehangen bekommen!

cu

hans

p.s. sorry fuer die spaete antwort, bin heut' erst aus dem osterurlaub zurueck gekommen ...


Zitat property scriptPath : ""

on run
    showConfig()
end run

on showConfig()
    if scriptPath is not "" then
        try
            scriptPath as alias
            set dR to button returned of (display dialog ¬
                "Das aktuelle Ordneraktions-Script:
" & scriptPath buttons {"Entfernen", "Ändern", "OK"} default button 3 with icon 1)
            if dR = "Ändern" then
                modConfig()
            else if dR = "Entfernen" then
                set scriptPath to ""
            end if
        on error
            with timeout of 300 seconds
                set dR to button returned of (display dialog ¬
                    "Das aktuelle Ordneraktions-Script kann nicht gefunden werden." buttons ¬
                    {"Abbruch", "Auswählen"} default button 2 with icon 2)
                if dR = "Auswählen" then
                    set scriptPath to (choose file of type "osas" with prompt "Ein Ordneraktions-Script wählen") as Unicode text
                end if
            end timeout
        end try
    else
        set dR to button returned of (display dialog ¬
            "Es ist kein Ordneraktions-Script bekannt." buttons {"Abbruch", "Auswählen"} default button 2 with icon 1)
        if dR = "Auswählen" then
            modConfig()
        end if
    end if
end showConfig

on modConfig()
    with timeout of 300 seconds
        set scriptPath to (choose file of type "osas" with prompt "Ein Ordneraktions-Script wählen") as Unicode text
    end timeout
    showConfig()
end modConfig

on open droppedObject
    set folPath to item 1 of droppedObject as Unicode text
    if folPath ends with ":" then
        tell application "System Events"
            set scriptList to attached scripts folPath
            if scriptList is {} then
                if scriptPath = "" then
                    tell application "Finder" to activate
                    with timeout of 300 seconds
                        set scriptPath to ¬
                            (choose file of type "osas" with prompt "Ein Ordneraktions-Script wählen") as Unicode text
                    end timeout
                else
                    try
                        scriptPath as alias
                    on error
                        tell application "Finder" to activate
                        with timeout of 300 seconds
                            set dR to button returned of (display dialog ¬
                                "Das aktuelle Ordneraktions-Script kann nicht gefunden werden." buttons ¬
                                {"Abbruch", "Auswählen"} default button 2 with icon 2)
                            if dR = "Auswählen" then
                                set scriptPath to ¬
                                    (choose file of type "osas" with prompt "Ein Ordneraktions-Script wählen") as Unicode text
                            end if
                        end timeout
                    end try
                end if
                attach action to folPath using scriptPath
                set folStatus to true
            else
                repeat with i from (count of scriptList) to 1 by -1
                    remove action from folPath using action number i
                end repeat
                set folStatus to false
            end if
        end tell
        if folStatus then
            tell application "Finder" to set label index of folder folPath to 6
        else
            tell application "Finder" to set label index of folder folPath to 0
        end if
    else
        if file type of (get info for file folPath) is "osas" then
            set scriptPath to folPath
        end if
    end if
end open



als Antwort auf: [#422300]
X

komplexe kopierfunktion

Hans Haesler
  
Beiträge gesamt: 5826

23. Mär 2008, 09:23
Beitrag # 17 von 45
Beitrag ID: #422316
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo Hans,

danke für den Code. So habe ich ihn umgeschrieben und ergänzt: Im 'open'-Handler wird der Pfad des Hauptordners gespeichert und geprüft. Und dann sogleich getestet, ob ein Pfad zu einem Script eingetragen ist. Falls nicht, kommt der Dialog, mit welchem ein Ordneraktions-Script gewählt werden kann.

Dann wird mit dem Finder eine Liste der Ordnernamen erzeugt. Anschliessend eine Schleife durch diese Namen. Bei jedem wird der Pfad des aktuellen Ordners zusammengesetzt und das Ordneraktions-Script angehängt. Der Ordner wird mit einer grünen Etikette versehen.

Falls schon ein Ordneraktions-Script angehängt war, dann wird dieses entfernt. Dadurch kann auf einfache Weise von einem Script zum anderen gewechselt werden.

Das Droplet kann konfiguriert werden: Ein Doppelklick auf das Icon öffnet einen Dialog, mit welchem ein Ordneraktions-Script ausgewählt werden kann.

Eine andere Möglichkeit: Anstelle eines Ordners ein Ordneraktions-Script auf das Icon des Droplets ziehen. Dieses merkt sich den neuen Pfad und ist bereit, diesen den anschliessend gedroppten Ordnern zuzuweisen.
Code
property scriptPath : "" 
on run
showConfig()
end run

on showConfig()
if scriptPath is not "" then
  try
  scriptPath as alias
  set dR to button returned of (display dialog ¬
    "Das aktuelle Ordneraktions-Script:
" & scriptPath buttons {"Entfernen", "Ändern", "OK"} default button 3 with icon 1)
  if dR = "Ändern" then
    modConfig()
  else if dR = "Entfernen" then
    set scriptPath to ""
  end if
  on error
  with timeout of 300 seconds
    set dR to button returned of (display dialog ¬
    "Das aktuelle Ordneraktions-Script kann nicht gefunden werden." buttons ¬
    {"Abbruch", "Auswählen"} default button 2 with icon 2)
    if dR = "Auswählen" then
    set scriptPath to (choose file of type "osas" with prompt ¬
      "Ein Ordneraktions-Script wählen") as Unicode text
    end if
  end timeout
  end try
else
  set dR to button returned of (display dialog ¬
  "Es ist kein Ordneraktions-Script bekannt." buttons ¬
  {"Abbruch", "Auswählen"} default button 2 with icon 1)
  if dR = "Auswählen" then
  modConfig()
  end if
end if
end showConfig

on modConfig()
with timeout of 300 seconds
  set scriptPath to (choose file of type "osas" with prompt ¬
  "Ein Ordneraktions-Script wählen") as Unicode text
end timeout
showConfig()
end modConfig

on open droppedObject
set mainPath to item 1 of droppedObject as Unicode text
if mainPath ends with ":" then
  if scriptPath is "" then
  tell application "Finder" to activate
  with timeout of 300 seconds
    set scriptPath to ¬
    (choose file of type "osas" with prompt ¬
      "Ein Ordneraktions-Script wählen") as Unicode text
  end timeout
  else
  try
    scriptPath as alias
  on error
    tell application "Finder" to activate
    with timeout of 300 seconds
    set dR to button returned of (display dialog ¬
      "Das aktuelle Ordneraktions-Script kann nicht gefunden werden." buttons ¬
      {"Abbrechen", "Auswählen"} default button 2 with icon 2)
    if dR = "Auswählen" then
      set scriptPath to ¬
      (choose file of type "osas" with prompt ¬
        "Ein Ordneraktions-Script wählen") as Unicode text
    else
      error number -128
    end if
    end timeout
  end try
  end if
  tell application "Finder"
  set folderList to name of every folder of alias mainPath
  end tell
  repeat with curName in folderList
  set curPath to mainPath & curName
  tell application "System Events"
    set scriptList to attached scripts curPath
    if scriptList is {} then
    attach action to curPath using scriptPath
    set folStatus to true
    else
    repeat with i from (count of scriptList) to 1 by -1
      remove action from curPath using action number i
    end repeat
    set folStatus to false
    end if
  end tell
  if folStatus then
    tell application "Finder" to set label index of folder curPath to 6
  else
    tell application "Finder" to set label index of folder curPath to 0
  end if
  end repeat
else
  if file type of (get info for file mainPath) is "osas" then
  set scriptPath to mainPath
  end if
end if
end open

Aufgepasst: Es ist kein Test eingebaut, welcher sicherstellt, dass der Anwender erstens ein Ordneraktions-Script auswählt, welches sich zweitens im korrekten Ordner liegt ...

Gruss, Hans


als Antwort auf: [#422300]

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

23. Mär 2008, 17:18
Beitrag # 18 von 45
Beitrag ID: #422317
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
das klappt, wie immer :) , spitze! und elegant;-)

ich habe eben auch noch ein script von dir gefunden, das bilder in hoch- und querformate separieren kann. damit koennte ich hier photoshop eventuell als zwischenschritt zur unterscheidung und bemaßung komplett umgehen und unsere online-bilder nach umbenennung und sortierung direkt an intelliTune weiterleiten ...

mal sehen ...

besten dank!

nachtrag:
hab's probiert,
die kombination von "komplexe kopierfunktion" mit sortierung nach hoch- und querformat mit hilfe der image events klappt auch vorzueglich!
Code
on adding folder items to hotFolder after receiving itemList 
    set hFolder to "Macintosh HD:Users:hans:Desktop:test01:querformat:"
    set vFolder to "Macintosh HD:Users:hans:Desktop:test01:hochformat:"
    try
        hFolder as alias
    on error
        with timeout of 300 seconds
            set hFolder to (choose folder with prompt ¬
                "zielordner querformat waehlen.") as Unicode text
        end timeout
    end try
    try
        vFolder as alias
    on error
        with timeout of 300 seconds
            set vFolder to (choose folder with prompt ¬
                "zielordner hochformat waehlen.") as Unicode text
        end timeout
    end try
   
    repeat with aFile in itemList
        set AppleScript's text item delimiters to ":"
        set filePath to aFile as Unicode text
        set baseName1 to text 1 thru 2 of (text item -3 of filePath)
        set baseName2 to text item -2 of filePath
        set oldName to text item -1 of filePath
        set AppleScript's text item delimiters to "."
        if (count of text items of oldName) is greater than 1 then
            set baseName3 to text items 1 thru -2 of oldName
            set curSuff to "." & (text item -1 of oldName)
        else
            set baseName3 to oldName
            set curSuff to ""
        end if
        set newName to baseName1 & "_" & baseName2 & "_" & baseName3
        if (count of newName) is greater than 27 then
            set newName to (text 1 thru 27 of newName) & curSuff
        else
            set newName to newName & curSuff
        end if
        set aFile to aFile as Unicode text
        set curDim to getDim(aFile)
        if curDim is not {} then
            set {x, y} to curDim
            if x is greater than y then
                try
                    tell application "Finder" to duplicate file aFile to folder hFolder with replacing
                    try
                        tell application "Finder" to set name of file oldName of folder hFolder to newName
                    end try
                end try
            else if x is less than y then
                try
                    tell application "Finder" to duplicate file aFile to folder vFolder with replacing
                    try
                        tell application "Finder" to set name of file oldName of folder vFolder to newName
                    end try
                   
                end try
            else
                try
                    tell application "Finder" to duplicate file aFile to folder hFolder with replacing
                    try
                        tell application "Finder" to set name of file oldName of folder hFolder to newName
                    end try
                   
                   
                end try
            end if
        end if
       
       
    end repeat
    set AppleScript's text item delimiters to {""}
end adding folder items to

on getDim(aFile)
    set curDim to {}
    tell application "Image Events"
        launch
        try
            set curImg to open file aFile
            set curDim to dimensions of curImg
            close file aFile
        on error
            try
                close file aFile
            end try
        end try
    end tell
    return curDim
end getDim



als Antwort auf: [#422300]

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

3. Apr 2008, 08:31
Beitrag # 19 von 45
Beitrag ID: #422318
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
ich nochmal ;-)

da mir im praxisbetrieb doch immer dateileichen bleiben, die der finder nicht abarbeitet, habe ich mal ueberlegt die kopier- und umbennaktion auf einen shell-befehl zu bringen.

funzt nur leider nicht!

Code
 
on adding folder items to hotFolder after receiving itemList
    set targetFolder to "AN_Bilder:test_online:"
   
   
    repeat with aFile in itemList
       
       
        set AppleScript's text item delimiters to ":"
       
        set sourceFile to POSIX path of aFile as Unicode text
        set oldName to text item -1 of sourceFile
       
        set baseName1 to text 10 thru 11 of (text item -3 of sourceFile)
        set baseName2 to text item -2 of sourceFile
        set oldName to text item -1 of sourceFile
        set AppleScript's text item delimiters to "."
       
        if (count of text items of oldName) is greater than 1 then
            set baseName3 to text items 1 thru -2 of oldName
            set curSuff to "." & (text item -1 of oldName)
        else
            set baseName3 to oldName
            set curSuff to ""
        end if
        set newName to baseName1 & "_" & baseName2 & "_" & baseName3
        if (count of newName) is greater than 27 then
            set newName to (text 1 thru 27 of newName) & curSuff
        else
            set newName to newName & curSuff
        end if
        try
            set targetFile to POSIX path of (targetFolder & newName)
            do shell script "cp " & sourceFile & " " & targetFile
        end try
       
    end repeat
    set AppleScript's text item delimiters to ""
   
   
end adding folder items to



als Antwort auf: [#422300]

komplexe kopierfunktion

Hans Haesler
  
Beiträge gesamt: 5826

3. Apr 2008, 10:34
Beitrag # 20 von 45
Beitrag ID: #422319
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo Hans,

das kann nicht funktionieren. Der Pfad wird in POSIX path umgewandelt und die text item delimiters sind auf ":" eingestellt.

So wird der Dateiname nicht gefunden, weil in der Textkette die Elemente mit Bruchstrichen getrennt sind, statt mit Doppelpunkten.

Also entweder den text item delimiters ein "/" zuweisen oder die POSIX path-Umwandlung später, vor dem letzten Try-Wickel, vornehmen.

Abgesehen davon, der Shell-Befehl kann die Leichen auch nicht verhindern. Da müsste man nachforschen, woran es liegt.

Gruss, Hans


als Antwort auf: [#422300]

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

3. Apr 2008, 18:11
Beitrag # 21 von 45
Beitrag ID: #422320
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
hallo hans,

nicht verzweifeln ;-)

den obigen code mit "/" hatte ich auch schon, funktionierte aber trotzdem nicht¿

wenn ich kopieren und umbennenen mit dem finder mache, dann werden groessere dateipakete (z.b 50 dateien ah 1 mb) nicht komplett abgearbeitet.
zum einen zwar kopiert, aber nicht umbenannt und zum anderen erscheinen einige dateien garnicht erst im zielordner?
daher dachte ich daran mit do shell zu werkeln ...

cu

hans


als Antwort auf: [#422300]

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

3. Apr 2008, 18:20
Beitrag # 22 von 45
Beitrag ID: #422321
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
o.k. ich hab's :)

geht auf jeden fall viel schneller und bei meinen lokalen tests bisher ohne jegliche "dateileiche"

brauche ich fuer die kopier- und umbennenaktion mit dem shell-befehl jetzt noch eine schleife die bei serverbetrieb (hier kann es schon mal ein paar sekunden dauern bis eine datei ueber die leitung einer aussredaktion fertig geschrieben ist) abchecked ob die datei komplett uebertragen ist, bevor er zupackt, oder weiss der terminal das "aus sich heraus"¿


Code
 
on adding folder items to hotFolder after receiving itemList
    set targetFolder to "Macintosh HD:Users:hans:Desktop:test01:"
   
   
    repeat with aFile in itemList
       
       
        set AppleScript's text item delimiters to "/"
       
        set sourceFile to quoted form of POSIX path of aFile as Unicode text
        set oldName to text item -1 of sourceFile
       
        if (aFile as string) contains "an_" then
            try
                set AppleScript's text item delimiters to "."
               
                if (count of text items of oldName) is greater than 1 then
                    set baseName0 to text items 1 thru -2 of oldName
                    set curSuff to "" & (text 1 thru 3 of text item -1 of oldName)
                else
                    set baseName0 to oldName
                    set curSuff to ""
                end if
               
                if (count of oldName) is greater than 27 then
                    set targetName to (text 1 thru 27 of baseName0) & curSuff
                else
                    set targetName to baseName0 & curSuff
                end if
               
                set targetFile to quoted form of POSIX path of (targetFolder & targetName)
                -- die Datei kopieren und dabei umbenennen
                do shell script "cp " & sourceFile & " " & targetFile
            end try
        else
            if (aFile as string) contains "az_" then
                try
                    set AppleScript's text item delimiters to "."
                   
                    if (count of text items of oldName) is greater than 1 then
                        set baseName0 to text items 1 thru -2 of oldName
                        set curSuff to "" & (text 1 thru 3 of text item -1 of oldName)
                    else
                        set baseName0 to oldName
                        set curSuff to ""
                    end if
                   
                    if (count of oldName) is greater than 27 then
                        set targetName to (text 1 thru 27 of baseName0) & curSuff
                    else
                        set targetName to baseName0 & curSuff
                    end if
                   
                    set targetFile to quoted form of POSIX path of (targetFolder & targetName)
                    -- die Datei kopieren und dabei umbenennen
                    do shell script "cp " & sourceFile & " " & targetFile
                end try
            else
                if (aFile as string) contains "re_" then
                    try
                        set AppleScript's text item delimiters to "."
                       
                        if (count of text items of oldName) is greater than 1 then
                            set baseName0 to text items 1 thru -2 of oldName
                            set curSuff to "" & (text 1 thru 3 of text item -1 of oldName)
                        else
                            set baseName0 to oldName
                            set curSuff to ""
                        end if
                       
                        if (count of oldName) is greater than 27 then
                            set targetName to (text 1 thru 27 of baseName0) & curSuff
                        else
                            set targetName to baseName0 & curSuff
                        end if
                       
                        set targetFile to quoted form of POSIX path of (targetFolder & targetName)
                        -- die Datei kopieren und dabei umbenennen
                        do shell script "cp " & sourceFile & " " & targetFile
                    end try
                else
                    set baseName1 to text 10 thru 11 of (text item -3 of sourceFile)
                    set baseName2 to text item -2 of sourceFile
                    set oldName to text item -1 of sourceFile
                    set AppleScript's text item delimiters to "."
                   
                    if (count of text items of oldName) is greater than 1 then
                        set baseName3 to text items 1 thru -2 of oldName
                        set curSuff to "." & (text 1 thru 3 of text item -1 of oldName)
                    else
                        set baseName3 to oldName
                        set curSuff to ""
                    end if
                    set newName to baseName1 & "_" & baseName2 & "_" & baseName3
                    if (count of newName) is greater than 27 then
                        set newName to (text 1 thru 27 of newName) & curSuff
                    else
                        set newName to newName & curSuff
                    end if
                    try
                        set targetFile to quoted form of POSIX path of (targetFolder & newName)
                        do shell script "cp " & sourceFile & " " & targetFile
                    end try
                   
                end if
            end if
        end if
    end repeat
    set AppleScript's text item delimiters to ""
   
   
end adding folder items to



als Antwort auf: [#422300]

komplexe kopierfunktion

Hans Haesler
  
Beiträge gesamt: 5826

3. Apr 2008, 19:28
Beitrag # 23 von 45
Beitrag ID: #422322
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo Hans,

nun ... das "Nicht-funktionieren" kann zum einen bedeuten, dass das Ergebnis nicht komplett den Erwartungen entspricht. Und zum anderen, dass sich überhaupt nichts tut.

Und letzteres wird bestimmt der Fall sein, wenn die Trenner der Elemente nicht übereinstimmen (":" vs. "/").

Vielleicht wird es etwas bringen, wenn in der Abarbeitungs-Schleife eine Pause eingebaut wird:
---
delay 3
---
Das bedeutet, dass der Finder bei jeder Datei drei Sekunden länger Zeit hat, seinen Job zu erledigen. Vielleicht genügt eine Sekunde, vielleicht sind auch fünf zuwenig ... Das muss mit Testläufen herausgefunden werden.

Gruss, Hans


als Antwort auf: [#422300]

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

3. Apr 2008, 19:57
Beitrag # 24 von 45
Beitrag ID: #422323
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
n'abend hans,

deine antwort hat sich mit meinem letzten posting wohl ueberschnitten!
wenn du aber nochmal reinschaugst, dann siehst du, dass ich noch eine frage zum praxisbetrieb in serverumgebung habe; bzgl. ctr-schleife


als Antwort auf: [#422300]

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

3. Apr 2008, 20:37
Beitrag # 25 von 45
Beitrag ID: #422324
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo -hans-
Ich muss deinem Namensvetter Recht geben. Das mit der POSIX-Wandlung sollte genau überlegt sein. Ich habe mir angewöhnt, in Applescript immer mit Aliasen zu arbeiten und erst unmittelbar direkt im Shell-Befehl die Umwandlung zu POSIX-Path vorzunehmen.
Außerdem würde ich Dir unbedingt empfehlen, dies in dieser Form zu tun:
quoted form of posix path of dasAlias
Dabei schützt das "quoted form" vor Überraschungen durch Sonderzeichen, Leerzeichen, Slashes, etc. in Dateinamen. Das ist ganz wichtig, denn die shell ist ein scharfes Schwert!
Die Sache mit der Abarbeitung von Dateien vor vollendeter Dateiübertragung ist auf Server-Volumes ein altes Problem. Eigentlich soll ja das "after receiving" genau dies verhindern. Tut's aber nicht. Da hilft eigentlich nur ein selbst konstruierter Handler. Ich habe mir deshalb ein On-Idle-Script konstruiert, dass allerdings noch nicht im harten Einsatz getestet ist. Wenn Du Interesse hast, kann ich es hier gern mal posten, und berichten, ob die Problematik damit zu 100% ausgeschlossen ist.
Gruß, H =:o) L G I


als Antwort auf: [#422300]

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

3. Apr 2008, 20:52
Beitrag # 26 von 45
Beitrag ID: #422325
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
n'abend holgi,

wuerd ich mir schon gern mal ansehen und testen:) (wenn's nicht zu kompliziert ist ;-) ) danke fuer die tipps!

ich hab' hier auch noch so'ne schleife bei der ich sagen kann probier es 10 mal oder auch 100 mal die datei anzupacken und wenn sie dann immer noch nicht olé ist, dann ...


als Antwort auf: [#422300]

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

3. Apr 2008, 21:29
Beitrag # 27 von 45
Beitrag ID: #422326
Bewertung:
(2614 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Zitat property hotFolder : ""
property targetFolder : ""
property delayCheck : 15


-- <<<<  IF NOT DEFINED YET, CHOOSE HOTFOLDER & TARGETFOLDER  >>>>
on run
   if hotFolder = "" then
      set hotFolder to choose folder with prompt "Choose your Hot-Folder:"
      if targetFolder = "" then
         set targetFolder to choose folder with prompt "Choose your Target-Folder:"
      end if
   else
      display dialog ¬
         "• HOTFOLDER: " & return & (POSIX path of hotFolder as text) & return & return & ¬
         "• TARGETFOLDER: " & return & (POSIX path of targetFolder as text)
   end if
end run


-- <<<<  CHECK FOR NEW FILES IN HOTFOLDER EVERY __ SECONDS  >>>>
on idle
   if hotFolder is not "" then
      say "check"
      set FILELIST to list files of hotFolder
      if length of FILELIST > 0 then
         repeat with i from 1 to length of FILELIST
            FILEACTION(item i of FILELIST as alias)
         end repeat
      end if
      return delayCheck -- check-interval in seconds
   else
      quit me
   end if
end idle



-- <<<<  REACTION, IF USER TRY TO QUIT THIS SCRIPT-APPLICATION  >>>>
on quit
   activate
   display dialog "Really Quit The Hotfolder-Action?" buttons {"Cancel", "Quit Hotfolder"} default button "Cancel"
   if button returned of result = "Quit Hotfolder" then
      -- place things here to perform them before completion of this script
      continue quit
   end if
end quit



-- <<<<  PROCESS AN MOVE THE FILE, IF COMPLETLY TRANSFERED  >>>>
on FILEACTION(d)
   set size1 to (size of (info for d))
   if (size1 > 0) then
      delay 5
      set size2 to (size of (info for d))
      if (size1 = size2) then

         
      -- OOOOOOOO  PLACE YOUR ACTION HERE  OOOOOOOO
         
         tell application "Finder" to move d to targetFolder
      end if
   end if
end FILEACTION



als Antwort auf: [#422300]

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

3. Apr 2008, 21:57
Beitrag # 28 von 45
Beitrag ID: #422327
Bewertung:
(2614 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Ziemlich am Schluss die eigentliche Aktion einfügen, ansonsten würde nur in den Target-Ordner verschoben werden.
Würde mich freuen, wenn Du's mal einen Praxis-Test machen könntest.
Hatte bislang nicht so recht die Zeit hierzu. Man kann sicher noch einiges verbessern, aber prinzipiell sollte die Grundfunktion so praktikabel sein.
Als "Programm" sichern und zum festlegen der Ordner das Skript einfach starten.


als Antwort auf: [#422300]

komplexe kopierfunktion

Anonym
Beiträge gesamt: 22827

4. Apr 2008, 12:47
Beitrag # 29 von 45
Beitrag ID: #422328
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
hab's gerade mal probiert. nach der abfrage der in/out-folder kommt direkt: wollen sie die applikation schliessen: ok oder cancel. in beiden faellen arbeitet die aktion eingangsdaten aber nicht ab¿

ich machs immer so:

Code
repeat with aFile in itemList 
        set ctr to 0
        set okay to 0
        repeat while okay = 0
           
            ...
                    do shell script "cp " & sourceFile & " " & targetFile
                    set okay to 1
                   
                end try
                set ctr to ctr + 1
                if ctr > 30 then
                    display dialog "Problem mit der Datei
" & (aFile as string) buttons "OK" default button 1 with icon 2
                    exit repeat
                end if



als Antwort auf: [#422300]

komplexe kopierfunktion

TMA
Beiträge gesamt: 399

4. Apr 2008, 14:31
Beitrag # 30 von 45
Beitrag ID: #422329
Bewertung:
(2613 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo Hans und H =:o) L G I,
hier mal ein nützlicher Handler zum kopieren von Daten über die shell:
Code
(* 
    input parameters:
    theSource=Path to file or folder as string (folder with trailing ":" copies only contents of Folder, without the folder itself)
    theDest = path to destination folder or file as string
    overWriteVar = Boolean overwrite an existing file or not
    *)
on duplicateFileUnix(theSource, theDest, overwriteVar)
    log ("*Duplicate File " & theSource & " to " & theDest as string)
    try
        if overwriteVar = false then
            do shell script "cp -Rn " & (quoted form of (POSIX path of theSource)) & " " & (quoted form of (POSIX path of theDest))
        else
            do shell script "cp -R " & (quoted form of (POSIX path of theSource)) & " " & (quoted form of (POSIX path of theDest))
        end if
        tell application "Finder"
            try
                update alias (theDest as string)
            end try
            if theDest ends with ":" then
                set tmpName to name of item (theSource as string) as string
                if exists item (theDest & tmpName as string) then return true
            else
                if exists item (theDest as string) then return true
            end if
           
        end tell
        return false
    on error
        return false
    end try
end duplicateFileUnix


@H =:o) L G I:
den kannst du auch auf deine website stellen.

Gruß
TMA


als Antwort auf: [#422300]
X

Veranstaltungskalender

Hier können Sie Ihre Anlässe eintragen, welche einen Zusammenhang mit den Angeboten von HilfDirSelbst.ch wie z.B. Adobe InDesign, Photoshop, Illustrator, PDF, Pitstop, Affinity, Marketing, SEO, Büro- und Rechtsthemen etc. haben. Die Einträge werden moderiert freigeschaltet. Dies wird werktags üblicherweise innert 24 Stunden erfolgen.

pdf-icon Hier eine kleine Anleitung hinsichtlich Bedeutung der auszufüllenden Formularfelder.

Veranstaltungen
14.05.2024

Online
Dienstag, 14. Mai 2024, 10.00 - 10.30 Uhr

Webinar

Prozessoptimierung ist ein Teamsport! Keine Software und keine Maschine allein kann Ihnen helfen, die Effizienzpotenziale Ihres Betriebes maximal auszuschöpfen. Von der Auftragsannahme über die Vorstufe und den Druck bis hin zur Weiterverarbeitung – alles muss optimal ineinandergreifen. Apropos Weiterverarbeitung – in vielen Druckbetrieben fristet sie in Sachen Prozessoptimierung immer noch ein Schattendasein. Dabei liegen hier mittlerweile die größten Einsparpotenziale! In einem Webinar von Horizon und Impressed erfahren Sie, wie Sie diese Einsparungen realisieren können. Horizon, bekannt für innovative Lösungen in der Druckweiterverarbeitung, bietet mit iCE LiNK eine Workflowlösung für die Weiterverarbeitung. iCE LiNK überwacht, visualisiert und analysiert Produktionsabläufe und unterstützt bei der Wartung – damit immer alles reibungslos läuft. Den gleichen Anspruch hat der von Impressed entwickelte Impressed Workflow Server – er ist die smarte PDF-Workflow-Lösung für Druckereien, die Datenmanagement, Preflight und Produktionssteuerung übernimmt. Im Webinar zeigen Ihnen die Experten von Horizon und Impressed, wie beide Lösungen im Team die Effizienz und Produktivität Ihres Betriebes steigern können. Melden Sie sich am besten gleich an, wir freuen uns auf Sie! PS: Melden Sie sich in jedem Fall an – sollten Sie zum Termin verhindert sein, erhalten Sie die Aufzeichnung.

kostenlos

Ja

Organisator: Impressed / Horizon

https://www.impressed.de/schulung.php?c=sDetail&sid=327

Einsparpotenziale in der Weiterverarbeitung
Veranstaltungen
16.05.2024

Online
Donnerstag, 16. Mai 2024, 10.00 - 10.30 Uhr

Webinar

Komplizierte, kleinteilige Aufträge; alles sehr speziell; seit Jahren bewährte Prozesse – da können wir nichts standardisieren und automatisieren! Das sagen viele Großformatdrucker – aber stimmt das wirklich, ist dem tatsächlich so? Günther Business Solutions und Impressed treten in einem Webinar den Gegenbeweis an. Experten beider Unternehmen zeigen, wie Großformatdrucker vom Einsatz zweier bewährter Lösungen profitieren können: • von advanter print+sign von Günther Business Solutions, dem ERP-System für den Großformatdruck, dass alle Phasen der Wertschöpfung im Large Format Printing abdeckt • von Impressed Workflow Server, der smarten PDF-Workflow-Lösung für Druckereien, die Datenmanagement, Preflight und Produktionssteuerung übernimmt Über die Kombination beider Lösungen können Großformatdrucker ihre Prozesse mit modernen Workflows Schritt für Schritt automatisieren – und so zügig deutliche Zeit- und Kosteneinsparungen realisieren. Das Webinar sollten Sie sich nicht entgehen lassen – damit Sie keine Effizienzpotenziale mehr liegen lassen. Melden Sie sich am besten gleich an, wir freuen uns auf Sie! PS: Melden Sie sich in jedem Fall an – sollten Sie zum Termin verhindert sein, erhalten Sie die Aufzeichnung.

kostenlos

Nein

Organisator: Impressed / Günther Business Solutions

https://www.impressed.de/schulung.php?c=sDetail&sid=326

Und es geht doch: Automatisierung im Großformatdruck!