L'outil de traduction n'est pas en mesure de traduire ce code de travail. Je l'ai copié d'un script de travail.Comment écrire l'applescript suivant dans Obj-C AppScript? ASTranslate était d'aucune aide = (
set pathToTemp to (POSIX path of ((path to desktop) as string))
-- change jpg to pict
tell application "Image Events"
try
launch
set albumArt to open file (pathToTemp & "albumart.jpg")
save albumArt as PICT in file (pathToTemp & "albumart.pict")
--the first 512 bytes are the PICT header, so it reads from byte 513
--this is to allow the image to be added to an iTunes track later.
set albumArt to (read file (pathToTemp & "albumart.pict") from 513 as picture)
close
end try
end tell
Le code prend une image jpg, la conversion à un PICT fichier, puis en lisant le fichier moins l'en-tête (les 512 premiers octets.) Plus tard dans le script, albumArt
sera ajouté à une piste iTunes
J'ai essayé de traduire le code (moins les commentaires), mais ASTranslate gelé pour un bon 2 minutes avant de me donner ceci:
Untranslated event 'earsffdr'
#import "IEGlue/IEGlue.h"
IEApplication *imageEvents = [IEApplication applicationWithName: @"Image Events"];
IELaunchCommand *cmd = [[imageEvents launch] ignoreReply];
id result = [cmd send];
#import "IEGlue/IEGlue.h"
IEApplication *imageEvents = [IEApplication applicationWithName: @"Image Events"];
IEReference *ref = [[imageEvents files] byName: @"/Users/Doom/Desktop/albumart.jpg"];
id result = [[ref open] send];
#import "IEGlue/IEGlue.h"
IEApplication *imageEvents = [IEApplication applicationWithName: @"Image Events"];
IEReference *ref = [[imageEvents images] byName: @"albumart.jpg"];
IESaveCommand *cmd = [[[ref save] in: [[imageEvents files] byName: @"/Users/Doom/Desktop/albumart.pict"]] as: [IEConstant PICT]];
id result = [cmd send];
'crdwrread'
Traceback (most recent call last):
File "objcrenderer.pyc", line 283, in renderCommand
KeyError: 'crdwrread'
'cascrgdut'
Traceback (most recent call last):
File "objcrenderer.pyc", line 283, in renderCommand
KeyError: 'cascrgdut'
'crdwrread'
Traceback (most recent call last):
File "objcrenderer.pyc", line 283, in renderCommand
KeyError: 'crdwrread'
Untranslated event 'rdwrread'
OK
Je n'ai aucune idée de comment donner un sens à cela.
Merci pour toute aide!