Robert1995

C++ Fun

Apr 3rd, 2011
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.77 KB | None | 0 0
  1. /*
  2.     Created By Rusu Andrei Robert
  3.         Robert1995
  4. */
  5.  
  6. #include <iostream>
  7. #include <fstream>
  8. #include <windows.h>
  9. #include <string>
  10. using namespace std;
  11.  
  12. char cmdtype[3],cmd[1000],ex[1000],order[3];
  13. char alias[1000][100][100];
  14. int she,i,mact,macl,i2;
  15.  
  16. int alias_ex(char trac[3]){
  17.     int i,ict;
  18.     for(i=1;i<=mact;i++){
  19.         if(stricmp(cmd,alias[i][0])==0){
  20.            for(ict=1;alias[i][ict]!="end";ict++){
  21.                ShellExecute(NULL, "open", alias[i][ict] ,NULL, NULL, SW_SHOWNORMAL);
  22.                         }
  23.         }
  24.     }
  25.   return 0;
  26. }
  27. fstream fin("data.txt",ios::in);
  28.  
  29. int main(){
  30.     cout<<"Load Macros ? ";
  31.     cin>>order;
  32.     if(stricmp(order,"yes")==0){
  33.         cout<<"Loading ";
  34.         fin>>mact;
  35.         for(i=1;i<=mact;i++){
  36.             cout<<"*";
  37.             fin>>macl;fin>>alias[i][0];
  38.             for(i2=1;i2<=macl;i2++){
  39.                      fin>>alias[i][i2];
  40.             }
  41.             fin.get();
  42.             strcpy(alias[i][i2],"end");
  43.  
  44.         }
  45.         cout<<endl;
  46.         cout<<"Macro's Loaded ! "<<endl;
  47.     }
  48.     while(cin>>cmdtype>>cmd){
  49.         strcpy(ex,"");
  50.         if(stricmp(cmdtype,"url")==0){
  51.            she=1;
  52.            if(!strstr(cmd,"http://")){
  53.                 strcpy(ex,"http://");
  54.                 strcat(ex,cmd);
  55.            }
  56.         }
  57.         else if(stricmp(cmdtype,"prg")==0){
  58.             she=1;
  59.                 strcpy(ex,cmd);
  60.         }
  61.         else if(stricmp(cmdtype,"sys")==0){
  62.             she=0;
  63.            if(stricmp(cmd,"exit")==0) return 0;
  64.            if(stricmp(cmd,"macro")==0) {cin>>cmd;alias_ex(cmd);}
  65.         }
  66.         cout<<"Executing: "<<cmdtype<<" "<<ex<<endl;
  67.         if(she) ShellExecute(NULL, "open", ex ,NULL, NULL, SW_SHOWNORMAL);
  68.     }
  69.     fin.close();
  70. }
Advertisement
Add Comment
Please, Sign In to add comment