Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get an existing variable to show in text when using newitem
#1
is there a way 2 use an existing variable and get it 2 show that var value in the text part of newitem.I am creating function on the fly using newitem and i need 2 be able 2 pass a variable to the text part and have the variables value show up in the new function.
ex..
str a.getwintext(win("windowname" "windowclass"))
newitem a "<need str a's text here>" "Function" "" "test"
but i also have alot more text to input but i can't seem to get str.a text to be displayed
#2
Code:
Copy      Help
str a.getwintext(win("Quick Macros"))
newitem a "Function" "" "test"

That will get the windows name and make a new mac called that windows name is that what you needed?
#3
nope already new that but ty i need 2 pass the window text to the new function being created as part of it' code
#4
see i am already naming the new function from the string but i need it in the text(aka the code) of the new macro also
#5

So you're saying that you want the variable a's imformation into the new macro created?
If so something like this?


Macro ( Kevin )
Code:
Copy      Help
str a.getwintext(win("Quick" ""))
newitem "New Macro" a "" ""
Taking on Quick Macros one day at a time
#6
yeah ty for the response i figured it out i had 2 make a template the insert the string into the code that way
#7

Oh okay.
Taking on Quick Macros one day at a time
#8
QM Assistant Wrote:
So you're saying that you want the variable a's imformation into the new macro created?
If so something like this?


Macro ( Kevin )
Code:
Copy      Help
str a.getwintext(win("Quick" ""))
newitem "New Macro" a "" ""
ty this 1 helps me loads
#9
well i thought it would work but i didnt realise the new item would me a macros not a function i am using it in a dialogue like this

Code:
Copy      Help
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x190 0 0 90 95 "PLEASE PICK ONE"
;1 Button 0x54030001 0x4 0 82 90 13 "CLICK HERE TO SET"
;3 Button 0x54012003 0x0 0 3 98 15 ""
;4 Button 0x54012003 0x0 0 20 108 23 ""
;5 Button 0x54012003 0x0 0 46 108 15 ""
;6 Button 0x54012003 0x0 0 64 108 15 ""
;10 Static 0x54000010 0x20000 0 44 95 2 ""
;9 Static 0x54000010 0x20000 2 18 95 1 ""
;8 Static 0x54000010 0x20000 0 62 95 1 ""
;END DIALOG
;DIALOG EDITOR: "" 0x202000B "" ""

str controls = "3 4 5 6"
str c3Che c4Che c5Che c6Che
if(!ShowDialog("RPC_CPUD" &RPC_CPUD &controls)) ret
if(c3Che=1)
,newitem "RPC_CPU" "0.001" "" ""
if(c4Che=1)
,newitem "RPC_CPU" "0.002" "" ""
if(c5Che=1)
,newitem "RPC_CPU" "0.005" "" ""
if(c6Che=1)
,newitem "RPC_CPU" "0.009" "" ""
ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)

sel message
,case WM_INITDIALOG
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1

and want it to replace the exsisting text in the RPC_CPU function with the text specified in the dialogue or i was originally going to make it delete the RPC_CPU at the beging of the dialogue and replace it with newitem until i realised newitem was a macros not function Sad
#10
new item can be many things ,u can make a macro ,a function, a menu ect.. read more in qm help
#11
to make it a function using your example do this
newitem "RPC_CPU" "0.001" "Function" ""
#12
Kevin Wrote:to make it a function using your example do this
newitem "RPC_CPU" "0.001" "Function" ""
ty thats exsactly what i needed i can do what i wanna do now Big Grin


Forum Jump:


Users browsing this thread: 1 Guest(s)