Jump to content

I'll paypal $15 to the first one who can solve this problem


Recommended Posts

Ok, I know it aint that much but I have sweated and debugged this and cant figure it out.

The problem code is the add_answers_to _track function and its associated sub-functions.

Here is a trace of the values of the important variables:

$loop 0

$loop2 0 1 2

$Now 9.3 9.7 10

$NowCoverted 9.3 9.3 11.2

$Nowadd .4 .3 .3

$Nowadj .4 .7 1.0

$loop 1

$loop2 0 1 2

$Now 9.3 9.7 10

$NowCoverted 9.3 10.4 10.4

$Nowadd .5 .3 .5

$Nowadj .5 .8 1.3

$loop 2

$loop2 0 1 2

$Now 9.3 9.7 10

$NowCoverted 9.3 9.3 9.3

$Nowadd .3 .5 .3

$Nowadj .3 .8 1.1

Etc ..... loop cycles for 56 times loop2 is always 3. Loop2 is within loop. The problem is that $nowconverted should always increase with each cycle of loop2. Sometimes it changes as above or not at all. It always exhibits the same pattern when testing.

The problem appears to be in the function convert_now. You may notice that I have two versions of such. One is commented out. I tried the function as a Case statement and using IF THEN ELSEIF, however the results were the same.

So the question is, "Why isn't function convert_now returning the correct value for $now converted every time?!?!?!??"

I am serious about the $15. Code is attached. Thank you.

Darren

record_audio_v_1.0.au3

Link to comment
Share on other sites

ok here is the table space out better

$loop__________0

$loop2_________ 0__________ 1__________ 2

$Now__________ 9.3________ 9.7_________ 10

$NowCoverted___9.3________ 9.3_________ 11.2

$Nowadd_______ .4 _________.3 __________.3

$Nowadj________ .4_________ .7__________ 1.0

$loop__________ 1

$loop2_________ 0 __________1 __________2

$Now__________ 9.3________ 9.7 _________10

$NowCoverted__ 9.3________ 10.4 _________10.4

$Nowadd_______ .5__________ .3__________ .5

$Nowadj_______ .5__________ .8 __________1.3

$loop___________ 2

$loop2__________ 0__________ 1__________ 2

$Now___________ 9.3________ 9.7________ 10

$NowCoverted____ 9.3_______ 9.3_________ 9.3

$Nowadd_________ .3________ .5 __________.3

$Nowadj_________ .3 ________.8 __________1.1

Link to comment
Share on other sites

I think your function is trying to return the value, but you aren't capturing it.

try replacing line 354 w/ these two lines and test....

$foo = Activate_CakeWalk()
and then msgbox(0,"cakewalk return value",$foo)

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

I think your function is trying to return the value, but you aren't capturing it.

try replacing line 354 w/ these two lines and test....

Ok - it looks like this now. But that did not have any effect. What are you trying to do with those lines?

Darren

Func set_position ()        ; sets the position of NOW in cakewalk to the insertion point for the next answer
;activate_cakewalk ()
    $foo = Activate_CakeWalk()
    msgbox(0,"cakewalk return value",$foo)
    Sleep (500)
    $Now = $Now + $nowAdj
    MsgBox(262144,'Debug line ~353','Selection:' & @lf & '$nowAdj' & @lf & @lf & 'Return:' & @lf & $nowAdj & @lf & @lf & '@Error:' & @lf & @Error);### Debug MSGBOX
    MsgBox(262144,'Debug line ~312','Selection:' & @lf & '$Now' & @lf & @lf & 'Return:' & @lf & $Now & @lf & @lf & '@Error:' & @lf & @Error);### Debug MSGBOX
    Sleep (500)
    activate_cakewalk ()
    ClipPut (convert_now())         ; copy value of converted NOW to clipboard
    MsgBox(262144,'Debug line ~316','Selection:' & @lf & 'convert_now()' & @lf & @lf & 'Return:' & @lf & convert_now() & @lf & @lf & '@Error:' & @lf & @Error);### Debug MSGBOX
    MsgBox(262144,'Debug line ~316','Selection:' & @lf & '$nowConverted' & @lf & @lf & 'Return:' & @lf & $nowConverted & @lf & @lf & '@Error:' & @lf & @Error);### Debug MSGBOX
    
    Sleep (500)
    ControlClick ( "Cakewalk Pro Audio - [eartraining.wrk* - Track]", "", 50)
    Sleep (500)
    send ("{CTRLDOWN}v{CTRLUP}{ENTER}")
    Sleep (500)
    $nowAdj = $nowAdj + get_answer_now_adj () ; get $nowadd from array and add it to $nowadj
    MsgBox(262144,'Debug line ~324','Selection:' & @lf & '$nowAdj' & @lf & @lf & 'Return:' & @lf & $nowAdj & @lf & @lf & '@Error:' & @lf & @Error);### Debug MSGBOX
EndFunc  ;==>set_position
Link to comment
Share on other sites

cakewalk return value was = 1, BTW

Darren

Problem is fixed.

the following code did the trick. Had to use Switch..EndSwitch instead of Select..case. For some reason the function would not return a value when using case statements.

Darren

Func convert_now ()  ; converts $now to its clock value
    Switch $now
        Case 9.3 to 9.4
            Assign("nowConverted",$now,1)
        Case 9.5 to 9.8
            Assign("nowConverted",$now + 0.6,1)
        Case 9.9 to 10.2
            Assign("nowConverted",$now +1.2,1)
        Case 10.3 to 10.6
            Assign("nowConverted",$now + 1.6,1)
        Case 10.7 to 10.8 
            Assign("nowConverted",$now + 2.4,1)
        Case Else
            Assign("nowConverted","Unknown Conversion From: " & $now,1)
    EndSwitch
Edited by darren_burgess
Link to comment
Share on other sites

Problem is fixed.

the following code did the trick. Had to use Switch..EndSwitch instead of Select..case. For some reason the function would not return a value when using case statements.

Darren

So... you sending that PayPal payment to flyingboz, or the AutoIT project?

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Is there an issue either way?

darren

Not at all. Just curious. Since it started out very publicly on the forum it didn't seem like intruding on a private transaction. No reflection on you in particular, but in general these script-for-money threads don't pan out. I was just curious how this one ended.

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Not at all. Just curious. Since it started out very publicly on the forum it didn't seem like intruding on a private transaction. No reflection on you in particular, but in general these script-for-money threads don't pan out. I was just curious how this one ended.

:P

I did pay flyingboz, as he did solve my problem. I was thinking more folks would jump on in a competitive way, and he was the only one to go for it.

Since you mentioned donating to Autoit, I will go ahead and do that as well. I have only been on the forum and using Autoit for a few weeks, and I have gotten alot of free help, and not to mention a free program as well that works quite excellently for my purposes.

I wonder how many of you out there regularily contribute or contribute at all to the Autoit group?

Darren

Link to comment
Share on other sites

I did pay flyingboz, as he did solve my problem. I was thinking more folks would jump on in a competitive way, and he was the only one to go for it.

Since you mentioned donating to Autoit, I will go ahead and do that as well. I have only been on the forum and using Autoit for a few weeks, and I have gotten alot of free help, and not to mention a free program as well that works quite excellently for my purposes.

I wonder how many of you out there regularily contribute or contribute at all to the Autoit group?

Darren

Great! :P

I have donated a little myself, and I hope everyone who gets usefull service from AutoIT would consider doing the same! :nuke:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...