Page 1 of 1

Get URL from field with link saved in a variable

Posted: Tue Aug 24, 2010 10:13 pm
by tareq_daher
I want to be able to put an FTP url in a field and then use the Get URL to retrieve information from a server

If i say get URL (ftp://username:password@server.com/reco ... &GUsername&"/") it works with no problem, but i want to designate only one field to decide which server to get information from. Example below:

line 1 has this in the "ftplink" field ---> ftp://username:password@server.com

Code: Select all

put line 1 of field "ftplink" of card "starthere" of stack "writing" into curURL
   put curURL
   get URL curURL&"/recordings/"&GUsername&"/"

It does not work when i put it in a variable.

Re: Get URL from field with link saved in a variable

Posted: Wed Aug 25, 2010 1:55 am
by Mark
Dear tareq_daher,

It is interesting that your first example contains brackets around it, but your second doesn't. Add the brackets and it should work.

Code: Select all

get URL (curURL & "/recordings/" & GUsername &"/")
Best,

Mark

Re: Get URL from field with link saved in a variable

Posted: Wed Aug 25, 2010 8:21 am
by FourthWorld
Mark's answer is spot-on, Tareq, and while it may seem unintuitive for an "English-like" language to depend on parentheses now and then, it may help to look at it from the engine's perspective.

When the engine sees this:

get URL curURL&"/recordings/"&GUsername&"/"

..it thinks of it like this:

1. get url cURL
2. then append "/recordings/" to the result
3. and then append gUserName &"/" to it

The parens make it clear to the engine that all of that stuff after "get URL" is to be evaluated as a single string first.

With the parens, the engine thinks of it like this:

1. Concatenate curURL&"/recordings/"&GUsername&"/"
2. Then pass that to "get URL"

HTH -

Re: Get URL from field with link saved in a variable

Posted: Wed Aug 25, 2010 6:43 pm
by tareq_daher
That was exactly my problem, thanks to the both of you. When i was outputting curURL in the message box, it looked just fine with no problems at all. However without the parentheses it did not work. Now i have one field that contains the server information that i use to connect (ftp://servername:password@server.com) , in case i need to access a different server in the future all i need is to change that information.

Do either of you know if SFTP has been introduced into runtime revolution ?

Re: Get URL from field with link saved in a variable

Posted: Wed Aug 25, 2010 8:41 pm
by FourthWorld
SFTP has not yet found its way into the engine, but my understanding is that the team is exploring ways to do that for future versions.

Re: Get URL from field with link saved in a variable

Posted: Wed Aug 25, 2010 11:59 pm
by Mark
Hi tareq_daher ,

Some time ago, I compiled Putty for Windows. You can use this to access an sftp server. The command utilities are available here. On Mac OS X and Linux you can also use the built-in sftp command line utility.

Best regards,

Mark