reopen - bug

Hi,
i have a VERY annoying bug in a stay-open Applescript App i wrote. How the bug shows up:

  1. i reopen the App
  2. i execute some commands
    #unexpected :
  3. pause for 3-4 seconds
  4. the “Finder” activates

A snippet from the script ( the script’s structure isn’t strange or complicated )

on reopen
	my run_scripts()
end reopen

on run_scripts()
	set ls to ("A","B","C")
	set ch to choose from list ls default items (item 1 of ls)
	set ch to ch as text
	if ch is "A" then

	else if ch is "B" then

	end
	return
end

No other Applescripts nor Applescript Apps i created suffer from such a similar bug. From where could derive the damn error ? I’m sure it has something to do with the reopen-handler

Hi Joy,

Looks like you should get an error here:

set a to a as text

gl,
kel

sorry, this was my mistake here -i edited the post.

c’mon guys, please help me out with some info ! :slight_smile:

I think you’re using the reopen handler wrong. It’s used for when the app is ALREADY RUNNING and you double click it again. So, you should display a dialog warning the user it’s already active etc. But you are doubling up the process, so I think it’s causing you the trouble.
Check this out:

http://books.google.com/books?id=aTz7AAAAQBAJ&pg=PT188&lpg=PT188&dq=applescript+on+reopen&source=bl&ots=Eijngfb5Ek&sig=rM5Lel1egdA23OdTi93se9t_nzw&hl=en&sa=X&ei=vhGvUtzzOozpkAfm7IDYBA&ved=0CDgQ6AEwAQ#v=onepage&q=applescript%20on%20reopen&f=false

Hi Chris,
i posted only a snippet of the whole script; the script itself IS a stay-open Application. Don’t know why my script activates the “Finder”, because i wrote no code for this in the script.

Uh, Oh.
i found the bug! :smiley:
the culprit was a folder with an attached folder action script.
And my idle-app created some new files in these location.
Now, i’m happy again.