MoonDoggie
11-24-2009, 07:20 PM
Hey all,
I'm writing a script and am having a problem with it executing out of order.
Here is the code:
global is7zipInstalled
global updateLog
global exe7za = "7zip.exe"
global archiveFile = "test.zip"
global exportDirectory = "$scripts/"
global filesToArchive = ""
function is7zipInstalled = ( true )
function updateLog msg = ( print msg )
-- add a ( here
print "one"
-- Ask the user if they want to manually add files to the archive, or automatically do it if they don't have 7zip installed ------------------------------------------------
if (queryBox "Would you like to add files manually to the zip file before it's packed?" modal:true) or not(local isInstalled = is7zipInstalled()) then (
if not(is7zipInstalled()) then (
-- Let the user know that the script can't automatically add files to the achive
messageBox ("7zip was not found on your system, you might be using an operating system that is non-windows, manually add the files.")
)
messageBox ("You will need to manually add all of the files in the /export/ directory\n to the zip file " + (filenameFromPath archiveFile) + " yourself.\n\n1. Click on OK, and then drag the files in the \export\ directory to the opened .zip file.")
ShellLaunch archiveFile ""
ShellLaunch exportDirectory ""
createDialog rlt_finishedAddingFiles 370 150 modal:true
)
print "two"
-- Check for 7zip ------------------------------------------------------------------------------------------------------------------------------------------------------------------
if is7zipInstalled() then (
-- Automatically add all the files to the archive
local exeToRun = "\"" + (symbolicPaths.expandFileName exe7za) + "\""
local mainArchive = "\"" + (symbolicPaths.expandFileName archiveFile) + "\""
local filesToArchive = "\"" + (symbolicPaths.expandFileName exportDirectory) + "*.*\""
local commandToRun = exeToRun + " a -tzip " + mainArchive + " " + filesToArchive
--format "commandToRun: [%]\n" commandToRun
if (DOSCommand ("\"" + commandToRun + "\"")) == 0 then (
-- Completed successfully
updateLog "7zip Successfully packed the Archive"
print "should be the last thing"
) else (
-- Problem executing the DOSCommand
-- Tell the user there was a problem packing the file, and to try it manually
messageBox "There was a problem packing the files into the .vu3 file.\n\nTo ensure the project is rendered correctly, rename the .vu3 file to .zip and make sure all the files in the export directory are there." beep:true
updateLog "7zip was not able to automatically add the files to the achive"
)
)
-- and a ) here for proper ordering...
I've read the help files plenty and if I encase it in ( ) parenthesis, it will execute in order, however this is only part of the code and it is already enclosed in parenthesis, how can I make this section execute in order? You can see in the listener window it doesn't currently.
Thanks a ton everyone,
Colin
I'm writing a script and am having a problem with it executing out of order.
Here is the code:
global is7zipInstalled
global updateLog
global exe7za = "7zip.exe"
global archiveFile = "test.zip"
global exportDirectory = "$scripts/"
global filesToArchive = ""
function is7zipInstalled = ( true )
function updateLog msg = ( print msg )
-- add a ( here
print "one"
-- Ask the user if they want to manually add files to the archive, or automatically do it if they don't have 7zip installed ------------------------------------------------
if (queryBox "Would you like to add files manually to the zip file before it's packed?" modal:true) or not(local isInstalled = is7zipInstalled()) then (
if not(is7zipInstalled()) then (
-- Let the user know that the script can't automatically add files to the achive
messageBox ("7zip was not found on your system, you might be using an operating system that is non-windows, manually add the files.")
)
messageBox ("You will need to manually add all of the files in the /export/ directory\n to the zip file " + (filenameFromPath archiveFile) + " yourself.\n\n1. Click on OK, and then drag the files in the \export\ directory to the opened .zip file.")
ShellLaunch archiveFile ""
ShellLaunch exportDirectory ""
createDialog rlt_finishedAddingFiles 370 150 modal:true
)
print "two"
-- Check for 7zip ------------------------------------------------------------------------------------------------------------------------------------------------------------------
if is7zipInstalled() then (
-- Automatically add all the files to the archive
local exeToRun = "\"" + (symbolicPaths.expandFileName exe7za) + "\""
local mainArchive = "\"" + (symbolicPaths.expandFileName archiveFile) + "\""
local filesToArchive = "\"" + (symbolicPaths.expandFileName exportDirectory) + "*.*\""
local commandToRun = exeToRun + " a -tzip " + mainArchive + " " + filesToArchive
--format "commandToRun: [%]\n" commandToRun
if (DOSCommand ("\"" + commandToRun + "\"")) == 0 then (
-- Completed successfully
updateLog "7zip Successfully packed the Archive"
print "should be the last thing"
) else (
-- Problem executing the DOSCommand
-- Tell the user there was a problem packing the file, and to try it manually
messageBox "There was a problem packing the files into the .vu3 file.\n\nTo ensure the project is rendered correctly, rename the .vu3 file to .zip and make sure all the files in the export directory are there." beep:true
updateLog "7zip was not able to automatically add the files to the achive"
)
)
-- and a ) here for proper ordering...
I've read the help files plenty and if I encase it in ( ) parenthesis, it will execute in order, however this is only part of the code and it is already enclosed in parenthesis, how can I make this section execute in order? You can see in the listener window it doesn't currently.
Thanks a ton everyone,
Colin
