Hi guys,
Just started learning some applescripts I need help in something regarding "looping (repeat) and naming curFile path"
this is my current code which i created for my Adobe Flash CS3 to automate some process. I want to loop it for several files.
I got an error once the line "set this_path to the POSIX path of this_item" is being runned. I cant loop this process if I cant get the path of the file...right?
I am able to do it in a single time not looping using this codes->
This works perfectly fine looking for the path of file.
I seriously need help. Any professional out there?
Just started learning some applescripts I need help in something regarding "looping (repeat) and naming curFile path"
this is my current code which i created for my Adobe Flash CS3 to automate some process. I want to loop it for several files.
Code:
tell application "Finder"
set dFiles to every file of (choose folder)
repeat with curFile in dFiles
set this_item to curFile
set this_path to the POSIX path of this_item
tell application "Adobe Flash CS3"
activate
end tell
tell application "System Events"
tell process "Adobe Flash CS3"
click the menu item "New..." of the menu "File" of menu bar 1
click the radio button "General" of the first tab group ¬
of window "New Document"
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 36 --Enter
click the menu item "Import to Stage..." of menu 1 of menu item "Import" of menu 1 of menu bar item "File" of menu bar 1 --Import
--key code 15 using command down --Command + R (import)
keystroke "/" using control down
tell window "Untitled-1"
tell sheet 1
set value of text field 1 to this_path
click button 1
end tell
click button 1
end tell
end tell
end tell
end repeat
end tell
I got an error once the line "set this_path to the POSIX path of this_item" is being runned. I cant loop this process if I cant get the path of the file...right?
I am able to do it in a single time not looping using this codes->
Code:
display dialog "Import an image file or a folder of images:" buttons ¬
{"Cancel", "Folder", "Movie"} default button 3
if the button returned of the result is "Folder" then
set this_item to choose folder
else
set this_item to choose file
end if
-- convert the file reference to UNIX style
set this_path to the POSIX path of this_item
tell application "Adobe Flash CS3" to activate
tell application "System Events"
tell process "Adobe Flash CS3"
click the menu item "New..." of the menu "File" of menu bar 1
click the radio button "General" of the first tab group ¬
of window "New Document"
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 126 --Up Arrow
key code 36 --Enter
-- open import dialog
keystroke "r" using {command down}
-- summon path input sheet
keystroke "/" using control down
delay 1
tell window "Untitled-1"
tell sheet 1
tell sheet 1
set value of text field 1 to this_path
click button 1
end tell
click button 1
end tell
end tell
tell window "Import Video"
delay 5
key code 36 --Enter
delay 5
key code 36 --Enter
end tell
end tell
end tell
This works perfectly fine looking for the path of file.
I seriously need help. Any professional out there?