View unanswered posts | View active topics



Reply to topic  [ 28 posts ]  Go to page 1, 2  Next
RunCommand plugin 
Author Message
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
This tiny plugin adds some custom menu/toolbar commands.

A more recent version of RunCommand is already included in FlashDevelop 2.0.2 Final
:arrow: Archived Download RunCommand v0.1 (source included)


1. Installation

- close FlashDevelop
- copy RunCommand.dll in the <FD>/plugins/ directory
- edit <FD>/settings/MainMenu.xml or <FD>/settings/ToolBar.xml
and add custom 'Run' and 'Edit' commands to your convenience


2. 'Run' command

Execute a process (with it's output captured) from the project root directory.

Code:
<!-- basic usage -->
<button label="Ant" click="PluginCommand" image="23" tag="Run;ant" />

<!-- save .as files before execution -->
<button label="Ant" click="PluginCommand" image="23" tag="Run;SaveAS;ant" />

<!-- save all files before execution -->
<button label="Ant" click="PluginCommand" image="23" tag="Run;SaveAll;ant" />



3. 'Edit' command

Open a file for edition in FlashDevelop.

Code:
<!-- edit the project's build file -->
<button label="build.xml" click="PluginCommand" image="7" tag="Edit;@PROJECTDIR\build.xml" />

PS: see Arguments processing in FlashDevelop.


Last edited by Philippe on Sun Mar 25, 2007 3:58 pm, edited 4 times in total.



Sat Jul 29, 2006 11:09 pm
Profile WWW
Member

Joined: Mon Dec 26, 2005 6:10 pm
Posts: 165
Reply with quote
Post 
Very awesome!

Now, how would I go about executing a change directory command, so that ant looks in the current project dir again?


Sat Jul 29, 2006 11:34 pm
Profile
Member

Joined: Mon Dec 26, 2005 6:10 pm
Posts: 165
Reply with quote
Post 
OK, I think I got it...

tag="Run;SaveAll;@QUOTEcd @PROJECTDIR@QUOTE&amp;&amp;ant"

translation:

1. save all files
2. cd to project directory
3. run ant

Looks like once you throw a dos command in there, you still need the && to run additional commands.

If there's an easier way, let me know, but this rocks.


Sun Jul 30, 2006 2:01 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Post 
You still can call several commands:
Code:
@QUOTE first command &amp;&amp; second command @QUOTE


But it already automatically changes the working directory to your project root.


Sun Jul 30, 2006 9:02 am
Profile WWW
Member

Joined: Mon Dec 26, 2005 6:10 pm
Posts: 165
Reply with quote
Post 
aha


Sun Jul 30, 2006 12:10 pm
Profile
Member

Joined: Sun Jul 30, 2006 12:58 pm
Posts: 1
Reply with quote
Post 
great...

one more thing, is there any way to open the output panel from a command?

That would save me an extra mouse click :)


Sun Jul 30, 2006 1:00 pm
Profile
Member

Joined: Tue Mar 14, 2006 4:53 am
Posts: 82
Reply with quote
Post 
nice, merci philippe!


Sun Jul 30, 2006 5:56 pm
Profile
Member

Joined: Sun Jan 01, 2006 12:48 pm
Posts: 26
Reply with quote
Post 
how would I execute a file that is in the project directory? say a file called compile.bat?


thanks.


Wed Aug 23, 2006 9:50 pm
Profile WWW
Member

Joined: Tue Mar 14, 2006 4:53 am
Posts: 82
Reply with quote
Post 
<button label="Compile" click="PluginCommand" tag="Run;compile.bat" />


Wed Aug 23, 2006 11:47 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Post 
I got some questions by email:
Quote:
I tried to use your FlashDevelop-Plugin "RunCommand" and noticed that it doesn't work, if you don't work with admin-privileges (as it _shoud_ normally be).

FlashDevelop needs to be allowed to write in the Settings/ subdirectory where it is located. In case this is a problem in Program Files, move the whole application into a user directory - it will work fine.

RunCommand needs only to be allowed to run a command line (using cmd.exe) - this doesn't mean full admin privileges AFAIK.

Quote:
Further it gives the ErrorMessage "No active project", which is somewhat mistakable. Maybe, if you find some time, it is possible to fix this?

Well... I guess you don't have any project defined. RunCommand was created precisely because some users wanted to be able to run a command line from the project root directory.

If you just want to run a command in the location of the current edited document, use the default actions:
Code:
<!-- run interactive application -->
<button label="Windows &amp;Explorer" click="RunProcess" 
        tag="explorer.exe;/e" />

<!-- run non-interactive application with output capture -->
<button label="Capture this" click="RunProcessCaptured" 
        tag="somecommand.exe" />


Thu Aug 24, 2006 8:02 am
Profile WWW
Member

Joined: Thu Aug 24, 2006 9:08 am
Posts: 3
Reply with quote
Post 
Hi, *forum*

FlashDevelop is installed on a seperate partition, along with all other programs. The securety rules say that "everybody" is allowed to do everything - so accessing the Settings/ subdirectory is no problem.

Runnig cmd.exe is also no problem with user-privileges only - I do it several times a day.

If I start FlashDevelop using the runas-command to execute it as "Admin" and hit the RunCommand-Button which sould execute "Run;SaveAll;ant" it works. (Nearly, I get the Error "[exec] Error: unable to open 'F:\webdev\flex\FlashDevelop/src/App.as'" but this isn't your part, I think).

If I start FlashDevelop as normal user and try to use RunCommand, it gives me the error "no active project" and yes, the Project Explorer lists an active project (as it does when executing with admin privileges).

Reading the source code, I noticed that the error "RunCommand error: no active project." is fired when the project directory doesn't exist - this is what I meant with "mistakable" ;-)

I logged the file accesses from FlashDevelop.exe (with Sysinternal's "File Monitor"). The log says that FD tries to open "D:\FlashDevelop\@PROJECTDIR". To me, it seems the problem isn't part of RunCommand but of the method "ProcessArgString".


Thu Aug 24, 2006 9:37 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Post 
Good investigation, SukiSan!

It looks like you are expection some very weird behaviour, so I misunderstood your problem - I hope you don't mind...

The fact is that @PROJECTDIR should be expanded to your project directory if you have the project plugin and if you have an active project - so something wrong is happening.

Please check:
- your .NET 1.1 framework version (it should be C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322),
- the last entry in log.txt in FlashDevelop program directory.


Thu Aug 24, 2006 10:14 am
Profile WWW
Member

Joined: Thu Aug 24, 2006 9:08 am
Posts: 3
Reply with quote
Post 
No problem!

Project plugin? Did I miss something?

.NET framework is installed in version 1.1.4322 and 2.0.50727.

There is no "log.txt" in the FD directory :?
But there is a "ErrorList.log" :) And every try the following block is added:

Code:
System.UnauthorizedAccessException: Der Zugriff auf den Registrierungsschlüssel  wurde verweigert. (the access to the registry key was denied)
   at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
   at Microsoft.Win32.RegistryKey.DeleteSubKeyTree(String subkey)
   at Org.Mentalis.Utilities.FileAssociation.Remove()
   at Org.Mentalis.Utilities.FileAssociation.Create()
   at ProjectExplorer.Helpers.ProjectIcon.Associate()
   at ProjectExplorer.PluginMain.Initialize()
   at FlashDevelop.Utilities.PluginServices.AddPlugin(String fileName)


But I can't figure out which key is tried to be opened...


Thu Aug 24, 2006 4:54 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Post 
Ah ah so that's the issue :D

FYI "ProjectExplorer" is the project manager plugin (almost everything is a plugin in FlashDevelop) - and it (silently) fails to associate the .FDP files with FlashDevelop at startup.

I fixed this issue in the SVN repository so it will handle this exception properly.


Thu Aug 24, 2006 5:36 pm
Profile WWW
Member

Joined: Thu Aug 24, 2006 9:08 am
Posts: 3
Reply with quote
Post 
Why does FlashDevelop try to associate the .FDP files with itself each time I click the RunCommand-Button? Okay, doesn't matter if the problem is fixed ;-)

Does "fixed in the SVN" mean it will be available with the next release, or can I checkout the current version? I didn't found the repos-url...
(Waiting for the next release wouldn't be a problem)

Thanks for your great and fast help! Go on, good work!


Thu Aug 24, 2006 7:00 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 28 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.