-
1. Re: [AS][CS4] problem with display dialog in repeat loop
SuperMacGuy Oct 7, 2011 8:46 AM (in response to myDwayneSmith)Are you saying that the block
if dsFile = item thisItem of theCalendarList then
item thisItem of CopyFromFlyerList
end if
occurs before any display dialog, or that block is totally skipped and you jump out of the block "if dsCopy is 0 then ..." and onto some other function after that?
Can you just add some log statements, or "tell me to log ..." and have those report something?
-
2. Re: [AS][CS4] problem with display dialog in repeat loop
myDwayneSmith Oct 7, 2011 7:20 PM (in response to SuperMacGuy)Thanks SuperMacGuy
Yes, that's exactly what I'm saying — the "if dsFile..." statement pulls and runs the subroutine from CopyFromFlyerList without a dialog ever appearing.
Of course, I've asked entirely the wrong question. I'm using the display dialog command to work out what the REAL problem is. What I'm really trying to work out is why the repeat loop continues even after "dsFile = item thisItem of theCalendarList".
This portion of the script should only run one subroutine from CopyFromFlyerList and then move on — but after the first subroutine runs, this loop (I think) tries to pull and run another one.
I'll try your log suggestion when I get back to work on Monday.
d.
-
3. Re: [AS][CS4] problem with display dialog in repeat loop
SuperMacGuy Oct 10, 2011 10:15 AM (in response to myDwayneSmith)I'm re-reading your code and I think this is strange:
set thisItem to 0
repeat until (item thisItem of theCalendarList) = dsFile
would expand to:
set thisItem to 0
repeat until (item 0 of theCalendarList) = dsFile
and so this would never repeat? I'm not sure it would run once, getting item 0 won't work in AS. Objective-C arrays work with index starting at 0, but not Applescript. Do you need to start with item 1?
-
4. Re: [AS][CS4] problem with display dialog in repeat loop
myDwayneSmith Oct 11, 2011 3:55 PM (in response to SuperMacGuy)Yeah, thanks SuperMacGuy.
The whole section of code is strange and ridiculous. The problem is actually this:
set CopyFromFlyerList to {my dsWC_CopyFromFlyer(), my dsSS_CopyFromFlyer(), my dsCC_CopyFromFlyer()}
I was trying to put a bunch of subroutine calls into a list and have the script pluck out the correct one. But, and it seems obvious to duncy me now, it's just running those subroutines instead of putting them into a list. So, the script is never actually getting to the repeat loop. It was just coincidence that I was testing it with files that required the first subroutine (that's why it appeared to be working correctly initially).
I've just been trying to simplify the code of a script that works, but I haven't hit gold with this section, so I'm going to revert back to what was working previously.
Thanks for your time SuperMacGuy
Much appreciated
d.

