return FALSE; $r = well_tag_thread__update(array('id' => $id), $update); return $r; } function well_tag_thread_find($tagid, $page, $pagesize) { $arr = well_tag_thread__find(array('tagid' => $tagid), array('id' => -1), $page, $pagesize); return $arr; } function well_tag_thread_find_by_tid($tid, $page, $pagesize) { $arr = well_tag_thread__find(array('tid' => $tid), array(), $page, $pagesize); return $arr; } ?>What would be the reason that Ubuntu fails to execute the xdotool key period command? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

What would be the reason that Ubuntu fails to execute the xdotool key period command? - Stack Overflow

programmeradmin2浏览0评论

running a script that uses the "xdotool", "key comma" and "xdotool", "key period". Yet it seems to skip the period commands entirely or perhaps can't interpret them?

Using OS Ubuntu 22.04.4 LTS

static void processBaseImage(string windowName, string directoryPath)
        {
            string baseImage = processWindow(windowName, directoryPath, "base");
            if (baseImage != null)
            {
                Thread.Sleep(1000);
                Process.Start("xdotool", "key comma");
                string zoomedOutImage = processWindow(windowName, directoryPath, "zoomed_out");
                if (zoomedOutImage != null)
                {
                    // add a few extra zoom in keystrokes to ensure image has been adjusted as by human eye its difficult to see
                    // however the image compare function does tell us that the images are different
                    Console.WriteLine("Zooming in functions to begin");
                    Thread.Sleep(1000);
                    Process.Start("xdotool", "key period");
                    Process.Start("xdotool", "key period");
                    Console.WriteLine("Zooming in functions completed");
                    string zoomedInImage = processWindow(windowName, directoryPath, "zoomed_in");
                    compareImagesForFocus(baseImage, zoomedOutImage, zoomedInImage, directoryPath);
                }
            }
        }

The comma key emulation works without issue, but the period emulation just doesn't happen. from the documents "key period" is the proper way to invoke the "." key, and if changed to "." instead of "period" we get and invalid sequence error. Im able to get both console lines stating the zooming in function to begin and completed, so it really feels like we're just skipping right over the period commands, would anyone have any ideas as to why? or perhaps an alternative?

running a script that uses the "xdotool", "key comma" and "xdotool", "key period". Yet it seems to skip the period commands entirely or perhaps can't interpret them?

Using OS Ubuntu 22.04.4 LTS

static void processBaseImage(string windowName, string directoryPath)
        {
            string baseImage = processWindow(windowName, directoryPath, "base");
            if (baseImage != null)
            {
                Thread.Sleep(1000);
                Process.Start("xdotool", "key comma");
                string zoomedOutImage = processWindow(windowName, directoryPath, "zoomed_out");
                if (zoomedOutImage != null)
                {
                    // add a few extra zoom in keystrokes to ensure image has been adjusted as by human eye its difficult to see
                    // however the image compare function does tell us that the images are different
                    Console.WriteLine("Zooming in functions to begin");
                    Thread.Sleep(1000);
                    Process.Start("xdotool", "key period");
                    Process.Start("xdotool", "key period");
                    Console.WriteLine("Zooming in functions completed");
                    string zoomedInImage = processWindow(windowName, directoryPath, "zoomed_in");
                    compareImagesForFocus(baseImage, zoomedOutImage, zoomedInImage, directoryPath);
                }
            }
        }

The comma key emulation works without issue, but the period emulation just doesn't happen. from the documents "key period" is the proper way to invoke the "." key, and if changed to "." instead of "period" we get and invalid sequence error. Im able to get both console lines stating the zooming in function to begin and completed, so it really feels like we're just skipping right over the period commands, would anyone have any ideas as to why? or perhaps an alternative?

Share Improve this question asked Mar 18 at 19:10 BlakeTBlakeT 6110 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Have you tried checking if you have xdotool installed? Also try to reproduce this in another C# project, only trying to run xdotool. Check if you have imported System.Diagnostics .

Try using the Process class instead (I wouldn't recommend this one for your use case as it works better on windows, but it might work):

Process xdotool = new Process();

xdotool.StartInfo.FileName = "xdotool";
xdotool.StartInfo.Arguments = "key comma";
xdotool.Start();
xdotool.WaitForExit(); // wait for finish
发布评论

评论列表(0)

  1. 暂无评论