+ Reply to Thread
Results 1 to 3 of 3

How to make the script a bit, Adaptive.

  1. #1
    Registered User
    Join Date
    06-08-2013
    Location
    Sweden
    MS-Off Ver
    Excel 2013
    Posts
    20

    How to make the script a bit, Adaptive.

    Canīt think of a topic, but it pretty much has to do with having the script adapt to things.
    May sound hard, but itīs a very simple thing i want it to adapt to.

    The part i want to enhance is this:

    avs2 = "Avisource(""" & Replace(ActiveWorkbook.FullName, ".csv", ".avi") & """).GetChannels(1,1).ConvertToMono()" & ".DelayAudio(-0.0" & Replace(TextBox4.Value, ".", "") & ").SyncAudio(" & TextBox1.Value & ")"

    Specifically: ".DelayAudio(-0.0" & Replace(TextBox4.Value, ".", "")


    Now it may seem a mess, but just ignore all the code itself, it has to do with Avisynth which is another Script language.

    The only thing i want to enhance is DelayAudio.


    As you can see, i simple write .DelayAudio(-0.0(texbox)) , The textbox will be something like 63.353223 etc.

    This works all fine, as long as the textbox (the value) is only xx.xxxx.... If itīs 3 numbers, the thing breaks, xxx.xxxxx....

    Why is because i have only made the code work with 2 digits, hence the "-0.0" , it simply means i only want to use a value under 100.
    Normally it isnīt a problem as the value shouldnīt be above 100.

    But when it is, it wonīt work, it will write it as a 2 digit.
    For example:

    44.2222 will be 44.2222 milliseconds, nothing wrong there.
    But
    121.2323 will become 12.12323 milliseconds, which is way off.


    So i want it to adapt. If the value is xx. write -0.0(...), if the value is xxx. write -0.(...).


    I think i made a total mess of my explanation, please ask if there is something you donīt understand.


    I myself am thinking of something pretty easy, like:

    If there is 2 number before . write -0.0, if there is 3, -0. , if 4 -
    Something like that.
    Will look pretty ugly, but should be simple to implement i think.
    Many Thanks!
    Last edited by zerowalker; 10-01-2013 at 12:59 AM.

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to make the script a bit, Adaptive.

    Not really sure about the end result you would like to see. Can you give an example of what you would like to see for the different values of Textbox 4. For any value < 100 I guess you would like to see .DelayAudio(99.99999999) whereby 99.999999 is the exact value of textbox4 including decimals.

    Now lets say the value is 121.1234567. What is the value you would like to see for the .DelayAudio(?) parameter, and what if the value of TextBox4 is 1021.1234567?
    If you like my contribution click the star icon!

  3. #3
    Registered User
    Join Date
    06-08-2013
    Location
    Sweden
    MS-Off Ver
    Excel 2013
    Posts
    20

    Re: How to make the script a bit, Adaptive.

    I actually solved it right about now.
    Not perfect but it works.

    I simply did like this:

    Please Login or Register  to view this content.
    So it will work fine as long as itīs not 4 digits, but can probably solve it if there ever will be 4.

    Though if you know a better way to do this, i am all ear.
    But will mark it as solved

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Adaptive cell range
    By Trevasaurus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2013, 11:34 AM
  2. Adaptive Custom Message Box
    By paxile2k in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-23-2010, 08:33 PM
  3. Adaptive image viewing
    By nani in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2010, 01:10 PM
  4. Make A Script Repeat
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-23-2008, 04:42 PM
  5. Forcing adaptive menu options
    By Wowbagger in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 12-12-2005, 11:50 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1