Download File from the Internet

Hi Folks,

May you can advice on how to solve this issue:

--checks the processor of the mac
set proc to system attribute "sysa"
if button returned of result is "OK" and proc is "2" then
set download to "http://www.t-mobile.at/officetogoSW/Web'n'walk Box comapct(V2_6)PPC.dmg"
set localFile to (choose file name default name "Web'n'walk Box compact(V2_6)PPC.dmg")
do shell script "curl " & quoted form of download & " -o " & quoted form of POSIX path of localFile

This is simply doing nothing. Does anybody has a suggestion?

Thanks for your time,
Stefan

HI Folks,

Solved it by using this:

set theLocation to (path to desktop) as text
set theDownload to theLocation & "Web'n'walk Box compact(V2_6)PPC.dmg"
set theLink to "http://www.t-mobile.at/officetogoSW/Web'n'walk Box compact(V2_6)PPC.dmg"
tell application "URL Access Scripting"
	download theLink to file theDownload
end tell

Thanks for your time.

Stefan

Actually this is working with Script Editor, but when I am trying to put it in my mini-application, I cannot call for the result of “sysa”

set proc to system attribute "sysa" as string

if proc is "2" then
	display dialog "here"
end if

proc = 2 → I am using a PPC

The Display Dialog will not be shown. Has anybody a clue on how to call the proc? Thanks for your help.

Stefan

Hi Folks,

The solution:

if proc is equal to 2 then

end if

Thanks for your time!

Stefan

Another unneeded coercion causing confusion. What’s happening here is:

  1. The value “sysa” is coerced to a string
  2. The system attribute is executed with the resulting string
  3. proc is set to the resulting integer
  4. The resulting integer is compared to a string, and the result is false

If you wanted to coerce the result of the system attribute command, then you would need to use parentheses:

set proc to (system attribute "sysa") as string

Hi Bruce,

thanks for your explanation…

I finally got the correct syntax, but didn’t know why it first didnot work…

Best Regards,

Stefan