1 Reply Latest reply on Sep 1, 2011 11:23 PM by IwaoAVE!

    Applescript Calc using cURL - how to insert variables to url

    ChrisClatterbuck

      Title

      Applescript Calc using cURL - how to insert variables to url

      Post

      So I'm trying to download an xml using cURL.  here's what it looks like

      Let (
      [
      lastRecord = "\"" & T24_Import::Entry ID & "\"";
      lastImport = "\"" & T14_PREFERENCES::lastRecord &"\"";
      theDate = "\"" & "xtra" & Filter(Get(CurrentDate)-7;1234567890) & "\""
      ];
      "tell application \"Finder\""
      & ¶ &
      "set myPath to POSIX path of (path to documents folder)"
      & ¶ &
      "end tell"
      & ¶ &
      "do shell script \"/usr/bin/curl -L -o '\"& myPath &" & theDate &" & \".xml' -u HL7U-HSTP-G3CZ-385P:footastic 'https://firstorlando.wufoo.com/api/v3/forms/av-event-request/entries.xml?Filter1=EntryID+Is_greater_than+" & lastImport & " &?Filter2=EntryID+Is_less+than+" & lastRecord & "'\"" )

       

      My problem is with the URL.  I can get the following to work:

      "do shell script \"/usr/bin/curl -L -o '\"& myPath &" & theDate &" & \".xml' -u HL7U-HSTP-G3CZ-385P:footastic 'https://firstorlando.wufoo.com/api/v3/forms/av-event-request/entries.xml?Filter1=EntryID+Is_greater_than+'\" & "& lastImport &""

      and

      "do shell script \"/usr/bin/curl -L -o '\"& myPath &" & theDate &" & \".xml' -u HL7U-HSTP-G3CZ-385P:footastic 'https://firstorlando.wufoo.com/api/v3/forms/av-event-request/entries.xml?Filter1=EntryID+Is_greater_than+767&?Filter2=EntryID+Is_less_than+780"

      My problem is I can't get both variables to work in the url for some reason.  I keep getting "expected end of line"

       

      Any help?

        • 1. Re: Applescript Calc using cURL - how to insert variables to url
          IwaoAVE!

          Hi,

          The formula seems to contain too many extra double quotes.

          Let (
          [
          lastRecord = T24_Import::Entry ID;
          lastImport = T14_PREFERENCES::lastRecord;
          theDate = "xtra" & Filter(Get(CurrentDate)-7;1234567890)
          ];
          "tell application \"Finder\""
          & ¶ &
          "set myPath to POSIX path of (path to documents folder)"
          & ¶ &
          "end tell"
          & ¶ &
          "do shell script \"/usr/bin/curl -L -o '\" & myPath & " & "\"" & theDate & ".xml' -u HL7U-HSTP-G3CZ-385P:footastic 'https://firstorlando.wufoo.com/api/v3/forms/av-event-request/entries.xml?Filter1=EntryID+Is_greater_than+" & lastImport & "&?Filter2=EntryID+Is_less+than+" & lastRecord & "'\""
          )
          
          

          # I think the question mark before 'Filter2' should be removed.

          For easier development and debugging, I would suggest using 'Set Variable' or 'Set Field' script step to verify the resulting string before executing AppleScript.

          Hope this helps,
          Iwao