Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help im so near 1

Status
Not open for further replies.

trunky

Programmer
Sep 27, 2001
6
GB
I am so near with the lingo it hurts, all i want to happen is for Lingo to check whether the file is already there before it saves......what am i doing wrong.....help

on mouseEnter me
cursor 280

end

on mouseLeave me
cursor 0

end

on mouseUp

fileXtraObj = new (xtra "filextra3")
volumeList = fileXtraObj.fx_VolumesToList ()
cdRomVolume = ""
repeat with i in volumeList
if fileXtraObj.fx_VolumeIsCDRom (i) then
cdRomVolume = i
exit repeat
end if
end repeat

if cdRomVolume = "" then
alert "Cannot find the CD"
exit
end if


if the platform contains "Windows" then
destinationPath = fileXtraObj.fx_FileopenDialog("", "image.psd", "Enter a filename", True)

-- filecheck = fileXtraObj.fx_FileExists(destinationPath)
-- if destinationPath < filecheck then
-- put false
-- else
-- put true
-- end if

if destinationPath contains &quot;.psd&quot; then
set ext to &quot;&quot;
else
set ext to &quot;.psd&quot;
end if

end if

--if finalPath <> &quot;&quot; then

fileXtraObj.fx_fileCopy (cdRomVolume & &quot;image.psd&quot;, destinationPath & ext)


fileXtraObj = 0

end




 
FileExists returns either 1 (true, file there) or 0 (file not there or error)

this is the fix

filecheck = fileXtraObj.fx_FileExists(destinationPath)
if filecheck = 0 then -- <<<< fixed line here
put false
else
put true
end if
 
what do you mean or what should be inserted into

<<<< fixed line here
 
This is your code that checks if the file is present, was just showing you the line of code I had edited.

-- filecheck = fileXtraObj.fx_FileExists(destinationPath)
-- if destinationPath < filecheck then
-- put false
-- else
-- put true
-- end if

Here is my fixed version of the same code
filecheck = fileXtraObj.fx_FileExists(destinationPath)
if filecheck = 0 then -- this is the fixed big
put false
else
put true
end if
 
Horrid,

I think that i have used the wrong phrases in the command put, (this is my code below).

My problem is that i can not seem to get the FileExists command to return a statement that says do you wish to overwrite as in the fileSave option.

what am i doing wrong ?

on mouseEnter me
cursor 280

end

on mouseLeave me
cursor 0

end

on mouseUp

fileXtraObj = new (xtra &quot;filextra3&quot;)
volumeList = fileXtraObj.fx_VolumesToList ()
cdRomVolume = &quot;&quot;
repeat with i in volumeList
if fileXtraObj.fx_VolumeIsCDRom (i) then
cdRomVolume = i
exit repeat
end if
end repeat

if cdRomVolume = &quot;&quot; then
alert &quot;Cannot find the CD&quot;
exit
end if


if the platform contains &quot;Windows&quot; then
destinationPath = fileXtraObj.fx_FilesaveasDialog(&quot;&quot;, &quot;image.psd&quot;, &quot;Enter a filename&quot;, True)

filecheck = fileXtraObj.fx_FileExists(destinationPath & &quot;.psd&quot;)
if filecheck = 0 then
alert &quot;file already exists please save under different name&quot;


end if

if destinationPath contains &quot;.psd&quot; then
set ext to &quot;&quot;
else
set ext to &quot;.psd&quot;
end if

end if


fileXtraObj.fx_fileCopy (cdRomVolume & &quot;image.psd&quot;, destinationPath & ext)


fileXtraObj = 0

end




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top