Jump to content

miguelccarvalho

Member
  • Posts

    8
  • Joined

  • Last visited

Posts posted by miguelccarvalho

  1. Hi,

     

    I'm trying to pass some variables in a workflow. The set-up of the workflow is as follows:

     

    Screen Shot 2017-01-10 at 15.02.10.png

     

    Where the script is 

     

    from datetime import date
    from datetime import timedelta
    import json
    
    today = date.today()
    offset = (today.weekday() - 2) % 7
    last_wednesday = today - timedelta(days=offset)
    
    d = {'alfredworkflow': 
    		{'variables':
        			{'last_wednesday': last_wednesday.strftime('%Y-%m-%d')
    			}
    		}
    	}
    
    print json.dumps(d)

    And the copy to clipboard part is:

     

    SET @startdate = {var:last_wednesday};
    
    SELECT ...

    The issue is the {var:last_wednesday} part is coming up empty and I don't understand why as I've modelled this after another functioning workflow. When pasting I only get

     

    SET @startdate = ;

     

    Does anyone know where the error is?

  2. I wasn't able to replicate this and I think it is because Sequel Pro requires me to hit "Connect" before it starts. 

     

    Re-formulating the problem, I need something that:

    1) Activates Sequel Pro;

    2) Hits "Enter" in the "Connect" button which shows upon opening the app;

    3) Pastes the query;

    4) Runs the query;

    5) Exports to CSV

     

    I added something to the script and it works :)

     

    My keyword is now connected to a Run Script object which contains:

    tell application "Sequel Pro"
        activate
        tell application "System Events"
                keystroke return
            keystroke "v" using command down
            -- wait 1/5th of a second for the paste to complete
            delay 0.2
            keystroke "r" using command down
        end tell
    end tell

    So I'm just missing the export to CSV part as I can't find the keystroke in Sequel Pro for 'Export to CSV'. How can I do that?

     

    Thanks a lot!

     

  3. Hi,

     

    I want my workflow to open Sequel Pro and paste a SQL query directly in the query field (and, ideally, run it and export to CSV). 

     

    As of now, it opens Sequel Pro and gets the query in the clipboard so that I only have to do CMD-V into Sequel Pro. However, I was wondering if there is a way to automate that last part - paste, run query, and export to CSV (all of which would run from inside Sequel Pro).

     

    Is this possible?

     

    EDIT: I've created the query in it's own SQL file so workflow now opens that file with Sequel Pro --> CMD-V part is solved. Still missing Run Query + Export as CSV

  4. Hi,

     

    I'm working on my first workflow. The goal is to connect the Keyword "shifts" to:

    1) Navigating to a specific folder;

    2) Run a python script which is in there (script prompts user for 2 dates in format YYYY-MM-DD)

    3) Enter today's date in the format YYY-MM-DD;

    4) Enter tomorrow's date in the format YYY-MM-DD;

     

    I've managed to do it up to, and including, step 2. However, I don't know how to enter today's date (whichever date today is) programatically in the workflow. I've tested with dummy data (entering two dates in the format) and it works fine so it's just a matter of making it a variable I guess.

     

    Any ideas on how to do this?

    Cheers!

     

     

×
×
  • Create New...