Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Outlook Express hangs Win 95 Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Deano
Groupie
Groupie
Avatar

Joined: February 19 2003
Location: United States
Online Status: Offline
Posts: 75
Posted: June 09 2004 at 08:02 | IP Logged Quote Deano

Outlook express errors hang Win 95 and Power Home with a modal dialog box displayed. 

Is there a way to trap and handle errors like this?

Back to Top View Deano's Profile Search for other posts by Deano
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 09 2004 at 10:57 | IP Logged Quote dhoward

Dean,

Is this when using the ph_processemail function or "Process Email" macro command?  If so, you can try the ph_processemailthread function.  This will launch the process email task in a separate thread so that if it does hang, it will not hang PowerHome.  However, this function does NOT seem to work on Windows XP so it may have problems in Windows 95 as well.  In any event, the next version will have the ph_processemailthread function fixed so instead of being a separate thread, it's actually a separate app and this will fix the problem with hanging in some OS'es.

If this is not related to PowerHome's process email, then Im not sure what can be done.  Errors in Outlook Express should not hang PowerHome or Windows unless PowerHome launched Outlook Express.

Let me know,

Dave.

 

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

Joined: February 19 2003
Location: United States
Online Status: Offline
Posts: 75
Posted: June 10 2004 at 09:18 | IP Logged Quote Deano

Dave,

I am using "Send Email" when my motion count reaches a threshold, then I execute a macro that uses "Process Email" every 2 min. so I can respond by Email from my cell phone.

I'll try ph_processemailthread function even though I don't know what you mean by thread in this context.

BTW, I'm  a little confused about the difference between macro cammands and functions

Here is what I think:

     Macro commands can only be used in macros.

     functions can be used in triggers, timed events and ????

          Send Keys send result of function to PH

          Formula does ?????

Would I use formula in a macro to construct a For Next Loop?

I'm still using Jump, the equivalent of GOTO which is probably causing Nicholas Wirth to roll over in his grave.

How come some functions start with PH and others don't?  This complicates searching help.

Is there a wild card character in help search?  (*wild* would return everything with wild in the function name)

I know I need to RTFM some more but a source of documented examples would be invaluable.

Back to Top View Deano's Profile Search for other posts by Deano
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 10 2004 at 15:51 | IP Logged Quote dhoward

Dean,

The "Send Email" macro command uses MAPI which will open your Outlook Express and could cause a hang.  You'll want to use the ph_sendsmtpemail formula function instead to eliminate any chance of hanging.

The "Process Email" macro command also can hang.  The ph_processemailthread function uses the same technique to process incoming email but is instead launched in a separate "thread" or process different from PowerHome.  It can still hang, but the separate process will be hung and PowerHome can continue working.

Macro commands are the actions that each macro detail line can perform.  It is the third column from the left and is labeled "Type".  These commands only exist within macros, however, almost every macro command is duplicated with a formula function.  Some that are not duplicated are the "Message Box", "Goto Label", "Jump", etc because these only make sense within the context of a macro.

Formulas are nothing more than a logical mathematical relationship.  1 + 2 is a formula.  We are simply adding two numbers together.  "This is " + "a string" is also a formula.  Here Im adding two strings together which essentially concatenates them.  It's not really mathematical, but in terms of computers and PowerHome, we can treat it the same way.  Now in order for a formula to make sense, we entity within the formula must be the same type.  You cant add a string to a number or similar.  Now, there are functions that will convert between string and number and vice/versa as well as the other entity types.  This is illegal: "The result is " + 4.  This is legal: "The result is " + string(4).  The other valid entity types are date, time, and datetime.

Now that we understand a formula, we have a large number of functions that can be used within a formula.  The PowerHome specific formulas all start with "ph_".  A function will return a single value that is either string, numeric, date,time, or datetime.  You can add, subtract, etc. functions pretty much just like you do numbers.  If the result of a function returns a number, you can add that to a number.  If you wanted to add a numeric function to a string, you could convert the output of the numeric function to a string and add it to a number. 

A formula is evaluated from left to right in order of the rules of precedence.  Multiplication and division are performed first followed by addition and subtraction.  You can use parenthesis to force a particular order.

When PowerHome encounters a formula, it is evaluated.  Once a formula is evaluated, it will produce a result.  In some cases, this result may be important and can be used elsewhere.  In other cases, the act of the formula evaluation (usually with functions involved) produces the desired result.

Say you wanted to send an X-10 command to turn a light at C5 on.  You could do this with a couple of macro commands, a couple of formulas, or a single formula.  If using formulas, you could evaluate first: ph_x10(1,"C",5,0).  The result of this function will be 0.  You could then next evaluate: ph_x10(1,"C",102,0) and the light at C5 will turn on.  The result of this formula will also be 0.  You could also add these two formulas together within a single formula: ph_x10(1,"C",5,0) + ph_x10(1,"C",102,0).  This will have a result of 0 as well.

I hope that helps to understand formulas and the difference between them and macro commands a little better .

Functions are used only within formulas.  Formulas that are usually specific to PowerHome for controlling things start with "ph_".  Other functions that don't start with "ph_" are typically generic such as if(),string(),mid(),integer(),etc.  Some of the "ph_" functions won't seem to be specific to PowerHome control but instead have a specialized purpose.

Where can formula's be used?  Just about anywhere.  They are used in a large number of macro commands (always in the "Send Keys / TTS / Dim / Formula" field).  They can be used in triggers, timed events, voice recognition, etc.  There is a macro command called "Formula" whose only purpose is to allow you to evaluate a formula.  There is also a formula function called "ph_macro" which allows you to call a macro.

A "Send Keys" is a formula.  This formula is evaluated and the result is sent as keystrokes to the current application with focus.  This could be PowerHome or it could be another application that you switched to with either a macro command or the ph_switchto function.  This Send Keys formula can be as simple as: "This is a string of characters which will be sent as keystrokes to the current application with focus".  You can see that this is just a string, but it satisfies the rules of a formula.  This formula will be "evaluated" which will just return the string itself as the result.  This result is then sent as keystrokes to the app with focus.

There is also a formula function called "ph_sendkeys()".  The string within the function will be sent as keystrokes to the current application.

You can use a formula to create a for-next type of statement.  There is a formula function ph_forloop (as well as ph_whileloop and ph_doloop).  It's handy to use when you need looping within a formula.  But if you are trying to create looping within a macro, you're better off to use the "Jump" command or the "Label", "Goto Label" commands (yes, ol' Nicholas would be rolling ).  In the "Send Keys / TTS / Dim / Formula" field of a "Jump" or "Goto Label" command, you can use a formula.  It can be as simple as "- 6" to jump back six lines or more complicated such as: case([LOCAL1] when 1 then "SET TEMPERATURE" when 2 then "SET HUMIDITY" when 3 then "GET TIME" else "EXIT") in the case of a "Goto Label" command to conditionally jump to certain locations based upon the value of the [LOCAL1] system variable.

The help is a standard Windows Compiled HTML help file (at least for the functions which is all I have in there right now).  If you go to the "Search" tab and type something such as "x10" it will search for anyplace within the text that the "x10" appears.  From my testing, it can be a separate word or a part of a whole word, in effect automatically being a wildcard search.  Let me know if Ive got this wrong.

And last, but not least (I think I hit upon all your questions ), you can see some samples by opening up the samples database (you may have already done this because I see you mention "documented examples").  If you havent already, you can open the sample database directly from the PowerHome Explorer by pressing the "F7" key (or pressing the appropriate toolbar button or navigating the menu Edit->Database) and selecting the sample database default located in c:\program files\powerhome\database\phsample.db.  This is pretty much a duplicate of my own database and while the code is not documented, does show a lot of what can be done.

Sorry to be so lengthy, but I hope this helps.

Dave.

 

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

Joined: February 19 2003
Location: United States
Online Status: Offline
Posts: 75
Posted: June 11 2004 at 13:06 | IP Logged Quote Deano

Dave,

I think I'm beginnig to get it.  The following helped a lot.

"There is a macro command called "Formula" whose only purpose is to allow you to evaluate a formula."

Finding formula as a macro command was troublesome.  Does it work like verify in the formula builder?

Thanks

 

Back to Top View Deano's Profile Search for other posts by Deano
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 11 2004 at 13:36 | IP Logged Quote dhoward

Dean,

Exactly.  When you press "Verify" a formula in the formula builder, the formula is evaluated and the result is displayed in a message box.  The only difference with the "Formula" command within a macro is that the result is simply discarded.

Another example is when you use the "Set System" command in a macro.  You can choose the system variable you would like to "set" such as [LOCAL1] - [LOCAL10].  In this situation, the "Send Keys/Dim/TTS/Formula" field contains a formula.  The formula is evaluated and the result is assigned to the specified system variable.  When you use the "Formula" command, its exactly the same only the result doesnt go anywhere.

HTH,

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