Jump to content

create new folder


Recommended Posts

On 2016. 8. 23. at 0:39 AM, Martino1983 said:

Hi, the workflow doesn't work for me (Alfred 3.1). 

The error message is "[2016-08-22 17:34:15][ERROR: action.script] 0:135: execution error: Alfred 3 ha trovato un errore: "j new folder " non è in grado di capire il messaggio “«event alf2Sear»”. (-1708)".

 

Can you help me?
Thanks in advance. 

Martino

 

same here.

it doesn't work with Alfred 3.1 and Sierra

Link to comment
  • 1 month later...
On 10/9/2016 at 4:38 PM, Mahmud Lee said:

 

same here.

it doesn't work with Alfred 3.1 and Sierra

 

I am pretty new to alfred workflows. Can anyone tell me, what this alf2Sear is? Is it an internal handler? Where is it documented? The error seems to appear in this script file: 

 

on run argv
	
	set wf to load script POSIX file (POSIX path of ((POSIX file ((POSIX path of (path to me)) & "/..") as text) & "workflow.scpt" as text) as text)
	set wf to wf's new_workflow_with_bundle("com.sztoltz.newfolder")
	
	set sArgv to argv as text
	set someSource to {}
	
	if sArgv contains tab then
		set {TID, text item delimiters} to {text item delimiters, tab}
		repeat with i from 1 to the number of text items of sArgv
			set end of someSource to text item i of sArgv
		end repeat
		set AppleScript's text item delimiters to TID
	else
		set end of someSource to sArgv
	end if
	
	wf's set_value("alf_files", someSource, "settings.plist")
	tell application "Alfred 3" to «event alf2Sear» "❊ new folder "
	
end run

 

Link to comment
19 hours ago, deanishe said:

It looks like the internal name for the Alfred 2 search command. Change it to tell application "Alfred 3" to search "..."

 

Ah, thank you. That's it - the Workflow works again :)

 

For other readers: You have to change following things to make it working in Alfred 3: 

 

1: in the file workflow.scpt change the numbers marked bold to "3"

 

set my _cache to (my _home) & "/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/" & (my _bundle) & "/"
set my _data to (my _home) & "/Library/Application Support/Alfred 3/Workflow Data/" & (my _bundle) & "/"

 

2: in the file nf_01.scpt change the line 

 

tell application "Alfred 2" to «event alf2Sear» "❊ new folder "

 

to 

 

tell application "Alfred 3" to search " new folder "

Edited by lycopodiopsida
error in code
Link to comment
  • 1 month later...
On 24.11.2016 at 9:34 AM, lycopodiopsida said:

 

Ah, thank you. That's it - the Workflow works again :)

 

For other readers: You have to change following things to make it working in Alfred 3: 

 

1: in the file workflow.scpt change the numbers marked bold to "3"

 

set my _cache to (my _home) & "/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/" & (my _bundle) & "/"
set my _data to (my _home) & "/Library/Application Support/Alfred 3/Workflow Data/" & (my _bundle) & "/"

 

2: in the file nf_01.scpt change the line 

 


tell application "Alfred 2" to «event alf2Sear» "❊ new folder "

 

to 

 

tell application "Alfred 3" to search " new folder "

 

Thanks, I did everything you suggested, but it still does not work for me (Alfred 3.2.1, El Capitan 10.11.6).

 

I get the following message in debug mode, which seems to be odd:

 

[2016-12-30 09:58:38][trigger.action] Processing output of 'action.script' with arg '(

    "/Users/myuser/Desktop/NeuerOrdner/4.txt",

    "/Users/myuser/Desktop/NeuerOrdner/5.txt"

)'

[2016-12-30 09:58:38][ERROR: action.script] 0:169: execution error: Dieses Skript scheint kein AppleScript-Skript zu sein. (-1752)

 

 

The error-message translated to English means "Script doesn’t seem to belong to AppleScript."

 

Apart from changing things suggested, I did not change anything.

 

Does anyone has an idea? Thanks ...

 

Link to comment
9 hours ago, deanishe said:

.scpt files are compiled scripts, i.e. they're not text files. If you save an AppleScript as text, you should use the .applescript extension, not .scpt

 

I did not know that. They appeared to me as normal text files - but that's clear now. Thanks for the explanation, much appreciated!

Link to comment
  • 2 years later...
On 4/20/2013 at 12:11 PM, Carlos-Sz said:

 

David was faster!

 

Anyway, here is my approach considering your suggestion:

 

  • Right now it works as an Alfred File Action only
  • Select the files in Alfred browser, select “To New Folder” action then one of the 3 options below (move, copy or only create a new folder):

tnf_01.png

 

Downlaod now

 

@Carlos-Sz Is there any way you could post your workflow again (re: file action to move files to a new folder)? The previous link no longer works. Thanks for your help!

 

Or, of others have an updated version, that'd be great, too. Thanks!

Link to comment
  • 2 months later...
  • 2 months later...

@Jasondm007 @PurplTentacle @MrShap

 

Hi, I was absent from Alfred (and this forum) for some time, but I am back. Good news: I still have this workflow. Bad news: it is, of course, broken again and due to Applescript being one of the least readable script languages for me, I struggle to identify the problem.

 

I've changed the folder references for Alfred 4 it it now down to the following error in the file nf_01.scpt:
 

[23:42:36.565] ERROR: To New Folder[Run Script] 0:182: execution error: Can’t make file "Macintosh HD:Users:MY_USER:Library:Application Support:Alfred:Alfred.alfredpreferences:workflows:user.workflow.D95456CA-8699-47DE-AF7B-F94C00EC4EBC:nf_01.scpt:..:workflow.scpt" into type file. (-1700)

(ignore the MY_USER, I've removed mine)

 

So, I guess it boils down to the line 3 and the following code part:  & "/.."

 

on run argv
	
	set wf to load script POSIX file (POSIX path of ((POSIX file ((POSIX path of (path to me)) & "/..") as text) & "workflow.scpt" as text) as text)
	set wf to wf's new_workflow_with_bundle("com.sztoltz.newfolder")
	
	set sArgv to argv as text
	set someSource to {}
	
	if sArgv contains tab then
		set {TID, text item delimiters} to {text item delimiters, tab}
		repeat with i from 1 to the number of text items of sArgv
			set end of someSource to text item i of sArgv
		end repeat
		set AppleScript's text item delimiters to TID
	else
		set end of someSource to sArgv
	end if
	
	wf's set_value("alf_files", someSource, "settings.plist")
	tell application "Alfred 4" to search "❊ new folder "
	
end run

I don't have a real idea what this syntax does in AS - I can only assume it should call a script file from another script file. Any help on this one?

Edited by lycopodiopsida
Link to comment
  • 7 months later...
  • 1 month later...
On 4/20/2013 at 8:11 PM, Carlos-Sz said:

 

David was faster!

 

Anyway, here is my approach considering your suggestion:

 

  • Right now it works as an Alfred File Action only
  • Select the files in Alfred browser, select “To New Folder” action then one of the 3 options below (move, copy or only create a new folder):

tnf_01.png

 

Downlaod now

I know it was long time ago but, I can't find anything like it. Would it be possible to relink this file actions. I've tryed the whole internet for this.

Link to comment
  • 6 months later...

Hi there, I played a bit with some of the workflow here, and they didn’t really did it for me. I created this one, inspired by this Envatotuts.

 

The workflow creates predetermined folders.

https://www.dropbox.com/s/q3l16bwzac02fcm/Create folders 0.5.alfredworkflow?dl=0

In this case, it will creates:

_archives
_ressources
Links
Export
> _archives

 

My issue is that the script will fail if my source folder has spaces in it’s name.

 

Here’s the code:

myPath=$(osascript -e 'try' -e 'tell application "Finder"' -e 'set this_folder to (the target of the front window) as alias' -e 'set this_folder to POSIX path of this_folder' -e 'return this_folder' -e 'end tell' -e 'end try' -e 'set this_folder to POSIX path of (path to desktop)' -e 'return this_folder')

cd $myPath
mkdir _archives
mkdir _ressources
mkdir Links
mkdir Export
cd Export
mkdir _archives

Any thoughts?

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...