Results 1 to 18 of 18

Thread: Write an empty value for a Entry (for ini file)

  1. #1

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    274

    Write an empty value for a Entry (for ini file)

    Hi,

    Always for Jingle Palette, I would add an entry in the jp.ini file, but by default, the value oh this entry has to be empty.

    Code:
    Public IniSet As New ImpulseRegistryAndINI
    Public IniFile As String
    
    [...]Some code[...]
    
    IniFile = App.path & "\jp.ini"
    IniSet.Location = IniFile
    IniSet.SectionKey = "Settings"
    [...]Some other entries[...]
    IniSet.Entry("JLabelSeparator") = ""
    [...]Again other entries[...]

    I remeber I had to install Impulse Studio to work on the original source code, I don't know its role, but the JLabelSeparator entry is not written in the jp.ini file and the following entries too.

    Perhaps someone has a idea of how could I do ?

    Thanks
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  2. #2
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,156

    Re: Write an empty value for a Entry (for ini file)

    Quote Originally Posted by Couin View Post
    Perhaps someone has a idea of how could I do ?
    Perhaps, if someone understand what your are talking about.

    ImpulseRegistryAndINI is *not* a widely used component (far from it) so for bugs and misfeatures perhaps contact it's author/creators.

    A quick google search shows up your modMain.bas as the first match for the component which speaks volumes about its popularity.

    cheers,
    </wqw>

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Write an empty value for a Entry (for ini file)

    No idea why you would need blank values in the file.
    I typically use the API routine to read ini files and have it set to return a default value which is passed to the read routine and returned if the entry does not exist.

    Of course you could always just manually create a copy of the ini file with blank values and include that with the program.

  4. #4

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    274

    Re: Write an empty value for a Entry (for ini file)

    Hi,

    Quote Originally Posted by wqweto View Post
    Perhaps, if someone understand what your are talking about.

    ImpulseRegistryAndINI is *not* a widely used component (far from it) so for bugs and misfeatures perhaps contact it's author/creators.

    A quick google search shows up your modMain.bas as the first match for the component which speaks volumes about its popularity.
    You are right, I found near from 0 results about its popularity. I don't know exactly why RĂ³bert used it. Perhaps I will try to remove this needing in future.


    About why empty value for an entry, it's because I would add an option where user could enter a string in a field, and if the jingle file name contains this string , this string os replaced by line feed.

    For example, if the separator string is " - " , the jingle named "pic - poc" will be dispayed on the button as :
    pic
    poc

    I need to able to store empty value in case of the user won't use this feature.
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Write an empty value for a Entry (for ini file)

    did you try to put a space or some other non-printable character into the ini?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    274

    Re: Write an empty value for a Entry (for ini file)

    Hi,

    I won't to set a space as separator because eache space of a jingle name will result to a line feed.
    But I thing I will try with a chain or character that can not be in the jingle filename, like "?" that Windows disallow.
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Write an empty value for a Entry (for ini file)

    you could also try chr(0) or chr(1)
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  8. #8
    Addicted Member jg.sa's Avatar
    Join Date
    Nov 2017
    Location
    South Australia ( SA )
    Posts
    199

    Re: Write an empty value for a Entry (for ini file)

    G'Day Couin
    This post makes no sense to me
    Have you tried chr(32) ( I searched the page with CTRL F and cant find this string ) ?
    But I have not tested this, because writing a space should delete the entry in the .ini
    You might have to read and write line by line of the .ini

  9. #9

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    274

    Re: Write an empty value for a Entry (for ini file)

    Hi,
    Thanks for idea
    Initially, I would store an empty value, not a space (because a space would after, put a line feed on each space in jingle name), but I tried another soltuion by adding brackets to the value.
    For exemple, empty value stored as []

    Then I remove first and last characters of the value to use it.
    And when I change value in the setting panel, I add brackets to store it in the ini file.
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  10. #10
    Addicted Member jg.sa's Avatar
    Join Date
    Nov 2017
    Location
    South Australia ( SA )
    Posts
    199

    Re: Write an empty value for a Entry (for ini file)

    G'Day Couin

    Quote Originally Posted by Couin View Post
    Thanks for idea
    Your welcome, always trying 2 help


    Quote Originally Posted by Couin View Post
    Thanks for idea not a space (because a space would after, put a line feed on each space in jingle name), but I tried another soltuion by adding brackets to the value.
    I suspect your are talking about an end of line ( EOL ) which to an old assembler programmer is CR ( chr(32) ) LF ( chr(10) ) and this is a left over from typewriters


    Quote Originally Posted by Couin View Post
    Then I remove first and last characters of the value to use it.

    And when I change value in the setting panel, I add brackets to store it in the ini file.

    Maybe you need to revisit your data struc. design ?

  11. #11

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    274

    Re: Write an empty value for a Entry (for ini file)

    Hi

    Perhaps I wrongly write in english, I'm french ^^

    In the original jingle palette software, the labels on jingle buttons are made from the filename without extension.
    For example, filename :
    I want to break free.mp3
    Will display :
    I want to break free

    On short filenames it's nt a problem, but on long filenames, the label put the name on to lines.
    For exemple, filename :
    I like this Jingle palette,a fabulous software.mp3
    Will display (depending the button size) :
    I like this Jingle palette, a fabulous
    software


    But with the new feature I added, if a rename the file in :
    I like this Jingle palette, - a fabulous software.mp3

    and the separator chain (choosen in the settings of jingle palette), is " - " (without quotes , of course, it's only for the forum), will display :
    I like this Jingle palette,
    a fabulous software


    Tha's why, by default (on first start of jingle palette, the jp.ini file is created), the separator chain value has to be empty, even not a space (which willdisplay :
    I
    like
    this
    Jingle
    palette,
    a
    fabulous
    software


    Add brackets for storing the value only, is to have not an empty value for ini file

    On starting Jingle palette, it reads the ini file, and remonte brackets from the value. Then it works with the really wanted value.
    And any change of the chain in the settings, brackets are added before writing the value in the ini file.
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  12. #12
    Addicted Member jg.sa's Avatar
    Join Date
    Nov 2017
    Location
    South Australia ( SA )
    Posts
    199

    Re: Write an empty value for a Entry (for ini file)

    G'Day Couin

    Thank you for the more verbose explanation, your written english is much better than my written french -

    The data structure of the .ini could be each word in a separate value, see below for pseudo code

    For intLoop = 1 To 128

    strKey = "Word."

    strSessionName = Readthisstringfromini _
    ( _
    gstrFName, _
    "Filename.1", _
    strKey & LTrim(Trim(Str(intLoop))) _
    )

    If Len(strSessionName) = 0 Then
    Exit For
    End If

    strFullName = strFullName & strSessionName

    Next

    This would allow very long file names and give you granularity and fidelity over the presentation

    Remember you can read a whole section from an ini with GetPrivateProfileStruct function (winbase.h)

    [Filename.1]
    Word.1=data
    Word.2=data
    Word.3=data
    Word.4=data

    [Filename.2]
    Word.1=data
    Word.2=data
    Word.3=data
    Word.4=data

    [Filename.3]
    Word.1=data
    Word.2=data
    Word.3=data
    Word.4=data

    Quote Originally Posted by Couin View Post
    jingle buttons are made from the filename without extension.
    So we are talking about a Button Control Label ?

    If 'Yes', you are going to have to have an algorithm to shorten the string for the button. eg. len(strButLabel) < 20 ???

    What about 'Bubble help' on Got Focus of the buttons with the whole filename ?

    This is never going to be a perfect solution, while you are using buttons.

    Have you tried a datagrid or some other 'list' control, not a button ?

    HTH

  13. #13
    Addicted Member jg.sa's Avatar
    Join Date
    Nov 2017
    Location
    South Australia ( SA )
    Posts
    199

    Re: Write an empty value for a Entry (for ini file)

    Are these the buttons ?


    Attachment 183627


    This looks like commercial software

  14. #14

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    274

    Re: Write an empty value for a Entry (for ini file)

    Hi,

    In fact, jp.ini is storing settings of the software, for example :
    Code:
    [Settings]
    Path=D:\Users\Couin\Documents\projets_vb\Jingle_Palette-couin 5.1.2 Parser et Display duration
    Device=1
    Volume=100
    Refresh=50
    AutoMixTime=1500
    Touch=0
    Autorepeat=0
    AutoMix=0
    TimeFormat=HH:mm:ss
    DateFormat=yyyy mmmm dd ddd
    PaletteIndex=Another Palette
    ErrorLog=0
    RemainWarn=3
    RemainColor=33023
    ActiveTab=3
    Language=English
    WinWidth=12000
    WinHeight=8565
    WinState=2
    AlwaysOnTop=0
    FullScreen=0
    BottomMargin=120
    RightMargin=120
    ConfirmExit=1
    PosTop=-60
    PosLeft=-60
    JLabelFormat=0
    JLabelFontSet=Arial,Calibri,Calisto MT,Comic Sans MS,Courier New,Impact,Lucida Sans Unicode,Microsoft Sans Serif,Tahoma,Times New Roman,Trebuchet MS,Verdana
    JLabelFontSize=12
    JLabelFont=Arial
    JLabelFontBold=0
    JLabelFontItalic=0
    JDispDuration=1
    JLabelSeparator=[ - ]
    TimeAnnouncer=Time_Announce.wav
    TimeAnnMin=59
    TimeAnnSec=55
    TimeAnnDel=4
    You can see near the end, the JLabelSeparator setting.

    The palettes of jingles are stored in a palette.ini (originaly, of palette_v51.ini as well as I added some features like play mode, button color, for a perhaps future possibility to assign a color to a jingle, and duration, to store it instead of software reads each files of a palette to get durations, on changing palette - it makes changing palette slower than before)


    Code:
    [A World Radio]
    Path_0=Audio_Sample\Radio_Donna_(BE)_The_sound_of_summer.mp3
    Volm_0=100
    Loop_0=0
    BTNCol_0=999999
    PlayMod_0=0
    Duration_0=12,90449
    Path_1=Audio_Sample\Radio_Donna_(BE)_Hitmix_27.mp3
    Volm_1=100
    Loop_1=0
    BTNCol_1=999999
    PlayMod_1=0
    Duration_1=29,25714
    Path_2=Audio_Sample\Vibration_(FR).mp3
    Volm_2=100
    Loop_2=0
    BTNCol_2=999999
    PlayMod_2=0
    Duration_2=12,72163
    Jingle names are not stored in any ini file, as well as totally dependent of filename.

    Also, working on ini files is actually done by ImpulseGlobal.dll (the initial author of Jingle Palette used it, soo I had to use it to run the source code). Perhaps I'll try to ride off this dll, by recoding with free natives tools (ImpulseGlobal is not free), but not a priority.
    If you are interested by Jingle Palette, you could find the author source code here : https://github.com/nagyrobi/Jingle_Palette
    You'll see that's an oooold (and great) software, it was no longer updated, and when I searched for its source code several years ago, there was nothing. And a little more that one year ago, I searched again and found it on github . You can imagine that made me happy, especially when I saw it was in VB6 (becuase I already practiced this language a little).
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  15. #15
    Addicted Member jg.sa's Avatar
    Join Date
    Nov 2017
    Location
    South Australia ( SA )
    Posts
    199

    Re: Write an empty value for a Entry (for ini file)

    G'Day Couin

    So having the SC is really handy, but I was thinking, why can't you just rename the files instead of changing the code ???

    I now realise you cannot see the attachment in my previous post, so can you check this graphic and tell me if these are the buttons ?

    http://beaminter.net/Jingle-palette-buttons.png

  16. #16

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    274

    Re: Write an empty value for a Entry (for ini file)

    Hi,

    Sorry I didn't see you previous message as well as was writing mine

    Yes, that's are theese buttons.
    Renaming files, yes, but you know that we can't put an "return/enter" in a filename, so the only way I found is putting a characters chain that JP replace on display

    I did 3 examples files (bugs bunny) :
    Bugs-bunny.mp3
    Bugs - bunny.mp3
    Bugs[ - ]bunny.mp3

    The separator chain is (without quotes) : " - "
    It is stored in jp.ini : [ - ]

    Look at the screenprint, the line feed is correctly displayed, as waited :
    Name:  jp512.jpg
Views: 477
Size:  27.4 KB
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

  17. #17
    Addicted Member jg.sa's Avatar
    Join Date
    Nov 2017
    Location
    South Australia ( SA )
    Posts
    199

    Re: Write an empty value for a Entry (for ini file)

    G'Day Couin

    So you are happy, all fixed ?

    Beer oclock now !!!

  18. #18

    Thread Starter
    Hyperactive Member Couin's Avatar
    Join Date
    Dec 2020
    Posts
    274

    Re: Write an empty value for a Entry (for ini file)

    Yes, adding bracket to only store the value fixed the problem

    Cheers
    1 Hour vinyl mix live on Eurodance90 each sunday 10:00 PM (French Timezone) - New non-official Jingle Palette update Jingle Palette Reloaded

Posting Permissions

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



Click Here to Expand Forum to Full Width