Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clear all variables
#1
Hey is there a way to clear all the variables so in an exe if i use it then try to use it account the ints will be set back to 0 ?

I have some that wen i use it....i can use it again without closing the dialog in exe but the int's sometimes still = 1 and i need them all reset to 0 without having to type int1 = 0 for every int?
#2
just dont use global variables in your exe and you dont have to worry about it.

global
str+ strName

local
str strName
An old blog on QM coding and automation.

The Macro Hook
#3
or use type.
Clear all type variables
pi
#4
Hey i have to use globals because they are used in multiple functions compiled into the exe. _pi i could not get that to work properly. the PFDB doesnt come in color its black anything i need to do?
#5
then just do it this way

str a
int b

a=""
b=0
An old blog on QM coding and automation.

The Macro Hook
#6
LOL i would but there is over 100 variables Sad.

Can anyone show me how the other code works?
#7

I could be wrong, i've never used this code before but by the looks I think all you have to do is fill in your variables?

Macro ( Macro86 )
Code:
Copy      Help
type PFDB
PFDB empty
your var here=empty
your var here=empty
your var here=empty

I could be wrong though, like I said, i've never used this before. Just throwing something out there. :?
Taking on Quick Macros one day at a time
#8
Use 100 separate global variables for a single task? Of course better add all related variables to a type or several types.

Macro
Code:
Copy      Help
;declare a type with all related variables
type MY100VARIABLES
,intvar1 intvar2 and so on
,str'strvar1 str'strvar2 and so on
,and so on
,In types you also can use fixed size arrays, dynamic arrays, and other types, like the following
,str'a[50] ARRAY(str)a2 RECT'r

;declare 1 global variable of that type. It contains all the variables declared in the type statement above
MY100VARIABLES+ g_var

;use the variables
g_var.intvar1=10
g_var.strvar1="string1"
g_var.a[0]="string2"
g_var.r.bottom=100
g_var.a2.create(5)
out g_var.strvar1
out g_var.a[0]
out g_var.intvar1
out g_var.r.bottom
out g_var.a2.len
;...
;clear all variables in g_var
MY100VARIABLES empty; g_var=empty

out g_var.strvar1
out g_var.a[0]
out g_var.intvar1
out g_var.r.bottom
out g_var.a2.len
#9
WOW Thanks Gint. This will help alot!


Forum Jump:


Users browsing this thread: 1 Guest(s)