PDA

View Full Version : Argument 2 must be of typed string


rctshine
03-21-2005, 06:57 PM
I get this message when trying to unzip a file.

Here is the code I am using:

-- These actions are performed before the screen is shown.

--Instructions.
result = Dialog.Message("Notice", "A box will now pop up. in this box, please select where you would like the program to install the Darkflash template.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
--Rename for Unzipping.
file_rn = File.Rename("_TempFolder..\\xaosd.txt", "_TempFolder..\\xaosd.zip");
--check for errors.
error1 = Application.GetLastError();
--if there are errors, display them.
if (error1 ~= 0) then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
else
-- Allow the user to select a directory to unzip the files.
target_folder = Dialog.FolderBrowse("Select a Folder", "C:\\");
-- Check to see if the user cancelled or an error occurred.
if (target_folder ~= "CANCEL") and (target_folder ~= "") then
-- Gets a list of the contents of a zip file.
zip_contents = Zip.GetContents("_TempFolder..\\xaosd.zip", true);

-- Get the error code of the last action.
error = Application.GetLastError();

-- If an error occurred, display the error code message.
if (error ~= 0) then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
else
-- Take the table and turn it into a string with newlines for displaying.
zip_contents_display = Table.Concat(zip_contents, "\r\n", 1, TABLE_ALL);

-- Ask the user if they are sure they would like to unzip the contents.
result2 = Dialog.Message("Information", "The following files will be unzipped:\r\nClick the Cancel button to abort the process.\r\n\r\n"..zip_contents_display, MB_OKCANCEL)

-- If the user clicked Ok, unzip the files.
if (result2 == IDOK) then
-- Show the status dialog.
StatusDlg.Show();
-- Extract the contents of the Zip file.
Zip.Extract("xaosd.zip", {"*.*"}, target_folder, true, true, "", ZIP_OVERWRITE_ALWAYS, nil);

-- Check the error code for the last action.
error = Application.GetLastError();

-- Show the status dialog.
StatusDlg.Show(MB_ICONNONE, false);

-- If an error occurred, display the error code message.
if (error ~= 0) then
Dialog.Message("Errror", tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
else
Dialog.Message("Success", "The unzipping was successful.", MB_OK, MB_ICONINFORMATION);
end
end
end
end
end


I'm at my wits-end.

I don't know what to do.

Help! :huh

SUF6NEWBIE
03-21-2005, 07:32 PM
change:

Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);

to:

Dialog.Message("Error", _tblErrorMessages[error1], MB_OK, MB_ICONEXCLAMATION);

you will then get the error message displaying correctly
(which I got as 'source file does not exist)

BTW: it can be helpfull to 'quote' the 'line number' for these types
of post (when you are shown one by the runtime)
..the code can then be looked at and simpler things like 'typos'
can be picked up more quickly for you.. :yes

SUF6NEWBIE
03-22-2005, 07:44 PM
also keep in mind that 'builtin variables' like _TempFolder, _TempLaunchFolder
etc. do not require being enclosed with ""

..so "_TempFolder.."\\xaosd.txt" will not work
where _TempFolder.."\\xaosd.txt" is how to do things

also the main issue with your code is that you must have or create
a valid Zip file ..simply renaming a file to .zip does not work
the zip plugin, like all zip programs require a valid Zip structure,
to be able to work with a zip files.

So you need to use the Zip.Add action-s to create a valid zip file
and then go from there

Look up the help docs for the Zip plugin and see how you go..

Ted Sullivan
03-22-2005, 07:45 PM
Hey! Pretty soon you're going to have to change your name to "SUF7NEWBIE" or better still "SUF7EXPERT"!

Corey
03-22-2005, 07:47 PM
Hee! I vote for SUF7EXPERT. :yes

SUF6NEWBIE
03-22-2005, 07:48 PM
I'm a legend in my own lunchbox :yes

might start again with a new 'handle'..what ya reckon Sir TED-COREY ?

Corey
03-22-2005, 07:52 PM
Sure, why not? The Vbulletin system is such that we can't edit usernames without possibly messing up some aspect of the database or I'd just do that. I say go ahead, have some fun with it, pick a new name you like more, etc. :yes

SUF6NEWBIE
03-22-2005, 07:58 PM
will do Amigo..been considering it for a while now...

start 'squeeky clean' ;)

FYI

I'm gonna use 'Eagle' ..has meanings for me etc

signing off as poor 'SUF6NEWBIE' ...we knew him well :rolleyes

Corey
03-22-2005, 08:16 PM
Viva la Eagle! :yes

JimS
03-22-2005, 08:17 PM
Nearly 650 posts is quite a few to give up when you change names, but referring to you as newbie seems sort of silly, seeing how you’re an expert with SUF7. ;)

Maybe you could add aka SUF6NEWBIE to your new signature, although it probably won't take long to figure out who the new member is.


Oops! should have refreshed my screen. Eagle is a great name. :yes

.

SUF6NEWBIE
03-22-2005, 08:18 PM
registering..won't accept my current email details..HELP :)

..states 'already in use'..I did log off etc..suggestions ?

ps..was thinking the same JIM..

Eagle
03-22-2005, 08:40 PM
as you can see the Eagle is now 'flying' :yes

Corey
03-22-2005, 08:50 PM
Cool! Yep I agree with Jim, Eagle is a great nick. Once again Ted's mighty "Hey" has been a catalyst for change. :yes

Intrigued
03-22-2005, 08:52 PM
as you can see the Eagle is now 'flying' :yes
We in the U.S. like Eagles, espeically the Haliaeetus leucocephalus!

:yes

Eagle
03-22-2005, 08:58 PM
..'Haliberricus beauticus' to you too my friends..

tks folks :cool

Ted is mighty force to be reckoned with, as long as he makes
Sandy and the Team a brew every now and then :yes

Corey
03-22-2005, 09:02 PM
Yes, he is as magnanimous as he is catalytic. Or at least that's what Tiger Beat (http://www.bopmag.com/) is saying about him *this week* anyhow... :yes

Eagle
03-22-2005, 09:18 PM
yo bro..I'll put my 18 year old daughter on to that site

Corey
03-22-2005, 10:50 PM
Hee! Yes, I was just teasing... :)

Eagle
03-22-2005, 11:12 PM
you got me good..that's for sure :)

Corey
03-22-2005, 11:20 PM
Actually I was teasing Ted but I guess I just don't know my own strength... :)

Eagle
03-22-2005, 11:23 PM
yeah..thought that's wot ya meant..sucked me in

'worm on hook' ..hmmm must eat.

csd214
03-23-2005, 04:57 AM
Welcome to the forum, Eagle! :lol :lol

I'm sure you haven't lost your knowledge during the nick baptism. To me, SUF6NEWBIE has been the most helpful person here in the Setup Factory forum. In several projects I have used my user defined function Env.Office(). The function is a result of the great cooperation with "SUF6NEWBIE". Now we are going to fly even higher?

Cheers, Eagle. :yes

Eagle
03-23-2005, 09:15 AM
..hey 'newbie no more' ..excellent

Worm
03-23-2005, 09:40 AM
'worm on hook' ..hmmm must eat.

Hey man! You're starting to scare me :D

Eagle
03-23-2005, 09:59 AM
yeah..eagle eat worm, eagle thanks worm , eagle become worm, worm is great :)