Function inside a super genie(Pop-up)

Hi.

I'm trying to figure out how to re-use the variables inside the PopUpPage.

Here's a link to the function im trying to use inside my popup.

proscada.ru/ctkbase.en/resources/attachments/q4572/exec-guid36c264eab1aa4e048470d7d23cdeb0c2.ci

This simple function works in the genie but not in a super genie.

//MouseButtonDown

ExecEx("%Drawing%")

I've tried replacing the % sign with ? and lots of other ways, with no success. (The function still works if I just type in a "direct" path to open a folder., but I want to use a variable, that I can edit)

FUNCTION

PopUpPage(INT X,INT Y,INT Mode, STRING Drawing)

WinNewAt("!PopUpPage",X,Y,Mode);
SleepMS(25);
WinTitle("TITLE");

Got any ideas?

Thanks in advance.

Robin

Parents
  • It sounds like you are trying to create a genie that works with both hard-coded text when you place it on a page, or with a super genie association when you paste it on a super genie popup. The problem is that you have to treat a super genie association like a variable, in this case a string variable.

    So, if you had a command in the genie like: ExecEx("C:\Users\Public\Documents\%Drawing%.pdf")

    and in the genie form dialog you set the substitution name Drawing to the text: Drawing1, then after substitution, the command would be: ExecEx("C:\Users\Public\Documents\Drawing1.pdf"), which is fine.

    But, for the super genie, you need to associate the constant value "Drawing1" with an association like ?DrawingName?.  You need to do this in your PopUpPage() function before calling WinNewAt. You'd use a command like Ass(-2, "DrawingName", "'Drawing1'"); Notice mode -2 is for the next window opened. The text "Drawing1" has to be in single quotes inside of double quotes to tell Citect it is a constant value instead of a variable tag. Here's what your function would look like with a Cicode variable containing the drawing name.

    FUNCTION PopUpPage(INT X,INT Y,INT Mode, STRING Drawing)
    	Ass(-2, "DrawingName", "'" + Drawing + "'");
    	WinNewAt("!PopUpPage",X,Y,Mode);
    	SleepMS(25);
    	WinTitle("TITLE");
    END
    

    You need to edit the command in the display-drawing genie to be: ExecEx("C:\Users\Public\Documents\" + %Drawing% + ".pdf"); 

    In the super genie page, if you paste your display-drawing genie, you would set the genie substitution Drawing to ?DrawingName?  After substitution, the command would become: ExecEx("C:\Users\Public\Documents\" + ?DrawingName? + ".pdf"); In the runtime, if your Cicode function associates "Drawing1" with the super genie association DrawingName, then the final command would become: ExecEx("C:\Users\Public\Documents\" + "Drawing1" + ".pdf"); which should work.

    The only issue is that if you use this same genie with hard coded text instead of a super genie association (like if you use it on a normal page), then you can't set the substitution Drawing to Drawing1 (without quotes). You just have to add quotes around the text. You would have to set the substitution Drawing to "Drawing1" the command would be valid.

    Or, if you are not using a genie in the super genie page, and you just have a simple button object, then just edit the PopUpPage() function like I showed, and set the button command to: ExecEx("C:\Users\Public\Documents\" + ?DrawingName? + ".pdf")

Reply
  • It sounds like you are trying to create a genie that works with both hard-coded text when you place it on a page, or with a super genie association when you paste it on a super genie popup. The problem is that you have to treat a super genie association like a variable, in this case a string variable.

    So, if you had a command in the genie like: ExecEx("C:\Users\Public\Documents\%Drawing%.pdf")

    and in the genie form dialog you set the substitution name Drawing to the text: Drawing1, then after substitution, the command would be: ExecEx("C:\Users\Public\Documents\Drawing1.pdf"), which is fine.

    But, for the super genie, you need to associate the constant value "Drawing1" with an association like ?DrawingName?.  You need to do this in your PopUpPage() function before calling WinNewAt. You'd use a command like Ass(-2, "DrawingName", "'Drawing1'"); Notice mode -2 is for the next window opened. The text "Drawing1" has to be in single quotes inside of double quotes to tell Citect it is a constant value instead of a variable tag. Here's what your function would look like with a Cicode variable containing the drawing name.

    FUNCTION PopUpPage(INT X,INT Y,INT Mode, STRING Drawing)
    	Ass(-2, "DrawingName", "'" + Drawing + "'");
    	WinNewAt("!PopUpPage",X,Y,Mode);
    	SleepMS(25);
    	WinTitle("TITLE");
    END
    

    You need to edit the command in the display-drawing genie to be: ExecEx("C:\Users\Public\Documents\" + %Drawing% + ".pdf"); 

    In the super genie page, if you paste your display-drawing genie, you would set the genie substitution Drawing to ?DrawingName?  After substitution, the command would become: ExecEx("C:\Users\Public\Documents\" + ?DrawingName? + ".pdf"); In the runtime, if your Cicode function associates "Drawing1" with the super genie association DrawingName, then the final command would become: ExecEx("C:\Users\Public\Documents\" + "Drawing1" + ".pdf"); which should work.

    The only issue is that if you use this same genie with hard coded text instead of a super genie association (like if you use it on a normal page), then you can't set the substitution Drawing to Drawing1 (without quotes). You just have to add quotes around the text. You would have to set the substitution Drawing to "Drawing1" the command would be valid.

    Or, if you are not using a genie in the super genie page, and you just have a simple button object, then just edit the PopUpPage() function like I showed, and set the button command to: ExecEx("C:\Users\Public\Documents\" + ?DrawingName? + ".pdf")

Children
No Data