rejetto forum
May 26, 2012, 01:53:18 AM *
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: {.for each.} exception  (Read 628 times)
0 Members and 1 Guest are viewing this topic.
raybob
Tireless poster
****
Offline Offline

United States United States

Posts: 206



View Profile WWW
« on: September 01, 2011, 02:18:25 PM »

I'm trying to use HFS to compile an XML file.  Everything works fine except that the command {.for each.} appears to not be working.  I've boiled down my code as much as possible, yet it still doesn't work.  I don't see any errors in my code, although there very well might be.

For debugging purposes I've attached the macro log, in which it states an exception and to report the bug.  According to the log everything processes fine until it gets to the extremely basic {.for each.} command and then it just doesn't process it.

Is it possible that you can't use {.for each.} inside {.save.}, or is this a bug in HFS itself ?

* macros-log.zip (1.25 KB - downloaded 41 times.)
« Last Edit: September 01, 2011, 02:32:50 PM by raybob95 » Logged
raybob
Tireless poster
****
Offline Offline

United States United States

Posts: 206



View Profile WWW
« Reply #1 on: September 01, 2011, 02:31:51 PM »

Upon further testing, it seems that this command doesn't work at all.... however it does work as used in other places of my template such as [ajax.move].  Perhaps it only doesn't work when used in HFS.events?

Here's as simple as I could make it:

Code:
9/1/2011 3:31:24 PM
exists|command.txt
    1
if|1|{: {.load|command.txt.} {.delete|command.txt.} :}
    {.load|command.txt.} {.delete|command.txt.}
load|command.txt
    {.for each|fn|user1|user2|user3|user4|{:{.save|test{.random|1|2|3|4|5|6|7|8|9.}.txt|{.^fn.}.}:}.}
for each|fn|user1|user2|user3|user4|{:{.save|test{.random|1|2|3|4|5|6|7|8|9.}.txt|{.^fn.}.}:}
    <div class=macroerror>macro error: for each<br>cannot be used here</div>
for each|fn|user1|user2|user3|user4|{:{.save|test{.random|1|2|3|4|5|6|7|8|9.}.txt|{.^fn.}.}:}
    Exception, please report this bug on www.rejetto.com/forum/
delete|command.txt

I was also able to reproduce this with a fresh copy of HFS with absolutely nothing changed.

« Last Edit: September 01, 2011, 03:07:15 PM by raybob95 » Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #2 on: September 17, 2011, 01:03:13 PM »

sorry for being so late.
could you provide me an hfs.events that will reproduce the problem on my hfs ?
Logged
raybob
Tireless poster
****
Offline Offline

United States United States

Posts: 206



View Profile WWW
« Reply #3 on: September 17, 2011, 01:05:13 PM »

Like I said, I reproduced this on a fresh install of HFS, so you should be able to with ease.

Hfs.events
Code:
[every 10 seconds]
{.if|{.exists|command.txt.}|{:
{.load|command.txt.}
{.delete|command.txt.}
:}.}

Command.txt
Code:
{.for each|fn|user1|user2|user3|user4|{:{.save|test{.random|1|2|3|4|5|6|7|8|9.}.txt|{.^fn.}.}:}.}



EDIT:

I think I may have also found a similar bug with {.for.} .... try putting this in command.txt:

Code:
{.for|n|1|1000000|{.append|numbers.txt|{.^n.}.}.}

It tells me {.for.} and ^n cannot be used here.


« Last Edit: September 23, 2011, 03:52:47 PM by raybob95 » Logged
raybob
Tireless poster
****
Offline Offline

United States United States

Posts: 206



View Profile WWW
« Reply #4 on: October 03, 2011, 09:12:41 PM »

Here's another example of code that doesn't work....

Code:
{.for each|user|{.replace|;|{.no pipe||.}|{.load|Master User List.txt.}.}|{:{.save|C:\Documents and Settings\Admin\Desktop\Account Keys\{.^user.}.txt|{.load|32 Random.txt.}.}:}.}

Either in command.txt or in Debug>Run Script   in HFS.
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #5 on: October 04, 2011, 04:00:55 AM »

sorry for the late reply.
I understand this is very unclear, the message should be improved.
The reason why it "cannot be used here" it's because you are using simple variables outside a connection.
Simple variables are bound to the connection. You are running those scripts outside a connection.
Anyway, i think the better would be if it would just work as excepected, so i will try to create a temporary context (as for the connection) where to store such variables.
Thank you for pointing it out.
Logged
rejetto forum
« Reply #5 on: October 04, 2011, 04:00:55 AM »

Do you like this software? Consider even $2
 Logged
raybob
Tireless poster
****
Offline Offline

United States United States

Posts: 206



View Profile WWW
« Reply #6 on: October 07, 2011, 12:02:38 PM »

Hey you're right it works in the template....

Here's my finished Ajax Script Smiley

Code:
[ajax.FTP]

{.if|{.and|{.cookie|username.}|{.cookie|accountkey.}|{.=|{.cookie|accountkey.}|{.load|C:\Documents and Settings\admin\Desktop\Account Keys\{.cookie|username.}.txt.}.}.}|{:{.set|loggedon|1.}{.set|username|{.cookie|username.}.}:}.}

{.if|{.^username.}|{:
{.if|{.exists|C:\documents and settings\admin\desktop\FTP Config\{.^username.}.txt.}|{:{.set|action|delete.}:}|{:{.set|action|add.}:}.}

{.if|{.=|{.^action.}|add.}|
{:{.append|C:\documents and settings\admin\desktop\FTP Config\USERS.txt|;{.^username.}.}:}|
{:{.save|C:\documents and settings\admin\desktop\FTP Config\USERS.txt|{.replace|;{.^username.}||{.load|C:\documents and settings\admin\desktop\FTP Config\users.txt.}.}.}:}.}

{.if|{.=|{.^action.}|add.}|
{:{.mkdir|D:\[USER FILES]\{.^username.}\FTP Shared.}:}.}

{.if|{.=|{.^action.}|add.}|
{:{.save|C:\documents and settings\admin\desktop\User Options\{.^username.}\FTP.txt|YES.}:}|
{:{.delete|C:\documents and settings\admin\desktop\User Options\{.^username.}\FTP.txt.}:}.}


{.if|{.=|{.^action.}|add.}|{:
{.save|c:\documents and settings\admin\desktop\ftp config\{.^username.}.txt|
<User Name="{.^username.}">
            <Option Name="Pass">{.if not|{.postvar|password.}|{:{.get account|{.^username.}|password.}:}|{:{.postvar|password.}:}.}</Option>
            <Option Name="Group" />
            <Option Name="Bypass server userlimit">0</Option>
            <Option Name="User Limit">0</Option>
            <Option Name="IP Limit">0</Option>
            <Option Name="Enabled">1</Option>
            <Option Name="Comments" />
            <Option Name="ForceSsl">0</Option>
            <IpFilter>
                <Disallowed />
                <Allowed />
            </IpFilter>
            <Permissions>
                <Permission Dir="C:\FTP Home">
                    <Option Name="FileRead">1</Option>
                    <Option Name="FileWrite">0</Option>
                    <Option Name="FileDelete">0</Option>
                    <Option Name="FileAppend">0</Option>
                    <Option Name="DirCreate">0</Option>
                    <Option Name="DirDelete">0</Option>
                    <Option Name="DirList">1</Option>
                    <Option Name="DirSubdirs">1</Option>
                    <Option Name="IsHome">1</Option>
                    <Option Name="AutoCreate">0</Option>
                </Permission>
                <Permission Dir="D:\[USER FILES]\{.^username.}\[private]">
                    <Aliases>
                        <Alias>/PRIVATE</Alias>
                    </Aliases>
                    <Option Name="FileRead">1</Option>
                    <Option Name="FileWrite">1</Option>
                    <Option Name="FileDelete">1</Option>
                    <Option Name="FileAppend">1</Option>
                    <Option Name="DirCreate">1</Option>
                    <Option Name="DirDelete">1</Option>
                    <Option Name="DirList">1</Option>
                    <Option Name="DirSubdirs">1</Option>
                    <Option Name="IsHome">0</Option>
                    <Option Name="AutoCreate">0</Option>
                </Permission>
                <Permission Dir="D:\[USER FILES]\{.^username.}\FTP Shared">
                    <Aliases>
                        <Alias>/SHARED</Alias>
                    </Aliases>
                    <Option Name="FileRead">1</Option>
                    <Option Name="FileWrite">1</Option>
                    <Option Name="FileDelete">1</Option>
                    <Option Name="FileAppend">1</Option>
                    <Option Name="DirCreate">1</Option>
                    <Option Name="DirDelete">1</Option>
                    <Option Name="DirList">1</Option>
                    <Option Name="DirSubdirs">1</Option>
                    <Option Name="IsHome">0</Option>
                    <Option Name="AutoCreate">0</Option>
                </Permission>
            </Permissions>
            <SpeedLimits DlType="0" DlLimit="10" ServerDlLimitBypass="0" UlType="0" UlLimit="10" ServerUlLimitBypass="0">
                <Download />
                <Upload />
            </SpeedLimits>
        </User>
.}:}|{:{.delete|c:\documents and settings\admin\desktop\ftp config\{.^username.}.txt.}:}.}



{.if|{.=|{.^action.}|add.}|{:
{.save|c:\documents and settings\admin\desktop\FTP config\{.^username.}-anonymous.txt|                
<Permission Dir="D:\[USER FILES]\{.^username.}\FTP Shared">
                    <Aliases>
                        <Alias>/{.^username.}</Alias>
                    </Aliases>
                    <Option Name="FileRead">1</Option>
                    <Option Name="FileWrite">0</Option>
                    <Option Name="FileDelete">0</Option>
                    <Option Name="FileAppend">0</Option>
                    <Option Name="DirCreate">0</Option>
                    <Option Name="DirDelete">0</Option>
                    <Option Name="DirList">0</Option>
                    <Option Name="DirSubdirs">0</Option>
                    <Option Name="IsHome">0</Option>
                    <Option Name="AutoCreate">0</Option>
                </Permission>
.}:}|{:{.delete|c:\documents and settings\admin\desktop\ftp config\{.^username.}-anonymous.txt.}:}.}



{.delete|C:\Program Files\FileZilla Server\FileZilla Server.xml.}

{.save|C:\Program Files\FileZilla Server\FileZilla Server.xml|<FileZillaServer>
{.load|C:\documents and settings\admin\desktop\FTP Config\SETTINGS.txt.}
<Groups />
<Users>
{.load|C:\documents and settings\admin\desktop\FTP Config\ANONYMOUS1.txt.}
{.for each|user|{.replace|;|{.no pipe||.}|{.load|C:\documents and settings\admin\desktop\FTP Config\users.txt.}.}|{:{.if|{.!=|{.^user.}|null.}|{:{.load|C:\documents and settings\admin\desktop\FTP Config\{.^user.}-anonymous.txt.}:}.}:}.}
{.load|C:\documents and settings\admin\desktop\FTP Config\ANONYMOUS2.txt.}
{.for each|user|{.replace|;|{.no pipe||.}|{.load|C:\documents and settings\admin\desktop\FTP Config\users.txt.}.}|{:{.if|{.!=|{.^user.}|null.}|{:{.load|C:\documents and settings\admin\desktop\FTP Config\{.^user.}.txt.}:}.}:}.}
</Users>
</FileZillaServer>.}

{.exec|Reload Config.bat.}

{.if|{.=|{.^action.}|add.}|New FTP Account Added Successfully!.}
{.if|{.=|{.^action.}|delete.}|FTP Account Deleted Successfully!.}

:}|{:{.redirect|/~deny.}:}.}


Code:
<script type="text/javascript">

function AJAXDisableFTP() { $.post("/~ajax.FTP", function(data) { $.prompt(data, { buttons:{Submit:"Submit"}, submit: function(){ window.location = '{.get account|{.^username.}|redirect.}'; } } ); }); }

function AJAXEnableFTP() {

var passwordinput = 'Enter your desired FTP Password or leave the field<br />blank to use your current HTTP account password:<br /><div style="height:16px;"></div><input name="password" type="password" size="60" /><br /><div style="height:16px;"></div>This password cannot be changed later!';
$.prompt(passwordinput,{ buttons:{Submit:"Submit"}, submit: function(v,m,f){ $.post("/~ajax.FTP", { password: f.password }, function(data) { $.prompt(data, { buttons:{Submit:"Submit"}, submit: function(){ window.location = '{.get account|{.^username.}|redirect.}' } } ); }); } });

}

</script>
« Last Edit: October 09, 2011, 06:13:17 PM by raybob95 » Logged
raybob
Tireless poster
****
Offline Offline

United States United States

Posts: 206



View Profile WWW
« Reply #7 on: October 10, 2011, 09:20:33 PM »

Also it seems as if {.disconnect.} does not work under the [download] events section....

Sorry Rejetto if I'm overloading you with requests this really already is great software and I'm a little over-zealous  Wink
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #8 on: October 23, 2011, 07:36:35 AM »

Also it seems as if {.disconnect.} does not work under the [download] events section....

it works here. I put this in the events and i'm correctly prevented from downloading anything.

[download]
{.disconnect.}

Quote
Sorry Rejetto if I'm overloading you with requests this really already is great software and I'm a little over-zealous  Wink


it's alright, it's not you Smiley
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 24, 2012, 08:52:10 AM