why won't this code work?

I have the following code running a command named “jarvis” in macspeech dictate international, on a mac mini running mountain lion. Any help would be greatly appreciated.

tell application “MacSpeech Dictate International”
set to dictation
say “yes sir” using “Alex”
end tell
set cmd to text returned of (display dialog “What do you want to do?” default answer “”)
if cmd = “Launch iTunes” then run iTunesLauncher

set iTunesLauncher to load script file ((Users / porter1 / desktop) & “iTunesLauncher.scpt”)
launch application “iTunes”

Hi,

two problems

¢ load the script iTunesLauncher before running it
¢ AppleScript works with HFS paths (colon separated). POSIX paths (slash separated) are used only in so shell script calls


tell application "MacSpeech Dictate International"
set  to dictation
    say "yes sir" using "Alex"
end tell

set cmd to text returned of (display dialog "What do you want to do?" default answer "")
if cmd = "Launch iTunes" then
	set iTunesLauncher to load script alias ((path to desktop as text) & "iTunesLauncher.scpt")
	run iTunesLauncher
	launch application "iTunes"
end if


The script still doen’t work. When I try to run the script I get the error message

Expected expression but found “to”.

tell application “MacSpeech Dictate International”
set to dictation
say “yes sir” using “Alex”
end tell

set cmd to text returned of (display dialog “What do you want to do?” default answer “”)
if cmd = “Launch iTunes” then
set iTunesLauncher to load script alias ((/Users/porter1/Desktop) & “iTunesLauncher.scpt”)
run iTunesLauncher
launch application “iTunes”
end if

I appreciate the help

googleman76

Probably the error occurs in this line


set  to dictation

I don’t have this dictation software, so please look into its dictionary

I was able to get the script to compile by changing a few things, and am able to run the script but when I type Launch iTunes into the text box I get the following error message.

The variable Users is not defined.

tell application “MacSpeech Dictate International”
set microphone to dictation
say “yes sir” using “Alex”
end tell

set cmd to text returned of (display dialog “What do you want to do?” default answer “”)
if cmd = “Launch iTunes” then
set iTunesLauncher to load script alias ((Users / porter1 / desktop) & “iTunesLauncher.scpt”)
run iTunesLauncher
launch application “iTunes”
end if

Thanks again

googleman76

Users / porter1 / desktop is no valid path because it’s not in double quotes.
But even if it was in quotes it’s no valid path because POSIX paths starts always with a slash.
And even if it started with a slash (and the space characters are deleted) it’s no valid path because
the alias specifier requires a HFS path (colon separated)

Please use the syntax in my first post, path to desktop points to the desktop folder of the current user

Thank you that worked, I really appreciate it. I apologize for my ignorance, Im new to applescript.

googleman76