In order for SETCURRENTDIR to work i have to add SLEEP 1
Is this normal?
SETCURRENTDIR("sounds"); SLEEP 1
uhm. No!?
dir$ = GETCURRENTDIR$()
SETCURRENTDIR("sounds")
dir2$ = GETCURRENTDIR$()
PRINT dir$, 10,10
PRINT dir2$, 10, 30
SHOWSCREEN
KEYWAIT
END
Works fine!
EDIT: Tested on V5 and V6 !
Something isnt working right...
ok=SETCURRENTDIR("sounds"); //SLEEP 100
ok2=DOESFILEEXIST("tabs.mid")
PRINT ok+" "+ok2,10,10
KILLFILE "tabs.mid"
SHOWSCREEN
KEYWAIT
ok=SETCURRENTDIR("sounds"); SLEEP 100
ok2=DOESFILEEXIST("tabs.mid")
PRINT ok+" "+ok2,10,10
KILLFILE "tabs.mid"
SHOWSCREEN
KEYWAIT
Maybe DOESFILEEXIST is slow?
That would mean SETCURRENTDIR and DOESFILEEXIST run cocurrently - which I dont think is correct.
What OS are you trying it on - it works fine here on Windows, Mac and Linux.
I have it posted in my forum signature footer:
how are you creating test.mid?
Did you use CLOSEFILE?
Quote from: Kitty Hello on 2008-Oct-30
Did you use CLOSEFILE?
Naturally,
ok=SETCURRENTDIR("sounds"); //SLEEP 100
ok2=DOESFILEEXIST("tabs.mid")
PRINT ok+" "+ok2,10,10
KILLFILE "tabs.mid"
SHOWSCREEN
KEYWAIT
SETCURRENTDIR(".."); // SLEEP 100
TABREADER()
SETCURRENTDIR("sounds"); // SLEEP 100
OPENFILE(1,"tabs.mid",FALSE)
WRITE_MIDI(0x01,0x02)
CLOSEFILE 1
SLEEP 100
MCI_PLAY("tabs.mid",FALSE)
SETCURRENTDIR(".."); // SLEEP 100
I thought this was it too, but i double checked it, and yes, its closefiled
And if you want to see the tab reader...
rv=0; SHELLCMD("notepad Tablet.txt",TRUE,TRUE,rv)
//read tablet:
DIMDATA TAB$[], " ", " "
DIMDATA tabinstrument[], -1
FOR i = 0 TO 1
GETFILE "Tablet.txt",i,a$
TAB$[i]=a$
NEXT
I have been messing with this code 100 different ways, i found only putting a sleep allows the DOESFLEEXIST work. I thought it was a problem with the setdirectory, but maybe its the doesfileexist.
[attachment deleted by admin]
Ah. Getfile/Putfile might be asychrone!
Darn, i was just using that for a workaround to a fast editor
Curious how is getfile affecting the doesfileexist tho?
i call getfile/putfile afterwards
flush the file with:
GETFILE "", x
Thanks, that did the trick, danke
That solved all issues. :booze: