Application Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • thetford
    Forum Member
    • Feb 2005
    • 175

    Application Help

    I’m trying to write a small utility, below are the basic functions of this utility app. I’m trying to learn, so I’ll just ask as I go, but here is the end result of what I am trying to accomplish.

    Application needs to
    A – run in the background at startup.
    B – monitor the users license.
    C – replace activation file with a non-working file in the event that the user discontinues service.
  • thetford
    Forum Member
    • Feb 2005
    • 175

    #2
    first question

    First question, how do I determine if the user has a specific exe file on their PC. I need my app to check if a certain exe is installed on the users computer, if so application runs in the background, if not application closes.

    Comment

    • longedge
      Indigo Rose Customer
      • Aug 2003
      • 2498

      #3
      Check out the File.DoesExist and Folder.DoesExist actions to enable you to do this.

      Comment

      • thetford
        Forum Member
        • Feb 2005
        • 175

        #4
        thanks for the help, I tried that actually, I can't seem to make it work. The folder IS THERE, but it always tells me that it is not found. Thanks in advance.

        here is the code I used:

        does_exist = Folder.DoesExist("_ProgramFilesFolder..\\CM");

        -- Display a dialog telling the user whether or not the folder exists.
        if does_exist then
        Dialog.Message("Notice", "Yes, the folder does exist on your system.", MB_OK, MB_ICONINFORMATION);
        else
        Dialog.Message("Notice", "No, the folder does not exist on your system.", MB_OK, MB_ICONINFORMATION);
        end

        Comment

        • thetford
          Forum Member
          • Feb 2005
          • 175

          #5
          OK, I know what was happing. I have four hard drives on this PC, ALL four harddrives have Program File Folders, so I changed the code to reflect the hard path i.e.

          C:\\Program Files\\CM

          OK now it sees it, but why was it not finding it on the C: drive before? How do I "dynamically" solve this problem?

          Comment

          • longedge
            Indigo Rose Customer
            • Aug 2003
            • 2498

            #6
            The global variable _ProgramFilesFolder gives you the starting point and then you concatenate it with the rest of the path i.e.

            result = Folder.DoesExist(_ProgramFilesFolder.."\\CM");

            You were defining the text _ProgramFilesFolder.. as part of the folder name note the position of the double quotes - HTH
            Last edited by longedge; 02-12-2007, 09:56 AM.

            Comment

            • thetford
              Forum Member
              • Feb 2005
              • 175

              #7
              Thanks for the help lonedge! I have made a lot of progress over the last day. I just love AMS! I suppose I'll have to break down and buy 6.0. It's just hard to justify the purchase, since I only use it on an educational or hobby basis. I also have RealBasic, maybe one day I will figure it out!

              Thanks again

              Comment

              • longedge
                Indigo Rose Customer
                • Aug 2003
                • 2498

                #8
                Originally posted by thetford View Post
                I just love AMS! I suppose I'll have to break down and buy 6.0.
                That makes at least 2 of us then and you are very welcome. AMS is a great piece of software and the help everyone here in the forum gives each other just ices the cake

                Comment

                • thetford
                  Forum Member
                  • Feb 2005
                  • 175

                  #9
                  Yes, I just can't say enough good things about this company. The first thing I bought was SF6.0, I think it was three or four years ago, whenever it was just released. I wrote a Game Modification for Hearts of Iron (by Paradox). This was my first attempt ever at any kind of programming\scripting. It was not that complicated, .csv & text files, graphics, etc.. but I needed an installer for it. After looking around I choose indigo rose. About a year later I bought AMS5.0 & later upgraded it to pro, I have never looked back! IR is the best.

                  A little history about what I'm trying to do. The first thing I did with AMS was write a credit repair self-help CD. I got caught up in an "identity" theft situation that left my credit, well less than great. It took me about two years to get everything straightened out. I took all of my hard earned knowledge & compiled it on a cd - never made any money out of it, but I have a friend that liked the idea, so I turned it over to him & he re-did it completely, actually wrote a program, with add on modules & the works. He didn't make much off it, and decided to cancel it do to rampent software piracy, since I have some history with it, I asked if I could take a stab at a security device that would make it at least too hard for the average joe to work around it. (all has is a serial number for protection)
                  So was born the app I'm working on!

                  After some internet research, I'm wondering about a USB dongle key? Could I buy a usb drive, write an app for it that transfers an activation file when plugged in? Any thoughts?

                  Comment

                  • thetford
                    Forum Member
                    • Feb 2005
                    • 175

                    #10
                    Question

                    the following code gives me the error message: line two, argument 2 must be of string type

                    --check CM file version
                    cm_version = File.GetVersionInfo("C:\\Program Files\\CM\\CM.exe");
                    cm_compatible = String.CompareFileVersions("1.13.3.35", cm_version);

                    Anybody?

                    Comment

                    • thetford
                      Forum Member
                      • Feb 2005
                      • 175

                      #11
                      I'm Stuck

                      OK, I just can't figure out how to get my app to monitor the system processes for another app to run.

                      I just don't understand, what am I missing?

                      Code:
                      key_found = INIFile.GetValue("C:\\Program FIles\\CM\\SM.ini", "PROGRAM", "KEYFOUND");
                      instances_of_file = 0;
                      
                      while key_found == "NO" do
                      --search for process
                      file_to_check_for = "dongle.exe";
                      processes = System.EnumerateProcesses();
                      for j, file_path in processes do
                          file = String.SplitPath(file_path);
                          if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
                              INIFile.SetValue("C:\\Program Files\\CM\\SM.ini", "PROGRAM", "KEYFOUND", "YES");
                              --System.TerminateProcess(j); *original*
                          end
                      end
                      end
                      Basically, I have a small security program on a USB flash drive i.e. "dongle.exe" I need my app to see this process when it starts, and I need it to also see when the program terminates.

                      any help please, I'm stuck!

                      Comment

                      • longedge
                        Indigo Rose Customer
                        • Aug 2003
                        • 2498

                        #12
                        It's best to start new posts for each subject but if you haven't already resolved the other two problems here then -

                        File.GetVersionInfo
                        1. Is only available in AMS5Pro and assuming you have the Pro version.
                        2. Returns a table and not a string.

                        In your ini file problem, is "System.EnumerateProcesses" a function that you have created yourself? If not it's not an action in AMS5 as far as I know.

                        Comment

                        • thetford
                          Forum Member
                          • Feb 2005
                          • 175

                          #13
                          Hmm the System.enumerateProcess code I took from the AMS 6.0 help file (I don't have 6.0, but I kept the help file after the demo expired)

                          Yes, I do have the PRO version.

                          Ok, I guess that I just don't understand tables!

                          Comment

                          • longedge
                            Indigo Rose Customer
                            • Aug 2003
                            • 2498

                            #14
                            Originally posted by thetford View Post
                            Hmm the System.enumerateProcess code I took from the AMS 6.0 help file (I don't have 6.0, but I kept the help file after the demo expired)

                            Yes, I do have the PRO version.

                            Ok, I guess that I just don't understand tables!
                            Well you've shown me at least one of the actions that has been introduced in Vers 6

                            I'd suggest sticking with the helpfile for the version you are using.

                            If you look at the helpfile for File.GetVersionInfo you'll see there are about 12 different elements that could be returned and the first one is .FileVersion so in this code -

                            Code:
                            checkver = File.GetVersionInfo(_ProgramFilesFolder.."\\AutoPlay Media Studio 5.0 Professional\\ams50.exe");
                            fv = checkver.FileVersion
                            will return that first element in the variable fv.

                            Comment

                            • thetford
                              Forum Member
                              • Feb 2005
                              • 175

                              #15
                              Yeah, i go back and forth between help files, the 6.0 file has more content:lol

                              Most of the time the stuff works in 5.0:yes

                              Comment

                              Working...
                              X