problem with using variables with spaces in them

i am trying to do a simple commands

tell application programVariable
quit
end tell

but this will not work if the variables name has a space

ie:

set programVariable to “Internet Explorer”
tell application programVariable
quit
end tell

this will not work but

set programVariable to “Safari”
tell application programVariable
quit
end tell

but this will. is there any way to put my variable “in quotes” to preserve that space. Or is there something else i need to do?

Are you sure you’re not missing something…spelling, etc.? This worked fine for me…

set programVariable to "Internet Explorer"
tell application programVariable
--activate
quit
end tell

I tried both to activate and to quit with success. If for some reason it’s not still working after making sure it’s all solid, perhaps try…

tell application (programVariable as string)

Otherwise I see nothing wrong with the code.

j

Sounds like jobu has pretty much answered the question, but onemore thing might help. If you put the name of the application directly in the command(ie. you don’t use a variable - tell application “Internet Explorer” …) the script will ask where the application is if it doesn’t recognize the name when you compile it. Sometimes the script needs the version of the application(“Internet Explorer 6.0”) When you choose the application you want Script Editor puts in the name it recognizes. If you still need the variable, you can just cut and paste what Script Editor put. Hope this helps.