• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Still, script won't run on an older iMac.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Still, script won't run on an older iMac.


  • Subject: Re: Still, script won't run on an older iMac.
  • From: KOENIG Yvan <email@hidden>
  • Date: Sat, 23 Oct 2010 16:23:17 +0200

repeat
try
name of window 1
exit repeat
on error
delay 1
end try
end repeat

Enter a try / end try block
try to get the name of the document's window
if the instruction behaves flawlessly, the document is open, exit the loop
if the document isn't completely opened, 
the instruction issue an error so wait one second then 
repeat until end of the open process.

At first try, without this loop, I got an error.
I inserted a wait instruction an it behaved flawlessly
so I decided to insert a loop waiting the required time, quite no more

I assumed that Graphic Converter was not already open with an open window.
I my assumption is wrong, a slightly enhanced code is required :

on open (droppedItems)
set destFldr to "" & (path to documents folder) & "scaled_picture_folder_Originals:"
set the text item delimiters of AppleScript to {""}
tell application "Finder" to open destFldr
repeat with aFile in droppedItems
set theFile to (aFile as string)
if theFile ends with ":" then
set theName to item -2 of my decoupe(theFile, ":")
else
set theName to item -1 of my decoupe(theFile, ":")
end if
set destFile to destFldr & theName


display dialog theName as string


tell application "GraphicConverter"
activate
set nbw to count of windows
open {alias theFile}
repeat
if (count of windows) > nbw then
exit repeat
else
set nbw to count of windows
delay 1
end if
end repeat
save window 1 in (destFile as string)
beep
close window 1
end tell
end repeat
end open

--=====

on decoupe(t, d)
local oTIDs, l
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to oTIDs
return l
end decoupe

--=====

CAUTION
In my late message I made a wrong copy paste so I left the main error of the original handler.

You wrote (and I left) :
set destFldr to destFldr & theName
…
save window 1 in (destFldr as string)

which gave :
1st file :
the_path_to_store_in:file1.jpg
2nd file :
the_path_to_store_in:file1.jpgfile2.jpg
3rd file :
the_path_to_store_in:file1.jpgfile2.jpgfile3.jpg
…

It must be edited this way :

set destFile to destFldr & theName
…
save window 1 in (destFile as string)

which give :
1st file :
the_path_to_store_in:file1.jpg
2nd file :
the_path_to_store_in:file2.jpg
3rd file :
the_path_to_store_in:file3.jpg
…

Yvan KOENIG (VALLAURIS, France) samedi 23 octobre 2010 16:23:16

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Still, script won't run on an older iMac.
      • From: Robert Poland <email@hidden>
References: 
 >Still, script won't run on an older iMac. (From: Robert Poland <email@hidden>)
 >Re: Still, script won't run on an older iMac. (From: KOENIG Yvan <email@hidden>)
 >Re: Still, script won't run on an older iMac. (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Still, script won't run on an older iMac.
  • Next by Date: Re: Apple Mail ToName Issue
  • Previous by thread: Re: Still, script won't run on an older iMac.
  • Next by thread: Re: Still, script won't run on an older iMac.
  • Index(es):
    • Date
    • Thread