simulate

Simulate click at x/y coordinates using javascript

强颜欢笑 提交于 2019-11-30 10:05:27
How can I simulate a click at x/y co-ordinates using javascript or jquery? I will use the script multiple times and I want the script to click on postion one then postion two then three then four and so one. It is better without moving the mouse cursor, but if it has to move then that is fine as well. This can actually be accomplished with the document.elementFromPoint method. A jQuery example: function simulateClick(x, y) { jQuery(document.elementFromPoint(x, y)).click(); } simulateClick(100, 250); simulateClick(400, 250); Edit: Here is a working example: http://jsfiddle.net/z5YjY/ On a

Is it possible to simulate closures in PHP 5.2.x not using globals?

喜你入骨 提交于 2019-11-30 08:23:59
问题 Is it possible to simulate closures in PHP 5.2.x not using globals? I could think of a way that would pass the desired variables as extra parameters to the closure but that just doesn't feel like best practice. Any ideas? 回答1: Interesting question. I'd say it's not possible at all , but let's see Quoting IBM - What's new in PHP5.3, Part 2 A closure is a function that is evaluated in its own environment, which has one or more bound variables that can be accessed when the function is called.

Simulating a mouse button click in Windows

僤鯓⒐⒋嵵緔 提交于 2019-11-30 07:39:37
问题 I'm writing Remote Desktop clone in C++ using QT. So far I'm able to move the mouse cursor around fine. QT has a nice setPos function for that. However, I'm a bit lost as to what API/Library to use for simulating mouse button clicks. One method I'm aware of is to send the WM_(event) to a window using the window's HWND. However, I was hoping there was a more salient method for taking complete control over a mouse. Is there any other way to tell the operating system that the left mouse button

Matlab/CUDA: ocean wave simulation

别等时光非礼了梦想. 提交于 2019-11-29 20:21:03
问题 I've studied "Simulating Ocean Water" article by Jerry Tessendorf and tried to program the Statistical Wave Model but I didn't get correct result and I don't understand why. In my program I tried only to create a wave height field at time t = 0 without any further changes in time. After execution of my program I got not what I was expecting: Here's my source code: clear all; close all; clc; rng(11); % setting seed for random numbers meshSize = 64; % field size windDir = [1, 0]; % ||windDir||

Simulate touch on ios7/8

为君一笑 提交于 2019-11-29 18:00:28
I want to simulate a touch on iOS7/8, I googled and I found that the API are changed from iOS6 to iOS 7 and I should use the IOHIDEvent (in IOKit.framework) for touch events but I didn't get a good example to start PLZ if anybody have an idea to begin give me how to do it . You could begin by reading this : https://developer.apple.com/library/mac/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/Introduction/Introduction.html , the official documentation. And this : http://ios-blog.co.uk/tutorials/iokit-an-introduction/ , good tutorial :) 来源: https://stackoverflow.com/questions/26460614

How to simulate multimedia key press (in C)?

柔情痞子 提交于 2019-11-29 11:21:23
Modern keyboards have special multimedia keys, e.g. 'Pause/Play' or 'Open Web Browser'. Is it possible to write a program that "presses" these keys? I would prefer solution in C, but I would accept a language agnostic solution, too. Use the SendInput Windows API, if you are talking about programming under Win32. You need to build INPUT structures, setting the type member to INPUT_KEYBOARD. In the ki member (KEYBDINPUT type), you can set vk (virtual key) to your desired VK code (for example, VK_MEDIA_NEXT_TRACK, VK_MEDIA_STOP). Virtual key codes: http://msdn.microsoft.com/en-us/library/dd375731

Is it possible to simulate closures in PHP 5.2.x not using globals?

孤人 提交于 2019-11-29 06:39:37
Is it possible to simulate closures in PHP 5.2.x not using globals? I could think of a way that would pass the desired variables as extra parameters to the closure but that just doesn't feel like best practice. Any ideas? Interesting question. I'd say it's not possible at all , but let's see Quoting IBM - What's new in PHP5.3, Part 2 A closure is a function that is evaluated in its own environment, which has one or more bound variables that can be accessed when the function is called. and further (emphasis mine) Variables to be imported from the outside environment are specified in the use

Simulate pressing tab key with jQuery

送分小仙女□ 提交于 2019-11-29 01:05:52
I have some textboxes on a .net-page and want to achieve the following with jQuery: if the user presses return, the program should behave "as if" he had used the tab key, thus, selecting the next element. I tried the following code (and some more): <script type="text/javascript"> jQuery(document).ready(function () { $('.tb').keypress(function (e) { if (e.keyCode == 13) { $(this).trigger("keydown", [9]); alert("return pressed"); } }); }); <asp:TextBox ID="TextBox1" runat="server" CssClass="tb"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server" CssClass="tb"></asp:TextBox> but it just does

Simulate a click on 'a' element using javascript/jquery

被刻印的时光 ゝ 提交于 2019-11-28 17:22:30
I am trying to simulate a click on on an element. HTML for the same is as follows <a id="gift-close" href="javascript:void(0)" class="cart-mask-close p-abs" onclick="_gaq.push(['_trackEvent','voucher_new','cart',$(this).attr('rel')+'-mask_x_button-inaction']);" rel="coupon"> </a> How can i simulate a click on it. I have tried document.getElementById("gift-close").click(); But its not doing anything Using jQuery: $('#gift-close').trigger('click'); Using JavaScript: document.getElementById('gift-close').click(); Using jQuery: $('#gift-close').click(); Try to use document.createEvent described

Simulate touch on ios7/8

和自甴很熟 提交于 2019-11-28 12:14:23
问题 I want to simulate a touch on iOS7/8, I googled and I found that the API are changed from iOS6 to iOS 7 and I should use the IOHIDEvent (in IOKit.framework) for touch events but I didn't get a good example to start PLZ if anybody have an idea to begin give me how to do it . 回答1: You could begin by reading this : https://developer.apple.com/library/mac/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/Introduction/Introduction.html, the official documentation. And this : http://ios-blog