Author |
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: February 27 2008 at 13:38 | IP Logged
|
|
|
I’m trying to use a GLOBAL Variable that contains a path to a file in PH_READFILE. If I use an explicit string it works fine but if the same string is in the variable nothing happens. The syntax I’m using is ph_readfile(ph_getglobal_s("test"))
“test” contains the path to the file. Am I trying something like oranges and bananas instead of oranges and oranges? Or am I missing a simple detail?
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: February 28 2008 at 09:25 | IP Logged
|
|
|
For some apparent reason this started to work after I bounced the system because of a SDM failure. I kept working on it for hours yesterday and then today I spent one minute and it worked.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: February 28 2008 at 14:05 | IP Logged
|
|
|
Well I think I’ll open this up again. It seems to work intermittently. Happens only when a variable is used to point to a string. Has the looks like a directory problem. Any thoughts…
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
jbbtex Senior Member
Joined: February 15 2007 Location: United States
Online Status: Offline Posts: 181
|
Posted: February 28 2008 at 16:22 | IP Logged
|
|
|
Have you tried ph_readfile("{TEST}")
__________________ Brady
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity." - Gen. George S. Patton
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: February 28 2008 at 16:32 | IP Logged
|
|
|
Yup, that too. In fact it will fail if I try ph_fileexists using a variable. Explicit strings work. I’m trying to read a list of paths in a file and read that file. The only way I’ve gotten around it is to copy the file to a different name and then read it using
ph_copyfile(ph_readfile("C:\Powerhome\POP3\outputIndex.txt") ,"C:\Powerhome\POP3\VoipMail.txt",1)
This seems to work…
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
jbbtex Senior Member
Joined: February 15 2007 Location: United States
Online Status: Offline Posts: 181
|
Posted: February 28 2008 at 17:41 | IP Logged
|
|
|
So Pete, you're reading a file and parsing it to get a path and filename of a file you want to read?
__________________ Brady
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity." - Gen. George S. Patton
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: February 28 2008 at 17:51 | IP Logged
|
|
|
Brady, you’ve got the picture. This is what’s in the file:
C:\Powerhome\POP3\VOIP128487012862031250.txt
I’m pulling that into a variable as a string and using that string in a readfile. If I use a ph_fileexists I get the same results which leads me to believe it is directory failure between PH and XP. So far my work around is working:
ph_copyfile(ph_readfile("C:\Powerhome\POP3\outputIndex.txt") ,"C:\Powerhome\POP3\VoipMail.txt",1)
ph_readfile("C:\Powerhome\POP3\VoipMail.txt")
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
jbbtex Senior Member
Joined: February 15 2007 Location: United States
Online Status: Offline Posts: 181
|
Posted: February 28 2008 at 19:25 | IP Logged
|
|
|
The only other thing I can think of that may be a problem is CR/LFs or other control characters that you're picking up when parsing.
__________________ Brady
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity." - Gen. George S. Patton
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 28 2008 at 19:47 | IP Logged
|
|
|
I just whipped up a test macro...
Code:
10 Formula ph_writefile ( "C:\Program Files\powerhome\beach.txt", 1, "C:\Program Files\powerhome\cid.ini" )
20 Set System [LOCAL1] ph_readfile( "C:\Program Files\powerhome\beach.txt")
30 Message Box No TTS "[LOCAL1]"
40 Set System [LOCAL2] ph_readfile( "[LOCAL1]")
50 Message Box No TTS "[LOCAL2]" |
|
|
This works. Is this close to what you are doing?
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: February 28 2008 at 20:57 | IP Logged
|
|
|
Brady, I had the same thought and edited the file to make sure the Cr/LF were out but to no avail. I tried putting quotes around them and that didn’t work.
Tony, I get one message box:
TEST C:\Program Files\powerhome\cid.ini
Basically this part is what I am trying:
Set System [LOCAL2] ph_readfile( "[LOCAL1]")
Message Box No TTS "[LOCAL2]"
Should I have seen a second message box for LOCAL2?
BTW, how do I delete the message box other than reinit PH???
Edited by BeachBum - February 28 2008 at 21:01
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 28 2008 at 21:59 | IP Logged
|
|
|
Ack! The bit about an "OK" button in the message box was left out.
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: February 29 2008 at 07:58 | IP Logged
|
|
|
Tony,
When I execute only the last 2 statements that is the failure since the file was built by the 1st. Do you get the data in the 2nd msg box with the data on your system????
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 29 2008 at 13:43 | IP Logged
|
|
|
I do.
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: February 29 2008 at 13:53 | IP Logged
|
|
|
That’s interesting. This problem is kind of intermittent. I was getting around it using this:
ph_copyfile(ph_readfile("C:\Powerhome\POP3\outputIndex.txt") ,"C:\Powerhome\POP3\VoipMail.txt",1)
with no problem and now that has stop working. I’m not experiencing anything abnormal yet but I better prepare for the worst if things are getting flaky.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: February 29 2008 at 14:48 | IP Logged
|
|
|
I tested it on my other system and had the same results. I have no clue other than a relation instead of direct does not work with file commands.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|