Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Find name of Windows folder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Find name of Windows folder

    I have a routine that looks for a file in the Windows folder, and aborts the program if it's not there. I use Wise installer to put the file there (Wise knows to put it in whatever the folder is named). Now, I need to know what it's called.

    Good old MS - they call it WINDOWS or WINNT or WIN2000 (there are probably other names), and then the user might rename the folder when re-installing Windows.

    Does anyone know of a way to find the name of the current Windows folder?

    Any help will be greatly appreciated.

    #2
    RE: Find name of Windows folder

    Bill:

    Try the filefind_get() command.

    I hope this helps.

    bob adler

    Comment


      #3
      RE: Find name of Windows folder

      Bill

      I suspect you are trying the find the name of the Windows program folder on a particular computer. This is a problem I hope someone answers as I have pondered the same issue. Microsoft in their "wisdom" uses different folders in each operation system. I guess if you can identify the operation system, you should be able to determine the most likely name used. However, my Win2000 system has both a Windows folder and a WinNT folder. I notice the registry refers to the program folder as an alias, but I haven't found a way to use that in Alpha.

      Jerry

      Comment


        #4
        RE: Find name of Windows folder

        Though I don't have the information at hand, I know there is a Windows API that returns the Windows folder name.

        Comment


          #5
          RE: Find name of Windows folder

          Doesn't Alpha have to know where the windows folder is to use with

          REGISTRY.SAVE_SETTINGS() ?

          Just a question of how to access it.
          There can be only one.

          Comment


            #6
            RE: Find name of Windows folder

            How about the value of variable windir or SystemRoot in the environment as displayed with the SET command at a DOS prompt.

            I'm not sure if this is the same for all current versions of Windows, but it could be. I'm using W2k.

            Al Walker

            Comment


              #7
              RE: Find name of Windows folder

              Bill,

              In line with Bob's suggestion of using filefind.get(), here is a short function which will maybe suffice your needs. I say "maybe" because if your system had a subdirectory named "C:\Whacky\system32" this function would return "Whacky". Thus, some assumptions are built in here.

              '----------
              FUNCTION systemroot AS C ( )
              dim dirs as C
              DIM cfile AS C
              DIM j AS N
              DIM sub_dir AS C

              win_dirs = FileFind.get("C:\W*",FILE_FIND_DIRECTORY)
              systemroot=""

              j=1
              for j = 1 to w_count(win_dirs)
              sub_dir = "C:"+chr(92)+word(win_dirs,j)
              cfile = sub_dir+chr(92)+"system32"
              if file.exists(cfile) then
              systemroot = sub_dir
              END
              end if
              next j

              END FUNCTION
              '----------

              I'm sure that some low-level functions within Alpha are sure to be a reliable means to get the system path but this is a work-around for now.

              Steve

              Comment


                #8
                RE: Find name of Windows folder

                Actually there is no reliable way (that I know of) in V5 to find out the path to the folder that Windows was installed to. And beyond the choices you listed, MS lets you specify any path you want when you install Windows so I could have installed it into c:\MyOS if I wanted to.

                Al Walker has probably come up with the best suggestion. For V6 we've added the ability to read these environment values directly, but that doesn't help you now. For know though you could do something like

                file = "c:\temp.bat"
                batch = "echo %windir% > c:\windir.txt"
                save_to_file(batch,file)
                sys_shell(file)
                windir = get_from_file("c:\windir.txt")
                file.remove(file)
                file.remove("c:\windir.txt")
                ?windir
                = C:\WINDOWS

                -Lenny

                Lenny Forziati
                Vice President, Internet Products and Technical Services
                Alpha Software Corporation

                Comment


                  #9
                  RE: Find name of Windows folder

                  Lenny,

                  Your script works beautifully! Al's suggestion was great.

                  Comment


                    #10
                    RE: Find name of Windows folder

                    Lenny

                    I had to modify the code a little to get it to work in a script, but it does work ok. The little flash of DOS is annoying, but not a big deal.

                    file = "c:\temp.bat"
                    batch = "echo %windir% > c:\windir.txt"

                    save_to_file(batch,file)
                    sys_shell(file)
                    while .not. file.exists("c:\windir.txt")
                    sleep(.01)
                    end while
                    windir = get_from_file("c:\windir.txt")
                    file.remove(file)
                    file.remove("c:\windir.txt")

                    Jerry

                    Comment


                      #11
                      RE: Find name of Windows folder

                      Since it gets the info from the registry (not with std A5 methods), I'm not sure it's a good idea to post the code but attached is an aex file that will pull it without the screen flashing.

                      To install it, just put the .aex file in your "A5v5 program folder>\addins_installed folder and restart a5. To use it, call the function System_root(). (For those not familiar with .aex files, the function name does not need to be the same as the .aex file name. It's only that way in this case because I did it that way.)

                      I've tested it in Win98SE and XP. I'd appreciate confirmation on any other OS. And, if anyone finds a problem with it, please post it and I'll try to fix it.

                      Comment


                        #12
                        RE: Find name of Windows folder

                        Cal

                        I tried it in WinXP with the following results from Alpha Sports

                        ?system_root()
                        ERROR: The system cannot find the file specified.
                        ...c:\program files\a5v5\samples\alphasports\winfldr.reg

                        Jerry

                        Comment


                          #13
                          RE: Find name of Windows folder

                          Cal

                          The problem seems to be the same I saw with Lenny code. The code is looking for the file before it is written. With faster processors and systems, sometimes there needs to be a check to wait until the file is actually written. I am also not sure the registry key you are using will be found on all operating systems. That is one of the limitations that kept me from trying the registry method.

                          Jerry

                          Comment


                            #14
                            RE: Find name of Windows folder

                            Scratch the last statement. I see you are checking registry keys for both Windows and WindowsNT.

                            Jerry

                            Comment


                              #15
                              RE: Find name of Windows folder

                              Jerry:

                              Run the sys_shell with the ,2 parameter and the very brief appearance of the file name on the task bar is hardly noticeable if, indeed, you see anything at all with such a few lines of code.

                              Finian
                              Finian

                              Comment

                              Working...
                              X