ecbzh 47 Posted September 25, 2012 Report Share Posted September 25, 2012 Hi, I have seen several post in ubot forum about how to close UI html window using a button. I think it would be added in a future update of Ubot, but for the moment you can't do it in Ubot. I will show you how I got it working and you won't need to click the x button anymore (like in the video below) http://www.youtube.com/watch?v=QavtV8griHM I won't show you how to add a push button because I think you already know it. STEP 1 - Add a javascript function to the button you have created. I will call my button "Close". onclick="ubot.runScript('close()') STEP 2 - Download and install Autohotkey. It's free and you can download it here : http://www.autohotkey.com/download/ STEP 3 - Once installed create a new Autohotkey script (you just need to right click on your desktop, select new then Autohotkey script.Edit the script, remove everything, and add the code below : IfWinExist, The exact name of your ui html window WinClose Save it and compile it as close button.exe (or anything else you want). I have placed it in a script folder, directly in my application folder. STEP 4 - We will now create a define command. We will call it "close" and we will add a shell command in order to launch our autohotkey script. define close { shell("{$special folder("Application")}\\script\\close button.exe") } STEP 5 - THAT'S ALL !! Open your ui html window, click the Close button ... and the magic happen ! The ui html window has been closed without clicking the x button ... I hope this will help you and sorry for my english (I'm french). ENJOY and feel free to press the like button 8 Quote Link to post Share on other sites
Big Jay 35 Posted September 25, 2012 Report Share Posted September 25, 2012 Nice tut bro... Do you have any other floating around? Quote Link to post Share on other sites
P0s3id0n 90 Posted September 25, 2012 Report Share Posted September 25, 2012 Wow thanks I was just looking for this Quote Link to post Share on other sites
ecbzh 47 Posted September 25, 2012 Author Report Share Posted September 25, 2012 Wow thanks I was just looking for this I know ! I have read your post about the stop button in ui html window then I have decided to share how I do it ... I hope it will solve your issue. Quote Link to post Share on other sites
P0s3id0n 90 Posted September 25, 2012 Report Share Posted September 25, 2012 Cool. It is possible to using the same auto hot key make it open a window? For example: Place a button on the UI html panel and onclick open a UI html Window I am looking on it but it seems that all I can do is activate a window but not open it if closed. P0s3id0n Quote Link to post Share on other sites
a2mateit 395 Posted September 25, 2012 Report Share Posted September 25, 2012 Nice Share. Quote Link to post Share on other sites
abbas786 78 Posted September 26, 2012 Report Share Posted September 26, 2012 Yes, it is possible. With AutoHotKey you can write a simple script to open any window. Here is the script Send {Alt}tClick 101,52 // These are the cordinates of your UI HTML Menu or HTML MenureturnSave this file as .ahk and compile the script, call it in ur UBOT Script. Hope it helps Here is the Videohttp://www.screencast.com/t/2bXs9ZHHpeJ 1 Quote Link to post Share on other sites
Jubu 1 Posted September 26, 2012 Report Share Posted September 26, 2012 But this wouldn't work if we sold a bots to someone correct? Unless they did these same steps with the autohotkey. I'm a little confused on that front. Quote Link to post Share on other sites
Legend 181 Posted September 27, 2012 Report Share Posted September 27, 2012 But this wouldn't work if we sold a bots to someone correct? Unless they did these same steps with the autohotkey. I'm a little confused on that front. Right... they would need autohotkey installed and configured for this to work... Quote Link to post Share on other sites
blumi40 222 Posted September 27, 2012 Report Share Posted September 27, 2012 doesnt matter but it looks nice in the video Quote Link to post Share on other sites
ecbzh 47 Posted September 27, 2012 Author Report Share Posted September 27, 2012 But this wouldn't work if we sold a bots to someone correct? Unless they did these same steps with the autohotkey. I'm a little confused on that front. No, it works because your autohotkey script is compiled in an .exe file. Let's make a test : I have created a test ubot exe file. http://www.mediafire.com/?cgts405wz78tf14 Once download, open it and go to the tools section, then User license tabs. Click the close button. Let us know what happen ... (of course you don't have autohotkey on your computer). Thanks. 1 Quote Link to post Share on other sites
jomark3 25 Posted September 27, 2012 Report Share Posted September 27, 2012 No, customers wouldn't need autohotkey installed. In your shell command, call the compiled exe script that you created using autohotkey. Quote Link to post Share on other sites
abbas786 78 Posted September 28, 2012 Report Share Posted September 28, 2012 Worked on a better version, Here are the Code and instructions 1) Open AutoHotKey and write down this code IfWinExist, Automation WinClose 2) Save Flie as CloseUIHTMLwindow.ahk 3) Complie it and make an exe file 4) Open AutoHotKey and write down this code IfWinExist, ui_html_window_automation ;// name of ur UI HTML Window { WinActivate ; use the window found above SetControlDelay -1 Send {Alt}t sleep, 50 ControlClick, x101 y52,,,,, Pos ;// x and y are the cordinates of ur menu u need to call return } 5) Save it as OpenUIHTMLwindow.ahk 6) Compile it as an exe 7) Here is the ubot code ui html panel("<html> <body bgcolor=\"purple\"> <title>Automation of Ui HTML Window</title> <input type=\"button\" name=\"automationwindow\" value=\"Click to Open UI HTML Window\" onclick=ubot.runScript(\'OpenAutomationWindow()\')> </body> </html>", 300) ui html window("Automation", "<html> <body bgcolor=\"CCCCCC\"> <title>Automation of Ui HTML Window</title> <p> <font face=\"verdana\" size=\"4\" color=\"purple\"> Wow! Its all about automation!!! </font> </p> <input type=\"button\" name=\"Closeme\" value=\"Close Me\" onclick=ubot.runScript(\'CloseAutomationWindow()\')> </body> </html>", 250, 250) define OpenAutomationWindow { shell("{$special folder("Application")}\\OpenUIHTMLwindow.exe") } define CloseAutomationWindow { shell("{$special folder("Application")}\\CloseUIHTMLwindow.exe") } 3 Quote Link to post Share on other sites
a2mateit 395 Posted September 28, 2012 Report Share Posted September 28, 2012 Nice addition. +1 Quote Link to post Share on other sites
warriorfullights 0 Posted September 28, 2012 Report Share Posted September 28, 2012 Thanks for sharing this. Great video! http://imagicon.info/cat/5-34/boredom.gif Quote Link to post Share on other sites
k1lv9h 76 Posted September 28, 2012 Report Share Posted September 28, 2012 Hi, Another way to close ui html window. Using VBScript code. Code:ui stat monitor("<script type=\"text/javascript\"> window.onload = ubot.runScript(\'defaultvalues()\') </script> Running loop:", #loopcnt) ui stat monitor("Status:", #loopstat) ui button("Run") { runall() } ui button("Stop") { stopthis() } comment("set uihtmlwindowtitle to the same value as your ui html window->Label field") set(#uihtmlwindowtitle, "Status ui html window", "Global") ui html window("Status ui html window", "<htnl> <head> </head> <body onclick=\"window.opener=self; window.close();\"> ui html window <br><button id=\"closewin2\" onclick=\"ubot.runScript(\'closeuiwindow()\')\">Close window</button> </body> </html>", 200, 200) runall() define defaultvalues { set(#loopcnt, 0, "Global") set(#loopstat, "Not Running", "Global") set(#uihtmlwindowtitle, "Status ui html window", "Global") } define runall { set(#loopcnt, 0, "Global") set(#loopstop, "false", "Global") set(#loopstat, "Running", "Global") Surf() } define Surf { loop(10) { if($comparison(#loopstop, "=", "false")) { then { increment(#loopcnt) mouse over(<innertext="FEATURES">, "No") wait($rand(7, 10)) } else { } } } set(#loopstat, "Stopped", "Global") } define stopthis { set(#loopstop, "true", "Global") } define closeuiwindow { clear list(%vbspgm) set(#vbscode, "Option Explicit Dim objWshShell Set objWshShell = Wscript.CreateObject(\"Wscript.Shell\")", "Global") add list to list(%vbspgm, $list from text(#vbscode, $new line), "Delete", "Global") add item to list(%vbspgm, "If objWshShell.AppActivate(\"{#uihtmlwindowtitle}\") Then", "Delete", "Global") set(#vbscode, " WScript.Sleep 500 objWshShell.SendKeys \"%\{F4\}\" End If", "Global") add list to list(%vbspgm, $list from text(#vbscode, $new line), "Delete", "Global") save to file("{$special folder("Application Data")}\\closeuiwindow.vbs", %vbspgm) shell("wscript.exe /Nologo \"{$special folder("Application Data")}\\closeuiwindow.vbs\"") loop(1) { delete file("{$special folder("Application Data")}\\closeuiwindow.vbs") } } sample-ui-html-button-002.ubot Kevin 3 Quote Link to post Share on other sites
ecbzh 47 Posted September 30, 2012 Author Report Share Posted September 30, 2012 Hi, Another way to close ui html window. Using VBScript code. Code:ui stat monitor("<script type=\"text/javascript\"> window.onload = ubot.runScript(\'defaultvalues()\') </script> Running loop:", #loopcnt) ui stat monitor("Status:", #loopstat) ui button("Run") { runall() } ui button("Stop") { stopthis() } comment("set uihtmlwindowtitle to the same value as your ui html window->Label field") set(#uihtmlwindowtitle, "Status ui html window", "Global") ui html window("Status ui html window", "<htnl> <head> </head> <body onclick=\"window.opener=self; window.close();\"> ui html window <br><button id=\"closewin2\" onclick=\"ubot.runScript(\'closeuiwindow()\')\">Close window</button> </body> </html>", 200, 200) runall() define defaultvalues { set(#loopcnt, 0, "Global") set(#loopstat, "Not Running", "Global") set(#uihtmlwindowtitle, "Status ui html window", "Global") } define runall { set(#loopcnt, 0, "Global") set(#loopstop, "false", "Global") set(#loopstat, "Running", "Global") Surf() } define Surf { loop(10) { if($comparison(#loopstop, "=", "false")) { then { increment(#loopcnt) mouse over(<innertext="FEATURES">, "No") wait($rand(7, 10)) } else { } } } set(#loopstat, "Stopped", "Global") } define stopthis { set(#loopstop, "true", "Global") } define closeuiwindow { clear list(%vbspgm) set(#vbscode, "Option Explicit Dim objWshShell Set objWshShell = Wscript.CreateObject(\"Wscript.Shell\")", "Global") add list to list(%vbspgm, $list from text(#vbscode, $new line), "Delete", "Global") add item to list(%vbspgm, "If objWshShell.AppActivate(\"{#uihtmlwindowtitle}\") Then", "Delete", "Global") set(#vbscode, " WScript.Sleep 500 objWshShell.SendKeys \"%\{F4\}\" End If", "Global") add list to list(%vbspgm, $list from text(#vbscode, $new line), "Delete", "Global") save to file("{$special folder("Application Data")}\\closeuiwindow.vbs", %vbspgm) shell("wscript.exe /Nologo \"{$special folder("Application Data")}\\closeuiwindow.vbs\"") loop(1) { delete file("{$special folder("Application Data")}\\closeuiwindow.vbs") } } sample-ui-html-button-002.ubot Kevin Thanks ! Great share ... This thread is very useful thanks to share like this and other Quote Link to post Share on other sites
UBotBuddy 331 Posted October 12, 2012 Report Share Posted October 12, 2012 Well. Better late than never I say. I have a way to accomplish this closure using UBot only. "WHAT?" Yes, I can close that UI HTML Window with the click of the button and NOT the "X". How? After I add my Close button to the HTML code for the window. I point that button to execute a "CloseWindow" Define node. In that Define I execute a single Shell command where I run a Closewindow.exe file. Now for the secret...LOL. That "Closewindow.exe" file was created using UBot Studio version 3.5. It really does work! The only gotcha is that when the "Closewindow.exe" runs it opens up in a Full Window and then it ends and closes. Yes, it is not entirely pretty BUT for UBot zealots like myself it keeps my hands clean of AutoIt stink. LOL Buddy Quote Link to post Share on other sites
a2mateit 395 Posted October 12, 2012 Report Share Posted October 12, 2012 Well. Better late than never I say. I have a way to accomplish this closure using UBot only. "WHAT?" Yes, I can close that UI HTML Window with the click of the button and NOT the "X". How? After I add my Close button to the HTML code for the window. I point that button to execute a "CloseWindow" Define node. In that Define I execute a single Shell command where I run a Closewindow.exe file. Now for the secret...LOL. That "Closewindow.exe" file was created using UBot Studio version 3.5. It really does work! The only gotcha is that when the "Closewindow.exe" runs it opens up in a Full Window and then it ends and closes. Yes, it is not entirely pretty BUT for UBot zealots like myself it keeps my hands clean of AutoIt stink. LOL Buddy Nice one Buddy, Any chance there is a way to shell out flash upload pop-ups as well? Similar to the fix offered here:http://www.ubotstudio.com/forum/index.php?/topic/11007-picture-file-upload-with-pop-up-window/ Sorry to take the thread off topic, but these damn flash uploads are killing me... Would like to know if this is possible by shelling out to 3.5? To impatient to wait for future updates... Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.