AetherMaster Posted April 16, 2009 Share Posted April 16, 2009 Hi, I'm writing a very simple script, but I'm having some trouble. In this script, I have a "Browse..." box to set two variables. They set fine, and are used correctly the first time they are brought up in the script. However, the second time I use these variables, the first one goes from a file location to "10" and the second one goes from a file location to "11" I have nothing in the script that would make this happen, so what's causing this? It works fine while in the "doex ()" function, but not while in the "dodel ()" function. expandcollapse popup#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <GUIListBox.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Include <File.au3> #include <GDIPlus.au3> #include <WinAPI.au3> Global Const $winstate = @SW_HIDE Func cleanup() FileRecycle("C:\MergeTemp") EndFunc ;Func main() $xSpacing = 5 $ySpacing = 50 $xWidth = 445 cleanup() DirCreate("C:\MergeTemp") $maingui=GUICreate("AetherMaster's File-Picture Merger", 431, 251) $mergebutton = GUICtrlCreateButton("Merge!", 120, 215, 160) $archivebutton = GUICtrlCreateButton("Browse...", 360, 44, 60) $imagebutton = GUICtrlCreateButton("Browse...", 360, 125, 60) GUICtrlCreateLabel("Archive:", 5, 50) GUICtrlCreateLabel("Image:", 5, 129) GUICtrlCreateLabel("RAR, Zip, or 7z", 66, 72) GUICtrlCreateLabel("PNG, BMP, JPG, JPEG, GIF, TIFF, TIF, or TGA", 66, 151) $archive = GUICtrlCreateInput("", 59, 46, 285) $image = GUICtrlCreateInput("", 59, 127, 285) $delete = GUICtrlCreateCheckbox("Delete original files after merging? (Broken at the moment)", 59, 189) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE cleanup () ExitLoop Case $msg = $mergebutton doex ($archive, $image) Case $msg = $archivebutton GUICtrlSetData($archive, FileOpenDialog("Choose Archive", @WorkingDir, "Archives (*.rar; *.zip; *.7z)", 1)) Case $msg = $imagebutton GUICtrlSetData($image, FileOpenDialog("Choose Image", @WorkingDir, "Images (*.png; *.bmp; *.jpg; *.jpeg; *.gif; *.tiff; *.tif; *.tga)", 1)) EndSelect WEnd ;EndFunc Func doex () FileChangeDir("C:\Windows\System32") Run("cmd.exe") Sleep(500) Send("copy /b{SPACE}") Send('"') Send(GUICtrlRead($image)) Send('"') Send("{SPACE}{+}{SPACE}") Send('"') Send(GUICtrlRead($archive)) Send('"') Send("{SPACE}") Send("C:\MergeTemp\Output.img") Send("{ENTER}") Sleep(500) Send("exit") Send("{ENTER}") doend () EndFunc Func doend () FileMove("C:\MergeTemp\Output.img", FileSaveDialog("Save Merged Image With Old Image's Extention", @DesktopDir, "Images (*.png; *.bmp; *.jpg; *.jpeg; *.gif; *.tiff; *.tif; *.tga)", 16)) Sleep(500) FileDelete("C:\MergeTemp\Output.img") If GUICtrlRead($delete) = $GUI_CHECKED Then Assign("delval", "1") Else Assign("delval", "0") EndIf FileChangeDir(@ScriptDir) If StringRight($delval, 1) == "1" Then dodel () Else FileChangeDir(@ScriptDir) EndIf cleanup () Exit EndFunc Func dodel () FileDelete($image) FileDelete($archive) cleanup () EndFunc Is anyone able to please help me? thanks. Link to comment Share on other sites More sharing options...
Hawkwing Posted April 16, 2009 Share Posted April 16, 2009 In the second function, you forgot to use guictrlread($var). The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
Authenticity Posted April 16, 2009 Share Posted April 16, 2009 You're calling doex ($archive, $image) but doex is defined as Func doex().... Link to comment Share on other sites More sharing options...
AetherMaster Posted April 16, 2009 Author Share Posted April 16, 2009 (edited) In the second function, you forgot to use guictrlread($var).Wow, I'm stupid. That fixed it!Thanks@Authenticity, I know. That's been fixed in my current version. Thanks for noticing, though! Edited April 16, 2009 by AetherMaster Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now