Newbie problem

Hello!

I got a problem with my script. I am sure there is something missing or/and wrong, but i cant figure it out by myselfe.
My script looks like this:

display dialog "Skriv inn dato:" default answer "" buttons {"Avbryt", "Ok"} default button 2
set the_number to text returned

set datafile2 to "cp" & the_number & ".sdv"
set datafile3 to "opt" & the_number & ".sdv"

set the target_url2 to "ftp://xxx:xxxx@xxx.xx.xxx.xx/Financial_market/Quotation/" & datafile2
set the destination_file2 to ((path to desktop as string) & "datafile2.sdv")
set the target_url3 to "ftp://xxx:xxxx@xxx.xx.xxx.xx/Reports/Clearing/Sdv/" & datafile3
set the destination_file3 to ((path to desktop as string) & "datafile3.sdv")

tell application "URL Access Scripting"
	download target_url2 to file destination_file2 replacing yes
	download target_url3 to file destination_file3 replacing yes
end tell

I hope you understand what the script is gonna do. But my problem is that i dont know how to insert the date number into datafile2 and datafile3.

Thanks!

The only problem I can see is in the code

display dialog "Skriv inn dato:" default answer "" buttons {"Avbryt", "Ok"} default button 2
set the_number to text returned

Specifically, ‘set the_number to text returned’

text returned of what, exactly?

If, as I assume, you want the text returned from the dialog, you need to be more specific:

 display dialog "Skriv inn dato:" default answer "" buttons {"Avbryt", "Ok"} default button 2
set the_number to text returned of the result

However, to be even more ‘correct’, you should check the result to make sure a) the user entered something, and b) they didn’t click ‘Cancel’:

set the_number to ""
set dialog_reply to display dialog "Skriv inn dato:" default answer "" buttons {"Avbryt", "Ok"} default button 2
if button returned of dialog_reply is "OK" then
    if text returned of dialog_reply is not "" then
       set the_number to text returned of the result
    end if
end if

if the_number is not "" then
    ... rest of your code goes here and will only be run if the user entered some value and clicked OK
   ...

Thanks a lot for the help!