Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reassign variables
#1
OK

I have looked and found no answer.
Is there a way to reassign a variable?

The error is - this variable is already declared.

I am using - str a.getwintext

Thank You
Kenneth
#2

You only need to use str once any other time just use:
Code:
Copy      Help
a.getwintext
#3
Sorry -

I destroyed or closed - str a.getwintext - so I do need to know;


Is there a way to reassign a variable?

The error is - this variable is already declared.

I am using - str a.getwintext

Thank You
Kenneth
#4
str a
...
a.getwintext
...
a.getwintext
...
#5
Thank You

I did not understand at first but works great!
#6
To do something with strings, it does not have to be like

str s.something(...)

It just joins two steps into single line. In two steps it would be

str s
s.something(...)

The first line declares (creates) variable s. The second line does something with the variable. You cannot declare the same local variable two times in a macro/function. Declare it once, and then do something with it any number of times.

str s
s.something(...)
s.something2(...)
s.something3(...)
...

Or you can first time do it in single line:

str s.something(...)
s.something2(...)
s.something3(...)
...

When you use floating toolbar dialogs to insert string functions etc, they don't know that the variable is already declared, and may insert str s.something(...) multiple times.

str s.something(...)
str s.something2(...)
str s.something3(...)

Just delete "str ", except in first such line.

str s.something(...)
s.something2(...)
s.something3(...)

Or use other variables.

str s.something(...)
str s2.something2(...)
str s3.something3(...)

Or

str s s2 s3
s.something(...)
s2.something2(...)
s3.something3(...)
#7
Again Thank You so much,

Can you tell me something else? I do not know if you can see all my edits so maybe I am telling you something you already know, so please forgive me.

The macro I am creating organizes all my files in all of my drives. I do not use any speed commands I use things like -
Code:
Copy      Help
rep() if(IsWindowVisible(win("Local Disk (C:)" "CabinetWClass"))) break; else 0.001
- and track lines with -
Code:
Copy      Help
out"20"
and
Code:
Copy      Help
out"21"
- to insure that no errors can occur.

How can I tract why my macro sometimes just stops forever, at a random place and waits “even though I never use any waits” and the red arrows are of course still red?
#8
If stops in random places then don't know. If in the rep line, it also waits if the window does not exist. Maybe also check if the window still exists.

Code:
Copy      Help
rep
,int w1=win("Local Disk (C:)" "CabinetWClass")
,if(w1=0) ret
,if(IsWindowVisible(w1)) break
,0.001

But why do you use IsWindowVisible for a folder window. It makes me think it is for a button in the well known program.
#9
Is there a better way to make sure that you do not try to move a zip file before you are in the directory?


Examples:

Code:
Copy      Help
run "E:\"

rep() if(IsWindowVisible(win("Local Disk (E:)" "CabinetWClass"))) break; else 0.001

Acc a=acc("Search" "PUSHBUTTON" win("Local Disk (E:)" "CabinetWClass") "ToolbarWindow32" "" 0x1001)
a.DoDefaultAction

rep() if(IsWindowVisible(id(5502 win("Local Disk (E:)" "CabinetWClass")))) break; else 0.001

Acc b=acc("All files and folders" "PUSHBUTTON" win("Local Disk (E:)" "CabinetWClass") "SA_Button" "" 0x1001)
b.DoDefaultAction

_s=".zip"; _s.setwintext(id(5603 win("Local Disk (E:)" "CabinetWClass")))

Acc c=acc("Open" "PUSHBUTTON" win("Local Disk (E:)" "CabinetWClass") "ComboBox" "" 0x1001)
c.DoDefaultAction

Acc d=acc("Local Disk (E:)" "LISTITEM")
d.DoDefaultAction

but+ id(10004 win("Local Disk (E:)" "CabinetWClass"))

run "E:\ZIPS"



,



Examples:

Code:
Copy      Help
run "C:\Program Files\3B Software\Windows Registry Repair Pro\RegistryRepairPro.exe"
out "1"

rep() if(IsWindowVisible(win("Information" "TMessageForm"))) break; else 0.001
out "2"

but% child("&Scan Now" "TButton" win("Information" "TMessageForm") 0x1)
out "3"

//rep() if(IsWindowVisible(win("Windows Registry Repair Pro" "TfmBase"))) break; else 0.001
//out "4"
//-------------------------------------------------------------------


rep() if(!IsWindowVisible(child("Next &>>" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1))) break; else goto NEXT
out "goto EXIT"
goto EXIT

;NEXT
but% child("Next &>>" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1)
out "NEXT 1"

rep() if(IsWindowVisible(win("Windows Registry Repair Pro" "TfmBase"))) break; else 0.001
out "NEXT 2"

but% child("Next &>>" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1)
out "NEXT 3"
,
rep() if(IsWindowVisible(win("Information" "#32770"))) break; else 0.001
out "NEXT 4"

but% id(2 win("Information" "#32770"))
out "NEXT 5"

//rep() if(IsWindowVisible(child("Repair" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1))) break
//out "10"


rep() if(!IsWindowVisible(child("Cancel Scan" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1))) break; else 0.001
out "NEXT 6"    

rep
,out "Repair started"

,rep() if(IsWindowVisible(child("Repair" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1))) break; else 0.001
,out "Repair 1"

,but% child("Repair" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1)
,out "Repair 2"

,rep() if(IsWindowVisible(win("Information" "#32770"))) break; else 0.001
,out "Repair 3"
,
,but% id(2 win("Information" "#32770"))
,out "Repair 4"    
,
,rep() if(IsWindowVisible(child("Next &>>" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1))) break; else 0.001
,out "Repair 5"

,but% child("Next &>>" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1)
,out "Repair 6"

,rep() if(IsWindowVisible(win("Information" "TMessageForm"))) break; else 0.001
,out "Repair 7"
,
,but% child("OK" "TButton" win("Information" "TMessageForm") 0x1)
,out "Repair 8"
,
,
,
,rep() if(IsWindowVisible(win("Information" "TMessageForm"))) break; else 0.001
,out "Repair 9"
,
,but% child("&No" "TButton" win("Information" "TMessageForm") 0x1)
,out "Repair 10"
,
,rep() if(IsWindowVisible(win("Windows Registry Repair Pro" "#32770"))) break; else 0.001
,out "Repair 11"
,
,but% id(2 win("Windows Registry Repair Pro" "#32770"))
,out "Repair 12"
//------------------------------------------------------------    
,rep
,,rep() if(IsWindowVisible(child("Repair" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1))) break; else 0.001
,,out "Rep Repair 1"

,,but% child("Repair" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1)
,,out "Rep Repair 2"
,,
,,rep() if(IsWindowVisible(win("Information" "TMessageForm"))) break; else 0.001
,,out "Rep Repair 3"
,
,,but% child("&No" "TButton" win("Information" "TMessageForm") 0x1)
,,out "Rep Repair 4"    
,,
,,rep() if(IsWindowVisible(win("Windows Registry Repair Pro" "#32770"))) break; else 0.001
,,out "Rep Repair 5"
,,
,,but% id(2 win("Windows Registry Repair Pro" "#32770"))
,,out "Rep Repair 6"        


,,rep() if(IsWindowVisible(child("Next &>>" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1))) break; else 0.001
,,out "Rep Repair 7"

,,but% child("Next &>>" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1)
,,out "Rep Repair 8"

,,rep() if(IsWindowVisible(child("Next &>>" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1))) break; else 0.001
,,out "Rep Repair 9"

,,but% child("Next &>>" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1)
,,out "Rep Repair 10"

,,rep() if(IsWindowVisible(win("Information" "#32770"))) break; else 0.001
,,out "Rep Repair 11"

,,but% id(2 win("Information" "#32770"))
,,out "Rep Repair 12"
,,
,,//;No errors found
,,rep() if(IsWindowVisible(win("Information" "#32770")))break; else 0.001
,,out "Rep Repair 13"

,,but% id(2 win("Information" "#32770"))
,,out "Rep Repair 14"    
,,
,,//;Check for Exit
,,rep() if(IsWindowVisible(child("Exit" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1))) break; else 0.001
,,out "Rep Repair 15"    
,,
,,//;Goto EXIT
,,goto EXIT

//if(IsWindowVisible(child("Repair" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1)))
,



/but% child("Repair" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1)
//out "11"




//else
,
,
//;EXIT
//out "EXIT"


,

,out "NEXT DONE"

shutdown -6 0 "RegistryRepairPro 5" ;;end all threads (running instances) of function Func




;EXIT
rep() if(IsWindowVisible(win("Information" "#32770"))) break; else 0.001
out "EXIT 1"

but% id(2 win("Information" "#32770"))
out "EXIT 2"

but% child("Exit" "TButton" win("Windows Registry Repair Pro" "TfmBase") 0x1)
out "EXIT 3"

rep() if(IsWindowVisible(win("Confirm" "#32770"))) break; else 0.001
out "EXIT 4"

but% id(6 win("Confirm" "#32770"))
out "EXIT 5"

/////rep() if(IsWindowVisible(win("Information" "#32770"))) break; else 0.001
/////out "EXIT 5 1/2"


/////but% id(2 win("Information" "#32770"))
/////out "EXIT 5 3/4"


////;;;;;;if(IsWindowVisible(win("Windows Registry Repair Pro" "TfmBye")))
rep() if(IsWindowVisible(win("Windows Registry Repair Pro" "TfmBye"))) break; else 0.001
out "EXIT 6"

///////but% child("OK" "TButton" win("Windows Registry Repair Pro" "TfmBye") 0x1)
but% child("OK" "TButton" win("Windows Registry Repair Pro" "TfmBye") 0x1)
out "EXIT 7"

//rep() if(IsWindowVisible(win("Information" "#32770"))) break; else 0.001
//out "EXIT 8"


//but% id(2 win("Information" "#32770"))
//out "EXIT 9"


out "EXIT DONE"

shutdown -6 0 "RegistryRepairPro 5" ;;end all threads (running instances) of function Func

,

,

Sorry if it would have been better to give you some kind of Link- I do not know how to do that! :oops:
#10
Code:
Copy      Help
wait 30 WV win("Local Disk (C:)" "CabinetWClass")
#11
I am sorry for the slow response time; I can guarantee that the flu is not something that you want. It has been weeks and I am not over it yet.

I tried the code

Code:
Copy      Help
wait 30 WV win("Local Disk (C:)" "CabinetWClass")


And it removed all of my errors. I do not know the right terminology for it so I will just say I have a new bit of coding that seems to eliminate the errors that I had.

Thank You
Thank you,
Thank you,


Forum Jump:


Users browsing this thread: 1 Guest(s)