Hi Folks,
may someone can help me solving this issue:
In my application I want to check wheter a file is existent - if not, than a window shall be showed
(with a popup button and a button)…
The main problem:
there is an error in my syntax and I don´t have a clue where:
repeat
tell application "Finder"
if not (exists file "apn.txt" of ((path to me as string) & "Contents:Resources:apn.txt")) then
set nofile to "1"
end if
if nofile is "1" then
show window "countrycode"
end if
if run_file is "1" then exit repeat
-- run_file will be set in the "on click handler"
end tell
end repeat
Error message: Expected end of line but found class name. (-2741)
Thanks for any help!
Best Regards,
Stefan
Hi Stefan,
file “apn.txt” of “…apn.txt” cannot work.
Some notes:
¢ I recommend to avoid AppleScript Studio commands within a tell block.
¢ A boolean value is perfect for any comparison, why do you use a string?
my suggestion
set fileToCheck to ((path to me as Unicode text) & "Contents:Resources:apn.txt")
repeat
tell application "Finder" to set nofile to (exists file fileToCheck)
if nofile then show window "countrycode" -- (this is the same as "if nofile is true then")
if run_file is "1" then exit repeat
-- run_file will be set in the "on click handler"
end repeat
Hi Stefan,
thanks a lot - it is working
But the next problem:
The window which is now showing is not editable - no button can be pressed, no dropdown can be
used…
Do you have an idea on how to solve this? (I know I have only a few informations…)
Thanks for your help,
Stefan