Notifications
Clear all

[Closed] Callbacks problem

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é

3 Replies

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\	est.ms"
format "print \"TESTING, 1 2 3\"" to: f
close f

-- set up callback in listener
callbacks.addscript #filePostOpen fileName:("$temp\	est.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\	est.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!

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.

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.