Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2003
    Location
    dallas tx
    Posts
    16

    Bug with INI files in 98

    I have found what appears to be a bug in the Autoplay menu

    this works fine in 2000/XP:

    <IR_ACTIONS_LIST>
    <Action name="Get Value Names">
    <Type>103</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%InstallTypes%</Variable>
    <FileName>\\tech-server\software\menu\install.ini</FileName>
    <Section>INSTALLTYPES</Section>
    </Action>
    </IR_ACTIONS_LIST>

    and will return a string such as
    full;;default;;typical;;preventive

    but in 98 the same syntax returns an empty string

    the ini file is setup as:

    [INSTALLTYPES]
    Full="Full"
    Typical="Typical"
    Minimum="Minimum"
    House="House"
    Preventive="Preventive"
    Custom="Custom"

    If anyone has found a workaround, it would be appreciated.

    It is not related to network rights, updates ort anything else I have seen. The menu can pullother values from the ini file iof i specify the value itself. I jsut can not seem to get the ValueNames to be pulled.

  2. #2
    Join Date
    Oct 2003
    Location
    dallas tx
    Posts
    16

    follow up

    this bug appears on Windows Me also according to:


    this thread

    http://www.indigorose.com/forums/sho...&threadid=2791

    I assume it also effects Windows 95 as well.

  3. #3
    Join Date
    Oct 2003
    Location
    dallas tx
    Posts
    16

    Workaround found

    After about 4 hours of coding, I have found a sutable workaround for this bug, and am willing to share it with others. One nice feature that other scripting languages have, which Autoplay should have is user defined functions. It would make things quite easier. maybe for version 5??

    The buggy function is:
    %ValueNames% = INIFile.GetValueNames ("%SrcDir%\Program Files\My Files\MyINI.ini", "MySection")

    This below is an alternative piece of code for that function.
    Notice the beginning variables. They need to be assigned in the same way as INI.GetValueNames
    The %DF_SectionSeperator% is the sperator between INI File Sections
    ie.
    [MyFirstSection]
    MYvalue=1234
    ;;**;;
    [MySecondSection]
    MyValue=3456
    I hope this will help someone else until the bug is fixed.

    << Build Time constants are:
    #ASC_LF# = 10
    #ASC_CR#=13

    // VARIABLES
    // INI File Location
    %DF_INI_FILE% = "%SrcDir%\Program Files\My Files\MyINI.ini"
    // Section Name
    %DF_SectionName% = "MySection"
    // Section Seperator
    %DF_SectionSeperator% = ";;***;;"

    %x% = "0"
    %DF_FileText% =TextFile.Read ("%DF_INI_FILE%")
    %DF_NumIniSect% = String.CountDelimitedStrings ("%DF_FileText%", "%DF_SectionSeperator%")
    WHILE (%x% < %DF_NumIniSect%)
    %DF_String1% = String.GetDelimitedString ("%DF_FileText%", "%DF_SectionSeperator%", %x%)
    %DF_String1S2% = String.GetDelimitedString ("%DF_String1%", "]", 0)
    %DF_String1S2Len% = String.GetLength ("%DF_String1S2%")
    %DF_String1S2Len% = Evaluate (%DF_String1S2Len% - 1)
    %DF_String1S2% = String.Mid ("%DF_String1S2%", 1, %DF_String1S2Len%)
    IF (%DF_String1S2%=%DF_SectionName%)
    %DF_String1S3% = String.GetDelimitedString ("%DF_String1%", "]", 1)
    %DF_String1S3Len% = String.CountDelimitedStrings ("%DF_String1S3%", "=")
    %y% = "1"
    %DF_SubReturnVar% = ""
    WHILE (%y% < %DF_String1S3Len%)
    %DF_String1S4% = String.GetDelimitedString ("%DF_String1S3%", "#ASC_CR##ASC_LF#", %y%)
    %DF_String1S5% = String.GetDelimitedString ("%DF_String1S4%", "=", 0)
    %DF_SubReturnVar% = "%DF_SubReturnVar%;;%DF_String1S4%"
    %y% = Evaluate (%y% + 1)
    END WHILE
    END IF
    %x% = Evaluate (%x% + 1)
    END WHILE
    %DF_SubReturnVarLength% = String.GetLength ("%DF_SubReturnVar%")
    %DF_SubReturnVarLength% = Evaluate (%DF_SubReturnVarLength%-2)
    %ReturnVar% = String.Mid ("%DF_SubReturnVar%", 2, %DF_SubReturnVarLength%)
    %ValueNames% = "%ReturnVar%"

  4. #4
    Join Date
    Oct 2003
    Location
    dallas tx
    Posts
    16

    One last update -- replacing the bultin function

    if you want to tottally replace the built in function, the following updated code works well

    using GOTO and LABEL -- it can simulate custom functions like other scripting languages

    Design constants

    #ASC_CR# 13
    #ASC_LF# 10

    Function:
    // location of the ini file
    %DF_INi_FILE_LOCATION% = "C:\WHATEVER.INI"
    // section for the value names you want
    %DF_WhatYouAreLookingFor% = "INSTALLTYPES"
    // label to return to the part of the code the subroutine was called from
    %DF_RETURNLABEL% = "DIALOG"
    GOTO ("VALUENAMES")
    DIALOG
    // lets get the return vlaue and assign it to our variable
    %InstallTypes% = "%DF_ReturnVar%"
    %Result% = Dialog.MessageBox ("Title", "%InstallTypes%", Ok, Question)
    //done with script, lets jump over the custom function
    GOTO ("ENDLABEL")
    // the valuenames function replacement
    VALUENAMES
    IF (%IsWin95% OR %IsWin98% OR %IsWinME% = "TRUE")
    %DF_X% = "1"
    %DF_InstallFileText% =TextFile.Read ("%DF_INi_FILE_LOCATION%")
    %DF_NumberOfSectionsInInstallFileText% = String.CountDelimitedStrings ("%DF_InstallFileText%", "]#ASC_CR#")
    WHILE (%DF_X% < %DF_NumberOfSectionsInInstallFileText%)
    %DF_FirstPartOfInstallFileText% = String.GetDelimitedString ("%DF_InstallFileText%", "[", %DF_X%)
    %DF_FirstSectionOfFirstPartOfInstallFileText% = String.GetDelimitedString ("%DF_FirstPartOfInstallFileText%", "]", 0)
    IF (%DF_FirstSectionOfFirstPartOfInstallFileText%=%DF _WhatYouAreLookingFor%)
    %DF_SecondSectionOfFirstPartOfInstallFileText% = String.GetDelimitedString ("%DF_FirstPartOfInstallFileText%", "]", 1)
    %DF_SecondSectionOfFirstPartOfInstallFileTextCount % = String.CountDelimitedStrings ("%DF_SecondSectionOfFirstPartOfInstallFileText %", "=")
    %DF_Y% = "1"
    %DF_SubReturnVar% = ""
    WHILE (%DF_Y% < %DF_SecondSectionOfFirstPartOfInstallFileTextCount %)
    %DF_FirstValueNameLine% = String.GetDelimitedString ("%DF_SecondSectionOfFirstPartOfInstallFileText %", "#ASC_CR#", %DF_Y%)
    %DF_FirstValueName% = String.GetDelimitedString ("%DF_FirstValueNameLine%", "=", 0)
    %DF_SubReturnVar% = "%DF_SubReturnVar%;;%DF_FirstValueName%"
    %DF_Y% = Evaluate (%DF_Y% + 1)
    END WHILE
    END IF
    %DF_X% = Evaluate (%DF_X% + 1)
    END WHILE
    %DF_SubReturnVarLength% = String.GetLength ("%DF_SubReturnVar%")
    %DF_SubReturnVarLength% = Evaluate (%DF_SubReturnVarLength%-2)
    %DF_ReturnVar% = String.Mid ("%DF_SubReturnVar%", 2, %DF_SubReturnVarLength%)
    %DF_ReturnVar% = String.Replace ("%DF_ReturnVar%", "#ASC_LF#", "")
    %DF_ReturnVar% = String.Replace ("%DF_ReturnVar%", "#ASC_CR#", "")
    ELSE
    %DF_ReturnVar% = INIFile.GetValueNames ("%DF_INi_FILE_LOCATION%", "%DF_WhatYouAreLookingFor%")
    END IF
    GOTO ("%DF_RETURNLABEL%")
    // end of script
    ENDLABEL

  5. #5
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728

    Re: Bug with INI files in 98

    Originally posted by dallasfreak2
    I have found what appears to be a bug in the Autoplay menu

    this works fine in 2000/XP:

    <IR_ACTIONS_LIST>
    <Action name="Get Value Names">
    <Type>103</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%InstallTypes%</Variable>
    <FileName>\\tech-server\software\menu\install.ini</FileName>
    <Section>INSTALLTYPES</Section>
    </Action>
    </IR_ACTIONS_LIST>

    and will return a string such as
    full;;default;;typical;;preventive

    but in 98 the same syntax returns an empty string
    I suspect this has something to do with the UNC path you're using. Are you sure the Win9x machines are able to resolve that path? Especially with the hyphen in the server name?

    IIRC, Win9x used to have trouble with some UNC names that were valid in NT. I can't remember the exact reason, though, but it might be something to look into.

    Have you tried accessing the INI file locally? See if that makes any difference. You could also try mapping the path to a drive letter, and using the drive letter instead of the server & share name. (It would help us narrow this down, if it is a bug.)

  6. #6
    Join Date
    Oct 2003
    Location
    dallas tx
    Posts
    16
    yes -- have tried mapping locally, and not across a server. The server is just an inhouse thing, but it does appear locally as well.

    I have not noticed any other bug yet between 2k and 98.

    The workaround does wirk on both oses though even without the Iswin9x check... but at an increase in execution time -- not much just bout 2 seconds

    What is odd though, and makes me think its jaut a bug with this one function, is that reading the ini as a text file works fine, as well as all of the other ini file functions regardless of rather its locally, across share, or mapped locally.

    Simple test -- blank menu -- have it read the valuenames of an ini file in c:\whatever.ini then echo them via dialog box -- it will be blank in 9x but work in 2k
    Last edited by dallasfreak2; 10-28-2003 at 05:03 PM.

  7. #7
    Join Date
    May 2000
    Location
    Indigo Rose Software
    Posts
    2,150
    I have tested this out and it appears as though it is a bug in AutoPlay 4.0.0.5. I have documented this for the developers.

    Thank you for the information regarding the workaround.

  8. #8
    Join Date
    Oct 2003
    Location
    dallas tx
    Posts
    16
    heh - long time no see Adam -- used to post to the version 3 forums quite often

    any chance on getting custom functions in the next major release to make repeatitive code snippets more automated?

    or a way to use GOTO to jump to a section of code on another page? (That way a user can have a "page" of nothing but scripts such as this workaround and then go back to the orignal page)

  9. #9
    Join Date
    Jan 2000
    Location
    Indigo Rose Software
    Posts
    127
    You can count on functions being in the next version...

Similar Threads

  1. rename multiple files
    By jenny62 in forum Setup Factory 6.0
    Replies: 1
    Last Post: 04-13-2004, 01:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts