Page 1 of 2 12>
Topic Options
#30870 - 2002-10-17 07:33 PM Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Justin Emlay Offline
Fresh Scripter

Registered: 2002-05-24
Posts: 26
When I perform this script the Target DIR gets filled with the contents from the users Windows DIR???

If InGroup("SYSTEMS")
$Target='C:\Target Folder\'
$Source='\\file\data\SAPB\SAPB.MDB'
Copy 'Source' 'Target'

However when I hard code the Target and Source DIRs it works fine:

If InGroup("SYSTEMS")
$Target='C:\Target Folder\'
$Source='\\file\data\SAPB\SAPB.MDB'
Copy '\\file\data\SAPB\SAPB.MDB' 'C:\Target Folder\'

Am I using the copy function incorrectly? I'm using it just as the examples state.

Thanks

(MCA: extend subject)

[ 07. December 2002, 12:09: Message edited by: MCA ]

Top
#30871 - 2002-10-17 07:35 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Copy $Source $Target

[ 17. October 2002, 19:36: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#30872 - 2002-10-17 07:35 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You're missing the '$' variable indicators in your first copy command. It has to be
code:
copy $source $target

Please read in the KiXtart Manual how variables are used in KiXtart.
_________________________
There are two types of vessels, submarines and targets.

Top
#30873 - 2002-10-17 07:42 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Justin Emlay Offline
Fresh Scripter

Registered: 2002-05-24
Posts: 26
I forgot to revert my code back from hardcoding it. Lets try this again:

When I perform this script the Target DIR gets filled with the contents from the users Windows DIR???

If InGroup("SYSTEMS")
$Target='C:\Target Folder\'
$Source='\\file\data\SAPB\SAPB.MDB'
Copy $Source $Target

However when I hard code the Target and Source DIRs it works fine:

If InGroup("SYSTEMS")
$Target='C:\Target Folder\'
$Source='\\file\data\SAPB\SAPB.MDB'
Copy '\\file\data\SAPB\SAPB.MDB' 'C:\Target Folder\'

Thanks

Top
#30874 - 2002-10-17 07:45 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Put DEBUG ON into the first line of your code, step through it and evaluate your variable contents. I do not believe that those four lines of code are failing in itself. Most likely it's something in the code that you did not post.

And don't forget the ENDIF to close the IF structure.
_________________________
There are two types of vessels, submarines and targets.

Top
#30875 - 2002-10-17 07:56 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Justin Emlay Offline
Fresh Scripter

Registered: 2002-05-24
Posts: 26
Full Code:

CLS

Big
$X = 1
Do
Color w/n
AT ( $X,$X*3 ) "MAISTO"
$X = $X+1
Until $X = 6
Color g+/n
AT ( $X,$X*3 ) "MAISTO"
AT (23,0)
Small

SetTime "\\FILE"

If (Exist("F:\.") = 1)
Use F: /delete /persistent
EndIf
Use F: "\\file\data"

$DefaultUserIDKey = ReadValue("HKEY_CURRENT_USER\Identities", "Default User ID")
$OESubKey="HKEY_CURRENT_USER\Identities\$DefaultUserIDKey\Software\Microsoft\Outlook Express\5.0"
$OERegValue="\\mail\users$$\@USERID"
$WABSubKey="HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\WAB\WAB4\Wab File Name"
$WABRegValue="\\mail\users$$\@USERID\@USERID.wab"
$MyDocSubKey1="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
$MyDocSubKey2="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
$MyDocRegValue="\\FILE\USERS$$\@USERID"
$NewIconKey="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions\{24523867-0178-1422-5555-835448663557}"
$NewIconValue="http://ww2.maisto.com/default.asp"

If (WriteValue($OESubKey,"Store Root",$OERegValue,"REG_SZ") <> 0)
EndIf
If (WriteValue($OESubKey,"SendMDN","1","REG_DWORD") <> 0)
EndIf
If (WriteValue($OESubKey,"SendReceiptToList","0","REG_DWORD") <> 0)
EndIf
If (WriteValue($WABSubKey,"",$WABRegValue,"REG_SZ") <> 0)
EndIf
If (WriteValue($MyDocSubKey1,"Personal",$MyDocRegValue,"REG_SZ") <> 0)
EndIf
If (WriteValue($MyDocSubKey2,"Personal",$MyDocRegValue,"REG_SZ") <> 0)
EndIf
If (WriteValue($NewIconKey,"exec",$NewIconValue,"REG_SZ") <> 0)
EndIf

If InGroup("ORDER ENTRY") OR InGroup("SHIPPING")
$Source='\\file\data\SAPB\SAPB.MDB'
$Target='C:\MAISTO\'
If Exist($Source) AND Exist($Target)
Copy $Source $Target
If @error
EndIf
EndIf
EndIf

c:\maisto gets filled with the contents of the windows DIR (files only).

Thanks for the help

Top
#30876 - 2002-10-17 08:01 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
If (Exist("F:\.") = 1)

is same as:
If Exist("F:\.")

anyway, could you check @curdir
just a wild wild quess...

{edit}
also, why don't you use:
f:\sapb

but unc?

[ 17. October 2002, 20:02: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#30877 - 2002-10-17 08:18 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Justin Emlay Offline
Fresh Scripter

Registered: 2002-05-24
Posts: 26
"If (Exist("F:\.") = 1)"
- I learned by example so thats what I used. I have now removed the 1 portion of the statement.

"anyway, could you check @curdir"
- "? @curdir" returns "c:\windows"

"f:\sapb"
- I used that first and switch to UNC when it wasn't working out for me. I might as well leave it as UNC since that file will be moving away from the F: map in short time.

Top
#30878 - 2002-10-17 08:20 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
eh,heh...
eh?

quote:
c:\maisto gets filled with the contents of the windows DIR (files only).
and current directory is windows dir...

somehow it copies from curdir instead of the source.
_________________________
!

download KiXnet

Top
#30879 - 2002-10-17 08:23 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
also, these:
If (WriteValue($NewIconKey,"exec",$NewIconValue,"REG_SZ") <> 0)
EndIf

are just the same as:
$nul=WriteValue($NewIconKey,"exec",$NewIconValue,"REG_SZ")

just not solving the problem with this but the script is a lot shorter without the unneeded stuff.
_________________________
!

download KiXnet

Top
#30880 - 2002-10-17 08:33 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Try this:
code:
$Source='\\file\data\SAPB\SAPB.MDB'
$Target='C:\MAISTO\'
If Exist($Source) AND Exist($Target)
? 'source = '+$Source
? 'target = '+$Target
Copy $Source $Target
endif



[ 17. October 2002, 20:41: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#30881 - 2002-10-17 08:55 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Justin Emlay Offline
Fresh Scripter

Registered: 2002-05-24
Posts: 26
Lonkero:
I'm sure there are many ways of doing just about everything. As I stated before I leanred from examples from this forum.

sealeopard:
source = c:\windows
destination = C:\MAISTO\

To add to the confusion. I have no problems on W2K, this is only happening on Win98 machines.

Top
#30882 - 2002-10-17 08:58 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
I think that reduces the confusion...
I'd be tempted to change the current directory to be the source directory...

[ 17. October 2002, 21:12: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
#30883 - 2002-10-17 09:00 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I just wonder, how it didn't work with f:\...

I know that win9x has issues but that is as simple at it can get...
_________________________
!

download KiXnet

Top
#30884 - 2002-10-17 09:18 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well, I doubt the true path is $Source='\\file\data\SAPB\SAPB.MDB' and that it has been sterilized. In so doing, we cannot see what the real culprit is.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#30885 - 2002-10-17 09:23 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Oh man, another case of not enough information provided by the original poster.

You cannot use UNC names under Windows 9x if you try to copy files during the login process. That's why the COPY command itself reverts back to it's default C:\WINDOWS setting despite the fact that the variable $source has been set correctly.
_________________________
There are two types of vessels, submarines and targets.

Top
#30886 - 2002-10-17 09:26 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
still back to my question before, how it ain't working with f:\...
_________________________
!

download KiXnet

Top
#30887 - 2002-10-17 09:29 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please try
code:
Use F: /delete /persistent
Use F: '\\file\data'
$Source='F:\SAPB\SAPB.MDB'
$Target='C:\MAISTO\'
If Exist($Source) AND Exist($Target)
? 'source = '+$Source
? 'target = '+$Target
Copy $Source $Target
? 'Error '+@ERROR+' - '+@SERROR
endif

and report back.

[ 17. October 2002, 21:34: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#30888 - 2002-10-17 09:43 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
UNC support has nothing to do with it.
If Justin is to be believed, the line:
? 'source = '+$Source

produced:
source = c:\windows

So then the assignment of $Source has to be brought into question.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#30889 - 2002-10-18 04:29 PM Re: Confused About Logic (COPY by variables doesn't work. FIX paths ok)
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
I think the problem is he was trying to use deep mappings with Win9x which is a no-no.

Does Jens last suggestion resolve this issue for you?
_________________________
Jack

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 905 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.15 seconds in which 0.095 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org