SCalkins Posted January 17, 2018 Share Posted January 17, 2018 (edited) I've recently started receiving an error with a Alfred workflow called "Create New File in Finder" Ruby Code _osa1 = 'tell application \"Finder\" to set insertionLocation to insertion location as alias' _osa2 = 'return POSIX path of insertionLocation' activeFinderPath = (`osascript -e "#{_osa1}" -e "#{_osa2}"`).strip filename = 'untitled' extension = 'txt' if '{query}' == 'help' || '{query}' == '?' system("open", "http://ianisted.co.uk/new-finder-file-alfred-2") exit else if '{query}' && '{query}'.include?(?.) filename = '{query}'.split('.')[0] extension = '{query}'.split('.')[1] end file = [filename, extension].join('.') path = [activeFinderPath, file].join if (File.exists?("#{path}")) exit end template = [extension, extension].join('.') if (File.exists?("templates/#{template}")) system(%[cp "templates/#{template}" "#{path}"]) else system(%[touch "#{path}"]) end end Error Message on Debugger [input.keyword] Processing output of 'action.script' with arg 'testing.txt' [ERROR: action.script] -e:15: warning: string literal in condition Anyone have an ideas? Edited January 17, 2018 by SCalkins Link to comment
GuiB Posted January 17, 2018 Share Posted January 17, 2018 You'll be better to post your problem at the workflow thread to have the discussion there (look at the attached link). But for your question, I think if you change this line: if '{query}' && '{query}'.include?(?.) To: if !'{query}'.empty? && '{query}'.include?(?.) Then I think this will clear your error Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now