Jump to content

Cedric

Member
  • Posts

    42
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Cedric

  1. I use Logseq as my note-taking application, migrating from Evernote. Unfortunately, Logseq does not have password-protected encrypted text like Evernote had. A different approoach that would serve my need would be to be able to obfuscate any portion of a Logseq note (which are all plain text). It could be into something similar to morse code (like here) or any algorithm that makes it very hard to find the meaning of the text without expending efforts (the barrier is much lower compared to encryption, but this would be enough for my needs). Is there any workflow that addresses this need? If there isn't, how should I approach the design of such workflow? I'm thinking of something very simple, with two options * obfuscate selected text * reverse obfuscation on the selected text. down the lines there could be a choice of obfuscation method, but as a starting point, even one option is enough. Thanks in advance.
  2. Unsure if it's the workflow or a gap in Alfred's framework, but thumbnail navigation is less useful than normal Alfred browsing when it comes video, as it doesn't show any preview. Thumbnail navigation Alfred's normal navigation
  3. I tried it before posting here, and it showed me only 5 screenshots and wouldn't show me more in my tests. Thumbnail navigation works perfectly for that purpose. Given that TN seemed to be the successor of RecentlyAdded with additional features, I focused on understanding what it could do instead of trying the navigate the issues in a different workflow. I've also tested it before posting here (I do try to do my homework, I promise), and what it did was give me a mix of recent screenshots and downloads in the same visual list, invoked from the same keyword. But I don't want to mix the two, i want to be able to invoke one or the other using a folder specific keyword (scr for screenshot, rdn for download). Thanks! That's great reassurance.
  4. Thank you so much for the Recently Added workflow. I can now go back to my usual rdn to find recent downloads. And I use Thumbnail navigation for recent screenshots by modifying the fast entry keywork to "screenshots" and the fast entry folder to the screenshot folder. I think browsing visually the recently downloaded is not adding much value, so the two workflows work best for their respective use cases. I am a tad worried about future updated to Alfred though, given that you recommend replacing RecentlyAdded with Thumbnail Navigation. Any way to get an for more than one fast entries and a choice for a thumbnail vs list presentation of the results? Thanks!
  5. I've been a long time user of the RecentlyAdded workflow, and as I was cleaning up my list of workflow, I uninstalled it by mistake. I saw on the forum that this Thumbnail navigation is now the recommended workflow for the use cases covered by RecentlyAdded. I also couldn't find the RecentlyAdded workflow on your Github, so now I wonder if the following workflow is possible using Thumbnail nav: type keyword matching a specific folder (scr for screenshots for folder, rdn for download folder) get a list of the files from that folder sorted by last added/updated (ideally the screenshots would use thumbnails, but the downloads would be a basic list). optionally filter the file by typing part of their name if needed action the file of my choosing Thanks in advance for the pointers.
  6. Context I am trying to create a simple workflow which outputs a list of common git commands with a basic explainer in the subtext. To import my list I created the following csv file "git config","Set configuration options such as user name and email. It's done once at the setup of git.","git config --global user.name USERNAME" "git init","Create an empty Git repository in the specified directory. Initial step to start a new project.","git init REPO_NAME" "git clone","Create a local copy of a remote repository. Necessary to start working locally on the project.","git clone REPO_URL" "git add","Add files to the staging area in preparation for a commit. Done after making changes to the working directory.","git add FILE_NAME" "git status","Display the state of the working directory and the staging area. It helps to see what changes are staged for commit.","git status" "git commit","Record changes to the repository with a message. This comes before making a pull request.","git commit -m COMMIT_MESSAGE" "git branch","List, create, or delete branches in the repository. Used to work on features or fixes in isolation.","git branch BRANCH_NAME" "git checkout","Switch between branches or restore files to the working directory. Used to switch the context.","git checkout BRANCH_NAME" "git merge","Combine changes from one branch into another. Used to integrate changes made in a branch.","git merge SOURCE_BRANCH" "git pull","Fetch from and integrate with another repository or a local branch. Keep your branch up-to-date with the remote repository.","git pull REMOTE_NAME BRANCH_NAME" "git push","Update remote references along with associated objects. Send your commits to the remote repository.","git push REMOTE_NAME BRANCH_NAME" "git log","Show the commit logs. View the history of the repository.","git log" "git stash","Temporarily save changes that you don’t want to commit immediately. Useful to clean working directory.","git stash save STASH_NAME" "git remote","Manage the set of remotes. Useful for adding remote repositories.","git remote add REMOTE_NAME REMOTE_URL" "git diff","Show changes between the working directory and the index or between two branches. Useful for reviewing code changes.","git diff SOURCE_BRANCH TARGET_BRANCH" The main output is a Copy to Clipboard action. An alternative action is a search to the https://git-scm.com website Problem My problem is that the subtext is too long, so the explanation is truncated. I was then thinking of passing the CSV to the list filter as a series of a series of arguments separated by a newline, allowing me to recapture them on output and sending them to a large type output. Is that possible somehow or do I need to switch to a script filter?
  7. Hello, I have been an avid user of your workflow for years. But I recently upgrated to MacOs 13, and the workflow stopped working. Here is what I get in the debugger: [12:38:09.440] ERROR: RecentlyAdded[Script Filter] Code 126: /Users/cedric/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/9E2D9F43-89B8-461E-ACAD-0AF96EE4D44E: line 1: ./recentlyadded: Permission denied I use the 2022.2 version. Any idea? Thanks!
  8. Hey, Just wanted to say that it works perfectly for me. Thanks so much for the workflow and its beautiful documentation. Best, OSX 10.11.5 El Capitan Macbook Air mid-2011 Alfred 3
  9. Thanks so much for the response, it's so much clearer now. A lot of things weren't obvious to me, like the part about "modelled on the requests library" meaning that it worked exactly the same way. Because I didn't understand how Alfred worked, the part of the code about grabbing the query went over my head, as I didn't understand what the code was doing. Here is why I'm using the print function: my goal with the v0.1 of the workflow was to be able to display (print) very simply the answer to the question "male or female?" I naively thought that I could write a v0.1 my Python script and easily integrate it into Alfred, and iterate from there. Obviously, there are too many hurdles in doing that, so I will: - finalise the script (by making sure my code works when the API returns errors or the like). - integrate it into Alfred by using your library Thanks for the clarification, really. I'm going to post again here when I'm done rewriting the code.
  10. I've already read it twice before posting (along with Alfred-workflow documentation and the bundler code comments and documentation, and other forum posts), I do try to do my homework before asking for help! The tutorial does not do exactly what I'm trying to do, as I'm not trying to show a list of posts. It might be why the answer didn't seem so obvious to me. But I guess I'll take a small break and re-read it again, maybe taking a step back will help seeing the answers there. Thanks a lot for your help, sorry if it seemed like I was trying to make your write the tutorial again.
  11. Thanks for the quick reply! About the error in the code I'm not sure I understand what's happening: I tested the code in iPython, and it works. I then tested the worfklow while using fixed values ('Alice Nicolas' instead of '{query}') and it works. When I'm using it with {query} it doesn't work. Here is the error message, for reference: [ERROR: alfred.workflow.action.script] Traceback (most recent call last): File "genderize.py", line 36, in <module> proba = [float(r.json()[p]['probability']) for p in range(len(values))] KeyError: 0 About passing the query I'm not sure I understand exactly how do I pass the query. In the other workflow that I wrote in bash, I knew that scrip.sh word makes 'word' a positional parameter that I can grab in the code. For python, I don't know how to tell Alfred "replace the {query} in the code with my input". I thought it was managed automatically. About the problems with the code I know that my code doesn't work if the API returns errors, I went for a first version that would allow me to test creating a working workflow in Alfred. Once i can do that, I will focus on making the code stronger. I'm a beginner at Python, so I don't have the best practices yet in regards to querying API. About alfred-wofklow It's included in the folder at the moment, but not used. I plan to review the tutorials later to see how I can adapt the code to my needs if I want to complexify the workflow. Working with requests first was a good way to learn a popular Python module that I will probably use in other projects.
  12. Thanks a lot for the tips, and especially for the aliases. pip now works as it should and I successfully installed Requests in the worfklow. I do have a message about pip not being up to date, should I try to update it? It seems to be in the system folder. That said, my workflow still does not work. I tried using the script filter, but Alfred would display fallback options (Google...) before I'm able to finish typing the names. I then tried with the other script object, but nothing happens. If you could give it a look and tell me what's wrong, that would be really helpful. Here is the link. Thanks!
  13. I'm trying to create a Python workflow that would work with the API of https://genderize.io In my Python code I use the "requests" and "collections" modules. The code works as intended when ran through the Python interpreter, but now I don't know how to actually finalize the worfklow and include the dependencies. I tried using the Python dependency bundler, but it didn't seem to work. I tried to pip install inside the workflow folder, but I have the Homebrew related bug with the pip install --target=url. I used a technique which did install requests in the workflow, but I'm not sure how to point to it now. I'm very confused despite my best efforts, and the workflow folders reflect that. Hopefully someone can walk me though the correct steps to do once the code is written and working. Thanks! Here is the workflow: link And the code: #!/usr/bin/env python # encoding: utf-8 #Code under MIT lience, modified from Stack Overflow answers, as listed below: #orlp http://stackoverflow.com/a/19560097 #Aaron Hall http://stackoverflow.com/a/33737067 #metatoaster http://stackoverflow.com/a/25480206 #Ultimate Zero http://stackoverflow.com/a/13224079 import requests from collections import OrderedDict import bundler bundler.init() #1.PREPARING THE QUERY #import Alfred's query query = '{query}' #transform query into a list values = query.split() #format the keys as expect by genderize.io keys = ['name' + '[' + str(i) + ']' for i in range(len(values))] #create the parameters as an ordered dictionary of keys and values, as expected by requests.get() names = OrderedDict([(k, v) for k, v in zip(keys, values)]) #2. SENDING THE QUERY AND FORMATTING THE RESULTS #query the API with the GET request r = requests.get('https://api.genderize.io/', params=names) #define a function to easily access probability. proba = [float(r.json()[p]['probability']) for p in range(len(values))] #define a function to easily access count. count = [int(r.json()[c]['count']) for c in range(len(values))] #define a function to easily access gender. gender = [str(r.json()[g]['gender']) for g in range(len(values))] #3. PROCESSING THE RESULTS #print the results of the query, with some variations linked to the strenght of the guess for r in range(len(values)): if proba[r] >= 0.9: print values[r], 'is most likely', gender[r] elif 0.7 <= proba[r] < 0.9: print values[r], 'is probably', gender[r] elif 0.5 < probar[r] < 0.7: print values[r], 'is maybe', gender[r] else: 'the gender of', values[r], 'is unknown'
  14. Hello, Thanks for this amazing worfklow. I'm a big pocket user (top 1% reader according to their stats) but both the mac app and the firefox extension were failing me (the firefox extension doesn't work when you don't save your history). I'm not sure how the "save link from clipboard" works though. I activated the global shortcut, but nothing much happens. How is it supposed to work? Should the link appear in alfred with the option to "save to pocket"? or does it work in the background with no feedback to the user? By the way, you should mention in the description that users have to set the global hotkey themselves; this is the normal behaviour of Alfred to avoid conflicts with other system hotkeys. Cheers
  15. Could you give me some pointer about how to set the language? I'm not sure where to start to make this happen. Thanks!
  16. I have completely rewritten my workflow to make it work even if the project name contains one or more space. The code doesn't care, and simply checks that a section number is correctly entered. I did as you said as well, and got the .sh script on a dedicated file, using /bin myscript.sh {query} to set the positional parameters. This workflow now works exactly as intended, thank you for your help! #!/bin/bash #code under MIT licence, modified from Stack Overflow, Unix.com and Ask Ubuntu answers, from the users below: #bashist http://stackoverflow.com/a/6968547 #Ignacio Vazquez-Abrams http://stackoverflow.com/a/2210386 #robotronic http://www.unix.com/shell-programming-and-scripting/42417-what-does-mean-double-pipe.html #geirha http://askubuntu.com/a/29596 #the positional parameters are set from Alfred's script filter #test if the last parameter is a valid integer. if [[ ${@: -1} =~ ^[0-9]+$ ]]; then #run the automator workflow. ${@:1:($#-1)} = All parameters but the last; {@: -1} = last parameter automator -D project_name="${@:1:($#-1)}" -D section_number="${@: -1}" folder_cleanup.workflow #If the last parameter was not a valid integer, send a notification else echo 'Incorrect section number? Try again' fi
  17. You're right, my workflow was confused. I now edited the automator workflow and here is the script that Alfred runs. #!/bin/bash arr="{query}" set -- $arr automator -D project_name="$1" -D section_number="$2" /Users/.../Alfred.alfredpreferences/workflows/.../folder_cleanup.workflow And it's working beautifully! This is great, and all the files are in the worfklow so it will work on my other computers. This shows that with even with my limited coding knowledge, I can create interesting workflows, at least for my personal use. I'll definitly think about doing more of them in the future. The mistake that kept me blocked was silly, and I accidentally closed the page while writing about it, which is sillier. So I'll edit this response when I have the time to add the full explanation. A question: is it possible to give the automator function a relative path to the workflow, rather than the absolute one? Second question: My workflow requires two arguments separated by a space (that Alfred recognizes as a single argument with a space inside). How could I modify the script so it tells me if I forgot to put 2 arguments? Maybe counting the number of array items, and using an IF? IF array != 2, echo {error_message}. I understand that the echo becomes another {query} than can be passed to a notification that would show warn the user? Thanks for your help!
  18. This is great, thanks a lot! This is an example I will be able to tweak in the future for similar needs, which is awesome. What I wanted to do was: Be able to find an English function name, with the subtitle showing the description From there, be able to display the French translation of the function, and copy it in the clipboard Additionnaly I would have been able to open the English description webpage of the function using a modifier like ALT+ENTER What I tried to do was: Display the list of functions in Alfred (with their description as subtitle), so I could filter them Display the French translation using a modifier, like CMD Copy the translation using CMD+ENTER This is why I added these to my xml <subtitle mod="cmd">Translation in user selected language</subtitle> <text type="copy">Translation copied in clipboard</text> But it clearly didn't work. What I wish I could do, ideally, would be To be able to set the second language with which I want the worfklow to work (e.g. with a XLANG [language] command) Then be able to search for an English function, with the subtitle showing the description (e.g. with an XL command) From there, be able to show the translation of the function in the user-defined language (via XLANG) and copy it in the clipboard Additionally, the workflow would At step 2, allow me to open a webpage with the English description of the function using a modifier like ALT+ENTERI took into consideration the fact that a 2-step process is hard to do currenly. I saw several worflows (Lastpass, Date Calculator, TimeZones) which allow a specific command to set user-defined parameters that affect other commands, so maybe it's easier that way? Thanks so much for your help.
  19. I resaved the app and saved it as a zip. Maybe Dropbox was doing something funny with it? I don't know why It said it was corrupted. I'm using El Capitan 10.11.3 btw. Did you successfullly use this automator line? I tried all combinations of capital or lower D and with and without quotes, and I had always the same result: The workflow DID skip the part for which I had entered an argument, and successfully started with the second question. But every time it sends me a feedback saying The action "Set Value of variable" wasn't given the correct data The second prompt that appears in the workflow is normally prefilled with the value entered via bash. But every time, I used automator -D, the second prompt does not have the value prefilled, and I get the error message. Thanks so much for following up on this!
  20. I did the initial app in Automator because I have a very limited knowledge of programming (copy/paste level). From there it seemed easier to try something in AppleScript, because they are somewhat related, and AppleScript. I have no special love for AppleScript, so maybe I can try to copy/past some python/ruby stuff. Or should I look at bash? Thanks!
  21. Thanks for your feedback! I'm not sure how the translation would fit there either. The simplest way I thought of would be to have the translation appear in the subtitle when pressing cmd while highligting a function. And pressing the CMD would copy the translated function. It appeared to me that it would be easy to encode this behaviour directly in the XML, which would mean that a CSV/XML converter would be all I needed, as long as I understood how Alfred expect its XML. The optimal way would be to have each function as a potential argument. It would look like: Step 1: Excel 1. ABS 2. ACCRINT Step 2: Excel ABS 1. French translation 2. Spanish translation 3. etc The Packal workflow has this behaviour, as a reference. But I don't have the skills to do that. I used an online CSV/XML converter (a bad one, I need to find a better one), and pasted the first bit of the resulting XML in the workflow. It works somewhat, but the CMD press does nothing so far. So nothing but the CSV, zero line of code. I wasn't sure about the UID, thanks for the tip.
  22. Hello, I managed to get a list of Excel functions with their translations in 15 languages I train people on spreadsheet usage in several languages, so I sometimes have to find the translated version of a function. My idea would be to have a workflow which would: 1. Display the full list of functions with their description 2. Display the translation for a given function in a user selected language 3. Copy the translation to the clipboard Of course, I have no idea on how to do that. I have a csv with all the data here. And I looked up the format Alfred works with, which is XML. It should look like this: <items> <item uid="function" arg="https://support.office.com/en-us/article/ABS-function-3420200f-5628-4e8c-99da-c99d7c87713c" valid="yes" autocomplete="ABS"> <title>ABS</title> <subtitle>Math and trigonometry: Returns the absolute value of a number</subtitle> <subtitle mod="cmd">Translation in user selected language</subtitle> <text type="copy">Translation copied in clipboard</text> </item> <item uid="function" arg="https://support.office.com/en-us/article/ACCRINT-function-fe45d089-6722-4fb3-9379-e1f911d8dc74" valid="yes" autocomplete="ACCRINT"> <title>ACCRINT</title> <subtitle>Financial: Returns the accrued interest for a security that pays periodic interest</subtitle> <subtitle mod="cmd">Translation in user selected language</subtitle> <text type="copy">Translation copied in clipboard</text> </item> </items> I used the workflow template to test this simple schema, but the link doesn't work. I didn't have much hope though, I have no relevant expertise. If someone wants to give it a go, I send you all my gratitude in advance. Thanks!
  23. Thanks for the pointer. Indeed, I could use Alfred to get the filepaths, with something like this: set input to "/Users/Newbie/Desktop/section1_subfolder1 /Users/Newbie/Desktop/section1_subfolder2" -- This is what Alfred sends to the script via {query}. Then I create a list named input, containing POSIX path of all selected folders set AppleScript's text item delimiters to " " set input to every text item of input -- I now ask for the project name and the section number so I can create a new folder called [Project] Section [Section number] display dialog "Project name:" default answer "" set project_name to text returned of result display dialog "Section Number:" default answer "" set section_number to text returned of result (The subfolders do not necessarily have good names, so I have to operate section by section). And then it starts to be way too complicated for my copy/paste skills. . I should now: - select all files across the folders in the input list - rename all files using project_name and a sequential numbering - create a new folder using project_name&"Number"&section_number - move all files in the newly created folder The solutions I found go way over my head, and I haven't been able to even rename some test folders. I would be really grateful for some help here, if possible. Thanks!
×
×
  • Create New...