global variables/properties that can be accessed from multiple scripts

Hi folks.

Is there a way to save global variables or properties so that they can be accessed by multiple scripts or by a script that is run multiple times.

the example here would be a variable that remembers that last location of the mouse pointer the last time the script was run.

Currently, I’m saving those variables to a file and reading them each time. The problem with this is that opening a file tends to introduce a slight delay and slows down the performance if my script.

Is there a faster way?

Thanks!

Sam.

Reading a files contents, unless the file is incredibly large, should make no discernible difference on the amount of time it takes for your application to launch.

Another option is to use user defaults but this is still reading and writing to a file.

What exactly is the speed difference you are experiencing between reading and not reading the file during application launch?

Thanks for getting back to me Craig.

I’m making a shortcut that re-maps a key stroke to the following pseudo code:

check if the mouse has moved since the last time I ran this script
if yes
click on a spot on the gui
send the arrow up button
save the new location of the mouse click
if no
send the arrow up button
end if

There’s a bit more to it than that, but this is the general idea. I notice that running this script repeatedly has a noticable lag compared to simply clicking on the spot in the gui and repeatedly pressing the up arrow. The script only works maybe 1 out of 3 times I hit the button.

Any help would be greatly appreciated!

Thanks!

Sam.

It’s hard to tell without seeing the code.