I’m having a problem with my script when trying to choose from a list and then use if then statement to process a file if depending on what is selected. Simply stated, I want a user to select a publication from the list and then the script will process the file depending on what pub is selected. Here’s my script:
on open publish_file
repeat with a_file in publish_file
set allPubs to {"Post Bulletin", "Austin Post Bulletin", "AgriNews", "AutoFinder", "REM", "PB Xpress"}
set Pub to (choose from list allPubs with prompt "Please pick a publication.")
display dialog Pub
-- Post Bulletin
if Pub = "Post Bulletin" then
tell application "Finder"
activate
set file_Name to name of file a_file
set folder_Name to folder of file a_file
move a_file to folder "Publish:PostBulletin"
display dialog "file moved to server"
select folder_Name
move selection to folder "Macintosh HD:PastFolders:Publish Files"
display dialog "file moved to archive"
end tell
else
display dialog "file not moved."
end if
end repeat
end open
When ever I run this, it doesn’t do the lines for the “if then”, it goes to the “else” and does that. What am I missing? I thought this would have been fairly simple but I’m missing something.