Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Feature Requests
 PowerHome Messageboard : PowerHome Feature Requests
Subject Topic: Possibility to DISABLE macros Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: October 09 2012 at 08:46 | IP Logged Quote krommetje

Hey Dave,

Is there a possibility in future versions to be able to disable macros from
a formula like this:

ph_macrodisable("ID")

Peter
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: October 09 2012 at 18:15 | IP Logged Quote TonyNo

Devil's advocate: Why disable a macro that is manually called? Just add a variable that is checked at the start.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: October 09 2012 at 18:50 | IP Logged Quote dhoward

Peter,

I agree with Tony. Not sure how it would be really useful. To add this functionality would require mods to the macrodetail table which would then require updates to all exports, etc.

However, you can implement this functionality easy enough yourself. One way would be to use globals that are checked like Tony suggests. Another way which will quite closely duplicate your request is detailed below.

First, make the first line of every macro an "End Macro" command and then click the "Skip" column. This will be the default. To disable a macro, just use this formula:

Code:
ph_directsql("update macrodetail set skip_line = 0 where type = 39 and sequence = 1 and id = 'YOUR_MACRO_ID'")


To enable a macro, use this:

Code:
ph_directsql("update macrodetail set skip_line = 1 where type = 39 and sequence = 1 and id = 'YOUR_MACRO_ID'")


Simple. If you'd like to programmatically add that first line to all of your macros, open the PH Multi-editor and switch to SQL mode (shift-F5). Then run this SQL command:

Code:
update macrodetail set sequence = sequence + 1


After the above completes (make sure you ONLY run it once), run this SQL command:

Code:
insert into macrodetail select id,1,39,null,null,null,1,null,null from macroheader


Thats it. Every macro will now have as the first line a "skipped" End Macro command. You'll now be able to quickly enable/disable macros via code.

You may want to make a backup of your database before trying the above. I tested everything and it worked fine on my system but just to be sure...

Hope this helps,

Dave.


Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum