CasperJS; opening dynamic url
<p>I am using casperJS to got ta a page and collect an id from the URL, this is what my start function is doing.  I would then like to put the id in to a new url and go there.  </p>

<p>This works for the <code>user</code> var, this is coming in from the terminal. However <code>sid</code> is undefined and not the value I updated it to.</p>

<p>Any help would be appreciated. I am wondering if I found a limitation with casperJS.  please not that this is not the full code (as that is much longer), if you message me I can provide you the whole script. </p>

<pre><code>var user = decodeURIComponent(casper.cli.get(0).replace(/\+/g, ' '))

var sid 
casper.start('https://editor.storify.com/', function() {
    sid = this.getCurrentUrl()
    sid = sid.split('/')[3]
})
casper.thenOpen('https://storify.com/' + sid, function() {
   console.log('lets view the posts')
   console.log(token)
   console.log(sid)
   if (dev)
      this.capture('storeheading.png')   
})
</code></pre>