rejetto forum
May 25, 2012, 02:08:07 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Does {.inc|A|B.} have an optional parameter B?  (Read 1087 times)
0 Members and 2 Guests are viewing this topic.
80063r
Experienced poster
***
Offline Offline

United States United States

Posts: 40


View Profile
« on: May 22, 2009, 10:44:19 AM »

Does {.inc|A|B.} have an optional parameter B?

Would {.inc|A.} work also?

The wiki does not say that B is optional.
Logged
bacter
Operator
Insane poster
*****
Offline Offline

Spain Spain

Posts: 679


View Profile
« Reply #1 on: May 22, 2009, 12:33:48 PM »

inc and dec macros:

{.inc | A | B .}
{.dec | A | B .}

the value of B is the increment (decrement) value to apply. If not present, a default value of 1 is used.

If you have often doubts about the way a macro works, I suggest you to include somewhere in your template (on top or better at the bottom) a line like the following:

Code:
{.if|{.or|{.match address|127.0.0.1|%ip%.}|{.match address|192.168.1.2|%ip%.}.}|{:{.load|test.tpl.}:}.}
this will load a file test.tpl in your HFS-folder (if present) only on the local computer (not to people from lan or wan).

Then editing the file test.tpl you can write some short tests to see what a macro does. In the case of your question, this could be:

Code:
{.set|tt|3.}{.^tt.}<br />
{.inc|tt.}{.^tt.}<br />
{.inc|tt|4.}{.^tt.}<br />

the result shows:
3
4
8

In the case you have a bigger problem with complex macros, you may activate in menu -> debug -> Enable macros.log. This creates a macros.log file where ALL macro execution is shown step by step.

« Last Edit: May 22, 2009, 12:37:45 PM by bacter » Logged

your computer has no brain - use your own !
80063r
Experienced poster
***
Offline Offline

United States United States

Posts: 40


View Profile
« Reply #2 on: May 22, 2009, 05:37:26 PM »

If you have often doubts about the way a macro works, I suggest you to include somewhere in your template ...

I was in the process of doing a skimpy hfs.diff.tpl in a test folder when the template began no longer being applied to that folder.  The other folder with hfs.diff.tpl still works but I can't seem to get the test folder working again.  It just uses the default template.

Thanks for your code though.  I can really use that idea.

Code:
{.if|{.or|{.match address|127.0.0.1|%ip%.}|{.match address|192.168.1.2|%ip%.}.}|{:{.load|test.tpl.}:}.}

I'll have to use 192.168.1.1 though.
Logged
bacter
Operator
Insane poster
*****
Offline Offline

Spain Spain

Posts: 679


View Profile
« Reply #3 on: May 22, 2009, 06:34:42 PM »

if your template does not working.. look in the settings of the folder whats displayed.

You must substitute 192.168.1.2 with the local ip of your PC. But normally by default in most routers, 192.168.1.1 is the address of the gateway and DNS. Verify !
Logged

your computer has no brain - use your own !
80063r
Experienced poster
***
Offline Offline

United States United States

Posts: 40


View Profile
« Reply #4 on: May 22, 2009, 08:17:03 PM »

When I use a DNS name, like http://example.com/test_page, HFS sees my router IP because, I guess, that's where it gets looped back.  Anyway, I got that part under control for the most part except some interference from some privacy add-ons I just installed like Tor Button and Tor, Vidalia, Privoxy, and the BetterPrivacy, RefControl, and SafeCache Add-Ons for firefox.  But that's another whole issue.

Anyway, look at this macros.log output (truncated)

Code:
> %ip%
< 127.0.0.1

> %ip%
< 127.0.0.1

> %url%
< /temporary_test_pages/inc_test/

> match address|127.0.0.1|127.0.0.1
< 1

> match address|192.168.1.1|127.0.0.1
<

> or|1|
< 1

> count substring|temporary_test_pages|/temporary_test_pages/inc_test/
< 1

> and|1|1
< 1

> if|1|{:{.load|test.tpl.}:}
< {.load|test.tpl.}

> load|test.tpl
< <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>

  </body>
</html>

It looks as if the template is getting loaded, but the page still displays the default template.  I didn't change anything in the folder properties.  I just added a local real folder to the VFS.

It seems as though I broke the template feature, except for the one folder which I added first.  It's hfs.diff.tpl is showing properly.

Oh, and by the way, I added this to hfs.tpl

Code:
[special:begin]
{.if|{.and|{.or|{.match address|127.0.0.1|%ip%.}|{.match address|192.168.1.1|%ip%.}.}|{.count substring|temporary_test_pages|%url%.}.}|{:{.load|test.tpl.}:}.}

I bet you hate to see that "Oh, and by the way" stuff.  Sorry.

Oh, and by the way, I tested this i IE7 and the macros.log says it loaded the test.tpl but the page is still showing the default template.
« Last Edit: May 22, 2009, 08:24:45 PM by 80063r » Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #5 on: May 22, 2009, 08:54:11 PM »

i improved {.inc.} description.
thank you for reporting.

has anyone noticed Menu > debug > run script ?
that's what i use for macro testings, no need for your tricks Smiley
Logged
rejetto forum
« Reply #5 on: May 22, 2009, 08:54:11 PM »

Do you like this software? Consider even $2
 Logged
80063r
Experienced poster
***
Offline Offline

United States United States

Posts: 40


View Profile
« Reply #6 on: May 22, 2009, 09:04:58 PM »

has anyone noticed Menu > debug > run script ?

Aha!  rejetto does it again.
Logged
80063r
Experienced poster
***
Offline Offline

United States United States

Posts: 40


View Profile
« Reply #7 on: May 22, 2009, 09:13:21 PM »

What do you think about having a "check box" on the "run script" dialog to choose to automatically focus the output window when the file is saved/run?
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #8 on: May 23, 2009, 06:07:23 AM »

mmmmm
scripting is actually for expert users.
it's amiss to expect such users to reduce the editor window so that they can see the output window? ^^'
this doesn't mean i won't make this option, i'm just debating
Logged
80063r
Experienced poster
***
Offline Offline

United States United States

Posts: 40


View Profile
« Reply #9 on: May 24, 2009, 11:14:38 AM »

That was meant to be taken somewhat jokingly.  The fact that you already made a "run script" dialog is great already.  There's no need to be bogged-down by simple things like an extra "check box".

On the serious note, you already did the work of detecting that the file was changed, so focusing the window would be a simple thing to do.
« Last Edit: May 24, 2009, 11:18:24 AM by 80063r » Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #10 on: May 24, 2009, 01:00:23 PM »

i can make a {.focus.} so that you put this command in your script and every time it is run HFS is focused Smiley
this will let you eventually decide to focus HFS on other events, that may be useful.
Logged
80063r
Experienced poster
***
Offline Offline

United States United States

Posts: 40


View Profile
« Reply #11 on: May 24, 2009, 03:46:44 PM »

Thanks, that would be really cool.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page May 20, 2012, 11:54:06 PM