PDA

View Full Version : Callbacks problem


Mr-JosE
01-23-2009, 10:03 AM
Hi.

For some reason callbacks behave differently when excuted from a script then when executed from the listener window. The problem i am having is when assigning a fileIn #filePostOpen callback. The callback refuses to load the script when i ser the callback from script, but it works fine when i do the same thing in the listener window.

callbacks.addscript #filePostOpen fileName:("path...") id:#new persistent: true

I get a callback fileIn exception when i set the callback from script.

Anyone know why this happens or a good workaround?

Thanks.

Josť

ZeBoxx2
01-23-2009, 11:29 AM
think we might need more information than that.. what's the script you're trying to set it in?

the below worked fine, at least...


-- just a file to work with
f = createFile "$temp\\test.ms"
format "print \"TESTING, 1 2 3\"" to: f
close f

-- set up callback in listener
callbacks.addscript #filePostOpen fileName:("$temp\\test.ms") id:#new persistent: true
-- save the max file
saveMaxFile "t.max"
-- load the max file
loadMaxFile "t.max"
"TESTING, 1 2 3"
true
-- hey presto

-- remove the callbacks
callbacks.removescripts()
saveMaxFile "t.max"
-- make sure it's gone
loadMaxFile "t.max"
true
-- good, good

-- now for a non-listener test... a button!
rollout roll_test "test" (
button btn_test "test"
on btn_test pressed do (
callbacks.addscript #filePostOpen fileName:("$temp\\test.ms") id:#new persistent: true
)
)
createDialog roll_test
-- press button here
-- ...
-- no errors, let's continue
saveMaxFile "t.max"
loadMaxFile "t.max"
"TESTING, 1 2 3"
true
-- hooray!

Mr-JosE
01-23-2009, 11:37 AM
The script is saved to a network address

"//server10//dfs//temp//mvg//test01_mvg.ms"

Using "doesFileExists" results in true however setting a callback with that path using a script gives me callback filein exceptions.

Mr-JosE
01-26-2009, 08:25 PM
In the end i decided to not use an external script but instead build the script into the callback. I never found out why i couldn't get the ms file to load properly.

CGTalk Moderation
01-26-2009, 08:25 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.