8 Replies - 853 Views - Last Post: 16 May 2014 - 10:17 AM Rate Topic: -----

#1 PranavBudhwant  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 16-May 14

Need to add a speech program at startup in windows

Posted 16 May 2014 - 09:13 AM

Hello! guys, I am trying to build a program which would start at the start of the computer, so for that when ever the user would run the program the program must get copied in the startup folder of the Windows I guess or anything else so that the program runs as soon as the computer is booted.

I this program would create a .vbs file n the startup, in that vbs file i would write the code for speech. so what the computer would greet you when you switch on the PC.

Here's what I tried:

#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{

FILE *file=fopen("C:\Users\USER\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\welcomespeech.vbs","w");
clrscr();
if (file=='\0')
{
printf("Error Loading File");
}
fputs("Dim speaks,speech\nspeaks=Hello!\nset speech=CreateObject(sapi.voice)\nspeech.Speak speaks",file	);
getch();
}



So my motive behind this code is that, this should create a .vbs file in the startup folder in that vbs file the above code would be written, (Dim speaks,speech\nspeaks=Hello!\nset speech=CreateObject(sapi.voice)\nspeech.Speak speaks) and then the vbs file would execute as soon as the computer starts, and then it would speak "Hello!".

But the problem is that i am not able to create a file in the folder when i run the program the file is not created, i do not get any error but nothing happens as well.

Is This A Good Question/Topic? 0
  • +

Replies To: Need to add a speech program at startup in windows

#2 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 2144
  • View blog
  • Posts: 4,208
  • Joined: 30-May 10

Re: Need to add a speech program at startup in windows

Posted 16 May 2014 - 09:28 AM

I would suggest you figure out how to use the speech API direct from the programming language of your choice, rather than kludge together random bits.

http://msdn.microsof...v=vs.85%29.aspx

Two things.
1. All your \ should be \\
2. main returns an int, not void.
Was This Post Helpful? 1
  • +
  • -

#3 PranavBudhwant  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 16-May 14

Re: Need to add a speech program at startup in windows

Posted 16 May 2014 - 09:34 AM

View PostSalem_c, on 16 May 2014 - 09:28 AM, said:

I would suggest you figure out how to use the speech API direct from the programming language of your choice, rather than kludge together random bits.

http://msdn.microsof...v=vs.85%29.aspx

Two things.
1. All your \ should be \\
2. main returns an int, not void.

Salem I am a amateur programmer, I have been learning C form the last month and this is what I have learned so far! so i am not able to learn the speech API, but i have figured out how the speech works, and i have also created the vbs file directly, and it works I just need a program so that anyone can just run the program and the computer would welcome them!

Thanks for your support, but could you help me regarding the same?
Was This Post Helpful? 0
  • +
  • -

#4 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 2144
  • View blog
  • Posts: 4,208
  • Joined: 30-May 10

Re: Need to add a speech program at startup in windows

Posted 16 May 2014 - 09:39 AM

Do you want to learn how to program, or just perform a limited set of quick magic tricks?

Because you're moving far too fast to actually learn anything useful.
Was This Post Helpful? 0
  • +
  • -

#5 PranavBudhwant  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 16-May 14

Re: Need to add a speech program at startup in windows

Posted 16 May 2014 - 09:51 AM

View PostSalem_c, on 16 May 2014 - 09:39 AM, said:

Do you want to learn how to program, or just perform a limited set of quick magic tricks?

Because you're moving far too fast to actually learn anything useful.

Yes of course I want to learn how to program, but what is the use of writing programs that are of no use? So, I believe that we have to write useful programs.
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13965
  • View blog
  • Posts: 55,749
  • Joined: 12-June 08

Re: Need to add a speech program at startup in windows

Posted 16 May 2014 - 09:59 AM

I believe the point salem_c is trying to make is there is a progression to learning, and running past the steps to only blunder around like a lummox in the more moderate to advanced concepts hinders your ability to learn the 'why', you burn more time with errors and problems you could have solved up front with a more solid base, and concepts stick when they have a good context.

Projects are great ways to reinforce what you learned, but some projects are 'more advanced' for a reason.
Was This Post Helpful? 0
  • +
  • -

#7 PranavBudhwant  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 16-May 14

Re: Need to add a speech program at startup in windows

Posted 16 May 2014 - 10:07 AM

View Postmodi123_1, on 16 May 2014 - 09:59 AM, said:

I believe the point salem_c is trying to make is there is a progression to learning, and running past the steps to only blunder around like a lummox in the more moderate to advanced concepts hinders your ability to learn the 'why', you burn more time with errors and problems you could have solved up front with a more solid base, and concepts stick when they have a good context.

Projects are great ways to reinforce what you learned, but some projects are 'more advanced' for a reason.

Ok I think you guys are right!
I am kinda moving to far too fast, as I haven't even completed learning C completely. Still I have much to learn, I guess i have to drop this project for now :dontgetit:
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13965
  • View blog
  • Posts: 55,749
  • Joined: 12-June 08

Re: Need to add a speech program at startup in windows

Posted 16 May 2014 - 10:10 AM

Back burner it, but definitely use it as a guiding post to see how much you need to know and what directions to go.
Was This Post Helpful? 0
  • +
  • -

#9 PranavBudhwant  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 16-May 14

Re: Need to add a speech program at startup in windows

Posted 16 May 2014 - 10:17 AM

View Postmodi123_1, on 16 May 2014 - 10:10 AM, said:

Back burner it, but definitely use it as a guiding post to see how much you need to know and what directions to go.

I will for sure!
Thanks for the support.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1