Jump to content

Append to file adds a question mark to the {query} placeholder

Recommended Posts

I have a workflow where some AppleScript generates a full path to a .md file, to which I want to append some text. 

The full workflow relies on using the Hook.app, and Vitor Galvao's "Recent Downloads" script (https://github.com/vitorgalvao/alfred-workflows/tree/master/RecentDownloads)


The AppleScript returns a full POSIX File name (i.e: /Users/paul/Projects/wrk/new project/new project) without the file extension, which I store in a variable named "project" 


I then have an "Append To File" action, using {var:project}.md as the file name. 


This works perfectly, except that the file I'm writing to is: 

/Users/paul/Projects/wrk/renew project/renew project?.md

Notice the additional "?"


An earlier iteration of the script output the full name of the file WITH THE EXTENSION from applescript, and the "Append To File" action (using {var:project} as the full file name would write to

/Users/paul/Projects/wrk/renew project/renew project.md?


The weird thing is - if I use a "Display" action, or a "Copy To Clipboard" action on {var:project}, I get the name WITHOUT THE ?. So the interrogation point seems to be added to the "Append to File" action. 


I'm really not sure if it's a bug or if I'm doing something wrong...


Link to comment

@seishonagon I suspect what's happening here is the AppleScript is appending a newline to the output (filename) which is getting naturally translated to a ? in the Append to File filename.


Try adding a Transform utility set to trim after the output of your AppleScript to strip this out, or using something other than AppleScript to create the filename.




Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...