Paste string depending on value in other ahk file

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Magnamarus
Posts: 2
Joined: 18 Nov 2021, 09:10

Paste string depending on value in other ahk file

Post by Magnamarus » 18 Nov 2021, 11:05

I have setup a Menu and am trying to get Winclip to paste a new value depending on the value set

So basically I have 2 files, one has a menu with different string to paste depending on the users choice. The second file is referenced, so when lets say the user sets the value from "example1" to "example2", I am looking that it pastes a different text when they choose the menu item.

The code below is how far I got, I have been looking in the forum and the help pages but haven't found what I am looking for.

menuitem = Is what the user chooses in the menu
Sleep 500 = I added it because the system I am using is too slow to cope with the fast pasting (don't ask me why, but I went mad until I figured it out)

Code: Select all


menuitem:
Sleep 500
Click
text =
(
some text1
)

text2= 
(
some text2
)

Sleep 500
if (%value% := "example") {
    wc.Paste(text2)

} else {
    wc.Paste(text)
}
return


I was able to retrieve the value from the second file when using a shortcut:

Code: Select all


::_shortcut::
sendinput,
(
some text %value% some text
)
return

But when trying to do it with the menu it will only paste "text" and not "text2". This means to me thy syntax is kinda right cause it doesn't break it, the output would be when choosing it from the menu:

some text1

Desired result, if value is x in second file then paste text2.

Hope it makes sense, let me know if you have any questions :) I would appreciate your help, its the first time I am posting in the community^^

Return to “Ask for Help (v1)”