Table without datasources and global var


global otgadok_glob
global itm_glob

--etc. on open; on opened; on active;on awake from nib;
on launched theObject
--	tell application "Finder" to display dialog "Hello"
	set itm_glob to 2
	set otgadok_glob to 1
end launched

on cell value theObject table column tableColumn row theRow
	if name of theObject is "TableSlov" then
		return "Test"
	else if name of theObject is "VsegoTable" then
		return itm_glob
	else if name of theObject is "UgadanoTable" then
		return otgadok_glob
		
	end if
end cell value

on number of rows theObject
	if name of theObject is "TableSlov" then
		return itm_glob
	else
		if (name of theObject is "VsegoTable") or (name of theObject is "UgadanoTable") then return 2
		
	end if
end number of rows

AppleScript: The variable itm_glob is not defined (-2753)
AppleScript: The variable otgadok_glob is not defined (-2753)

Try changing the first two lines of your script to:

property otgadok_glob : 1
property itm_glob : 2

Property will keep values of parameter from the previous start that is not comprehensible. However through property all really is solved.

on let()
	return 10
end let
property test : let() of me

Oh, no!..


on let()
	return 10
end let
property test : let() of me

tell application "Finder" to display dialog test
set test to 20

Result:

10
20
20
:frowning:

KIA the errors you reported are at run time, aren’t they ?

Anyway try using my_glob_var of me while accessing the global variables.

i using myvar_glob of me: no good result

*** malloc[487]: Deallocation of a pointer not malloced: 0xbfffee80; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug
*** malloc[487]: Deallocation of a pointer not malloced: 0xbfffeff0; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug
*** malloc[487]: Deallocation of a pointer not malloced: 0xbffff160; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug
*** malloc[487]: Deallocation of a pointer not malloced: 0xbffff2d0; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug
*** malloc[487]: Deallocation of a pointer not malloced: 0xbffff440; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug
*** malloc[487]: Deallocation of a pointer not malloced: 0xbffff5b0; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug

Try this:

property otgadok_glob : missing value
property itm_glob : missing value

Heiner

Or put the whole project somewhere on web so everyone can have a look.

property dd : 9

display dialog test
set test to missing value

result:
9
missing value
missing value
missing value

The problem in that I cannot set value of a variable at start of the program, earlier than it will start to be used, differently the script from the first letter would not give out mistakes. To force property to receive the primary value it is possible only once

To suppaman:
Project http://www.applescript.ru/ASForum/download.php?id=49

I’m not sure to understand you.

Anyway I can take your example, convert the project to .xcodeproj change the firs 4 rows of ErrorInitTable to

And have it run nicely.
Btw you shouldn’t connnect the Awake from nib of every item, just those you need. And you should check the name of theObject in the handler.

What version of XCode are you using ?

No, artificial giving value of a variable itm_glob, in any of starts is necessary for me. Appropriated value in the real program not a constant. You have received a mistake at use of a global variable? My version XCode:

I’m having the same problem.

Here’s my code:


property pid : 2

on clicked theObject
	
	if title of theObject = "Activate" then
		do shell script "/Dev/ClearPDF/clear.sh &> /dev/null & echo $!"
		set pid to the result
		
		-- #1
		do shell script "renice +20 -p " & pid
		--do shell script "kill " & pid
		
	else if title of theObject = "Restore" then
		-- #2
		display dialog pid
		--do shell script "kill " & pid
	end if
	
end clicked

on choose menu item theObject
	display dialog "Help"
	
	-- #3
	display dialog pid
	
end choose menu item

Here’s the wierd thing:

#1 → Stores the correct PID value.
#2 → Stores nothing (AppleScript gives “pid not defined” error).
#3 → Stores the correct PID value.

I’ve gone over all the scope rules several times and I still can’t figure this out. PLEASE help!

Info:
MacBook Pro, OS X 10.4.8, Xcode 2.4.1. All running the most recent updates.