jorgeng Posted April 22, 2010 Share Posted April 22, 2010 I am trying to send sms by a program we in sweden call telia sms i datorn.i have got a string from supplier about what to send and i am trying to do this in autoit with expressions after sendbut it doesn't work.Here it the autoit string i am trying to send but it doesn't work:Run("C:\Program Files (x86)\Sms och mms i datorn Desktop\mw.exe -NewMMS -Number +46111111111 -Text 'hej' -Silent", @SW_HIDE)The program mw.exe is locally installed on my computer.The suppliers description:-------------------------------------------------------------------------------------------------------------Command-line interfaceIt is possible to interact with the desktop client with a command-line interface (CLI).To use the CLI the end-user first needs to install the client and register with a supported MSISDN. Registration is done using the normal GUI wizard.After that the end-user can send SMS by running the desktop messaging client executable with some arguments.Example: mw.exe -NewSMS -Number +1234567890,+9876543210 -Text "testing testing testing" -SilentOption Description-NewSMS Create a new message-Number Comma separated list of recipient numbers -Text The text for the SMS-Silent Do not show the new SMS window, immediately send the message.--------------------------------------------------------------------------------------------Can someone help me get the send string to work? Link to comment Share on other sites More sharing options...
Tvern Posted April 22, 2010 Share Posted April 22, 2010 What error are you getting?if I look at your run command I notice 3 things:1. "C:\Program Files (x86)\Sms och mms i datorn Desktop\mw.exe" seems like a strange path. are you sure there is a folder called "Sms och mms i datorn Desktop"?2. The example uses 2 numbers seperated by a comma, but I can't imagine that's a problem.3. -Text "testing testing testing" uses double quotation thingies -Text 'hej' uses single ones.If autoit doesn't give an error then this isn't realy autoit help as much as "telia sms i datorn help".I'd advise you to try and get some more information on why it is not working by removeing the -Silent and @SW_HIDE option to see what is failing. Link to comment Share on other sites More sharing options...
jorgeng Posted April 22, 2010 Author Share Posted April 22, 2010 (edited) What error are you getting?if I look at your run command I notice 3 things:1. "C:\Program Files (x86)\Sms och mms i datorn Desktop\mw.exe" seems like a strange path. are you sure there is a folder called "Sms och mms i datorn Desktop"?2. The example uses 2 numbers seperated by a comma, but I can't imagine that's a problem.3. -Text "testing testing testing" uses double quotation thingies -Text 'hej' uses single ones.If autoit doesn't give an error then this isn't realy autoit help as much as "telia sms i datorn help".I'd advise you to try and get some more information on why it is not working by removeing the -Silent and @SW_HIDE option to see what is failing.The path under 1 is ok, it's a 64 bit it system.I shall test remove silent and sw_hide. Edited April 22, 2010 by jorgeng Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted April 22, 2010 Share Posted April 22, 2010 You can't skip optional parameters! You probably want the apps path as the working dir. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
jorgeng Posted April 23, 2010 Author Share Posted April 23, 2010 (edited) You can't skip optional parameters! You probably want the apps path as the working dir.I tried that but no success.I tried with:Run("mw.exe -NewMMS -Number +46111111111 -Text 'hej' -Silent","C:\Program Files (x86)\Sms och mms i datorn Desktop")I want to have double quotes in text "hej" but i am not allowed to do that in the compilationand thenShellExecute("mw.exe", "-NewMMS -Number +46111111111 -Text 'hej' -Silent","C:\Program Files (x86)\Sms och mms i datorn Desktop"This fires up the sms client but doesn't put in phone-number and text,It seems that it isn't possible to put in additional parameters in the run command. Edited April 23, 2010 by jorgeng Link to comment Share on other sites More sharing options...
jorgeng Posted April 23, 2010 Author Share Posted April 23, 2010 (edited) I managed to send the sms manually by opening a dos prompt box and put in next commands: When i open dos-prompt it opens in: C:\Users\Dator1 i had to put in dos commands: cd.. cd.. to get to c:\ and then beginning to walk around in directory and put in: cd program files (x86) cd sms och mms i datorn Desktop and then the string: mw.exe -NewSMS -Number +46111111111 -Text 'hej' -Silent with single quotes on 'hej' and it works How do i do this automatic with: #include <Process.au3> $rc = _RunDos("mw.exe -NewSMS -Number +46111111111 -Text 'hej' -Silent") I have to get in the switch directory in the run dos command... Edited April 23, 2010 by jorgeng Link to comment Share on other sites More sharing options...
jorgeng Posted April 23, 2010 Author Share Posted April 23, 2010 (edited) I tried this but nothing happened: #include <Process.au3> $dir = ("C:\Program Files (x86)\Sms och mms i datorn Desktop\") $rc = _RunDos($dir & "mw.exe -NewSMS -Number +411111111111 -Text 'hej' -Silent") How do i put in a directory so rundos can find the mw.exe? Edited April 23, 2010 by jorgeng Link to comment Share on other sites More sharing options...
jorgeng Posted April 23, 2010 Author Share Posted April 23, 2010 I tried this: $rc = _RunDos("C:\Program Files (x86)\Sms och mms i datorn Desktop\mw.exe -NewSMS -Number +461111111111 -Text 'hej2' -Silent") It doesn't work neither. Anyone knowing why it doesn't work? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 23, 2010 Moderators Share Posted April 23, 2010 (edited) No idea on the program you're trying to utilize or if you're calling it with the right command lines. However, keep in mind, it's best to test in a command console before putting your string in Run(). At first glance, I'd say you're not escaping the spaces in the directory string: Global $s_folder = @ProgramFilesDir & "\Sms och mms i datorn Desktop" Global $s_exe = "mw.exe" Global $s_what_to_say = "hej2" Global $s_phone_number = "+461111111111" Global $s_commandline = "-NewSMS -Number " & $s_phone_number & " -Text " & '"' & $s_what_to_say & '" -Silent' Global $i_pid = Run('"' & $s_folder & "\" & $s_exe & '" "' & $s_commandline & '"') If Not $i_pid Then MsgBox(16, "Error", "Chances are your command line is wrong") Else MsgBox(64, "Success", "Ok") EndIfI'm not sure if that will work for you, but the point was more for you to see how I escaped the spaces in the path name. Edited April 23, 2010 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jorgeng Posted April 23, 2010 Author Share Posted April 23, 2010 No idea on the program you're trying to utilize or if you're calling it with the right command lines. However, keep in mind, it's best to test in a command console before putting your string in Run(). At first glance, I'd say you're not escaping the spaces in the directory string: Global $s_folder = @ProgramFilesDir & "\Sms och mms i datorn Desktop" Global $s_exe = "mw.exe" Global $s_what_to_say = "hej2" Global $s_phone_number = "+461111111111" Global $s_commandline = "-NewSMS -Number " & $s_phone_number & " -Text " & '"' & $s_what_to_say & '" -Silent' Global $i_pid = Run('"' & $s_folder & "\" & $s_exe & '" "' & $s_commandline & '"') If Not $i_pid Then MsgBox(16, "Error", "Chances are your command line is wrong") Else MsgBox(64, "Success", "Ok") EndIfI'm not sure if that will work for you, but the point was more for you to see how I escaped the spaces in the path name. Thanks for great coding. Unfortunately i only got ""Error", "Chances are your command line is wrong" Link to comment Share on other sites More sharing options...
jorgeng Posted April 23, 2010 Author Share Posted April 23, 2010 (edited) I did: MsgBox(4096,"Box",$i_pid) after your code and got i_pid to 0. Strange that i can put in commands in dos prompt box and send sms and not being able to do the same by rundos in autoit. Edited April 23, 2010 by jorgeng Link to comment Share on other sites More sharing options...
jorgeng Posted April 25, 2010 Author Share Posted April 25, 2010 I did:MsgBox(4096,"Box",$i_pid)after your code and got i_pid to 0.Strange that i can put in commands in dos prompt box and send sms and not being able to do the same by rundos in autoit. What's wrong?? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 25, 2010 Moderators Share Posted April 25, 2010 Show the exact string you put in the command prompt that works. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jorgeng Posted April 26, 2010 Author Share Posted April 26, 2010 (edited) Show the exact string you put in the command prompt that works.When i open dos-prompt it opens in:C:\Users\Dator1i had to put in dos commands:cd..cd..to get to c:\ and then beginning to walk around in directory and put in:cd program files (x86)cd sms och mms i datorn Desktopand then the string:mw.exe -NewSMS -Number +46111111111 -Text 'hej' -Silent with single quotes on 'hej' and it works-----------------------------------------------------------------So the answer to your question is several strings beginning with cd.. Edited April 26, 2010 by jorgeng Link to comment Share on other sites More sharing options...
jorgeng Posted April 26, 2010 Author Share Posted April 26, 2010 I tried this but it doesn't work neither: #include <Process.au3> $rc = _RunDos("cd..") $rc = _RunDos("cd..") $rc = _RunDos("cd Program Files (x86)") $rc = _RunDos("cd Sms och mms i datorn Desktop") $rc = _RunDos("mw.exe -NewSMS -Number +46111111111 -Text 'hej2'") Is there any way to command stacking the cd commands? Link to comment Share on other sites More sharing options...
99ojo Posted April 26, 2010 Share Posted April 26, 2010 (edited) Hi, jumping on SmOke_N code and did some changes in the command line and the Run Call. I guess there are to much ": Try: Global $s_folder = @ProgramFilesDir & "\Sms och mms i datorn Desktop" Global $s_exe = "mw.exe" Global $s_what_to_say = "hej2" Global $s_phone_number = "+461111111111" ;add a blank before -NewSMS Global $s_commandline = " -NewSMS -Number " & $s_phone_number & " -Text " & '"' & $s_what_to_say & '" -Silent' ;origin: Global $i_pid = Run('"' & $s_folder & "\" & $s_exe & '" "' & $s_commandline & '"') Global $i_pid = Run('"' & $s_folder & "\" & $s_exe & '"' & $s_commandline) ;-)) Stefan Edited April 26, 2010 by 99ojo Link to comment Share on other sites More sharing options...
jorgeng Posted April 26, 2010 Author Share Posted April 26, 2010 Hi, jumping on SmOke_N code and did some changes in the command line and the Run Call. I guess there are to much ": Try: Global $s_folder = @ProgramFilesDir & "\Sms och mms i datorn Desktop" Global $s_exe = "mw.exe" Global $s_what_to_say = "hej2" Global $s_phone_number = "+461111111111" ;add a blank before -NewSMS Global $s_commandline = " -NewSMS -Number " & $s_phone_number & " -Text " & '"' & $s_what_to_say & '" -Silent' ;origin: Global $i_pid = Run('"' & $s_folder & "\" & $s_exe & '" "' & $s_commandline & '"') Global $i_pid = Run('"' & $s_folder & "\" & $s_exe & '"' & $s_commandline) ;-)) Stefan Thanks. I tired it, and did a messagebox about programfiles and maybe it is that that is wrong. Msgbox says programfiles is: c:\Program Files\Sms och Mms i Datorn in reality the programfiles is C:\Program Files (x86) so how do i change to correct program files in code? Link to comment Share on other sites More sharing options...
99ojo Posted April 26, 2010 Share Posted April 26, 2010 (edited) Hi, change Global $s_folder = @ProgramFilesDir & "\Sms och mms i datorn Desktop" to Global $s_folder = "C:\Program Files (x86)\Sms och mms i datorn Desktop" or Global $s_folder = EnvGet ("ProgramFiles(x86)") & "\Sms och mms i datorn Desktop" ;-)) Stefan Edited April 26, 2010 by 99ojo Link to comment Share on other sites More sharing options...
jorgeng Posted April 26, 2010 Author Share Posted April 26, 2010 Hi,change Global $s_folder = @ProgramFilesDir & "\Sms och mms i datorn Desktop"toGlobal $s_folder = "C:\Program Files (x86)\Sms och mms i datorn Desktop"orGlobal $s_folder = EnvGet ("ProgramFiles(x86)") & "\Sms och mms i datorn Desktop";-))StefanThanks you did it and it now works...I can now send sms to my phone from autoit script. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now