XWidgetSoft Forum
https://www.bbs.xwidget.com/

I need help, Open(string) function doesn't work
https://www.bbs.xwidget.com/viewtopic.php?f=8&t=3661
Page 1 of 1

Author:  Snutzu [ October 18th, 2013, 2:14 pm ]
Post subject:  I need help, Open(string) function doesn't work

Hi there. Today I edited this mouse gesture win8 volume (which BTW is an amazing, very handy widget, thanks to qiancang) and xWidget just doesn't want to run the Open path function.

I need some help with this portion of the code: ( if needed, I can post the whole code)

Code:
   if (!isKeyDown(1) && isKeyDown(2))
             {
         if(mouseX>1300)
         {
           Open("C:\Program Files\eclipse\eclipse.exe"); // <<< here on this line, Open function doesnt open any path, only URLs
         }
             }


Some info about how should the widget work: the widget is made visible by pressing both left and right clicks, and then after releasing the left click, by simply moving the mouse cursor to the right edge of the screen, the widget should open a desired file or path. The widget disappears after releasing the right click.

Everytime I trigger the Open(string) function, it just doesn't open the path. It only works with URLs. This is so frustrating... Any ideas?

I am using Windows 8, xWidget ver: 1.8.4.716

Author:  meme [ October 18th, 2013, 9:13 pm ]
Post subject:  Re: I need help, Open(string) function doesn't work

Try
run("C:\Program Files\eclipse\eclipse.exe");

Author:  Snutzu [ October 18th, 2013, 10:32 pm ]
Post subject:  Re: I need help, Open(string) function doesn't work

Well I did, still not working. I dont even know what alternatives I have, beucause Open2 does the same. Maybe linking a shortcutcore? Do you know how can I trigger the shortcutcore, by moving the mouse cursor to a given area of the screen ?

Author:  meme [ October 18th, 2013, 11:00 pm ]
Post subject:  Re: I need help, Open(string) function doesn't work

Sorry if you have already done some of these but -
1 - Are you sure the line is being triggered ? add alert("triggered "); after the line to test if it is being triggered.
2 - Run the line run("C:\Program Files\eclipse\eclipse.exe"); from a button press to see if it works.

Author:  digigamer [ October 18th, 2013, 11:07 pm ]
Post subject:  Re: I need help, Open(string) function doesn't work

First check if the if block is being called properly.

Code:
f (!isKeyDown(1) && isKeyDown(2))
             {
         if(mouseX>1300)
         {
            print("should open a program");
           //Open("C:\Program Files\eclipse\eclipse.exe"); // <<< here on this line, Open function doesnt open any path, only URLs
         }
             }

ALternatively you can try
Code:
WScript.Exec("C:\Program Files\eclipse\eclipse.exe");

Author:  Snutzu [ October 18th, 2013, 11:57 pm ]
Post subject:  Re: I need help, Open(string) function doesn't work

Thanks for the idea of printing a message for checking the execution of the code in the specific block, but still the same. If you want to, I can upload the widget.
And for the WScript, I get an error. I searched for a quick fix but I am currently learning java, and I don't know much of scripting languages (JS, VB).

Attachments:
Screenshot (62).png
Screenshot (62).png [ 9.63 KiB | Viewed 7757 times ]

Author:  digigamer [ October 19th, 2013, 12:51 am ]
Post subject:  Re: I need help, Open(string) function doesn't work

Did you copy the line verbatim? I referred to the WScript.Shell ActiveX object. Well, you mentioned that you are learning java, so these terms might be new to you. So here's the process:
Code:
var shell = new ActiveXObject("WScript.Shell");
shell.Exec("cmd.exe"); //put whatever path you want


These links will be helpful to learn more about scripting
http://msdn.microsoft.com/en-us/library/bb871583.aspx

Author:  Snutzu [ October 19th, 2013, 1:42 am ]
Post subject:  Re: I need help, Open(string) function doesn't work

:o digigamer, thanks mate, you freaking ROCK !!! After a couple of tweaks, I found the solution:
shell.run("cmd /k start _path_", 0, false);
Now I can continue the work for my widget :) It will be a gesture based one, by simply dragging the cursor to a spot for performing different tasks, like show desktop (I like to hide my taskbar), or quickly getting to a link, etc. (possibilities are unlimited)
Cheers :D

Author:  digigamer [ October 19th, 2013, 5:40 am ]
Post subject:  Re: I need help, Open(string) function doesn't work

IMO, you won't require to prepend "cmd /k" in the path. (Unless, your OS is 64 bit)
And what's wrong with the Exec() didn't that work?

Author:  Snutzu [ October 21st, 2013, 1:20 am ]
Post subject:  Re: I need help, Open(string) function doesn't work

Exec() didn't work for whatever reason (it was an error or something) and yes, I am on 64bit WIN8.

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/