Chimaera Posted May 30, 2013 Share Posted May 30, 2013 At least i think it is.. I have a Gui like this that basically helps the user finds the folder he needs and adds the file to it, mainly so they dont have to create duplicate files all over the place. expandcollapse popup#include <Misc.au3> #include <GUIConstantsEx.au3> ;>>>>>>>>>>>>>>>>>>>>>>>> Global $GUI_Start, $button1, $label1, $image1, $label5, $sSetDefault Global $Gui = _Gui() DirCreate(@TempDir & "\Sup") FileInstall(".\compile\Uploader.exe", @TempDir & "\Sup\", 1) ;>>>>>>>>>>>>>>>>>>>>>>>> Func _Gui() $GUI_Start = GUICreate("Packer", 300, 110, -1, -1) ;>>>>>>>>>>>>>>>>>>>>>>>> $label1 = GUICtrlCreateLabel("Select the folder where the files are stored" & @CRLF & _ " that you wish to prepare", 20, 10, 600) GUICtrlSetFont(-1, 9, 550, -1, "Tahoma") ;>>>>>>>>>>>>>>>>>>>>>>>> $button1 = GUICtrlCreateButton(" Choose Folder ", 70, 55, 160, 35) GUICtrlSetFont(-1, 10, 550, -1, "Tahoma") ;>>>>>>>>>>>>>>>>>>>>>>>> ;~ $image1 = GUICtrlCreatePic(@TempDir & "\" & "chim_logo.jpg", 420, 230, 104, 25) ;>>>>>>>>>>>>>>>>>>>>>>>> GUISetState() EndFunc ;==>_Gui Local $nMsg = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button1 $sSetDefault = _FindDefault() ;~ ConsoleWrite($sSetDefault & @CRLF) Sleep(100) FileMove(@TempDir & "\Sup\Uploader.exe", $sSetDefault & "\Uploader.exe", 9) Run($sSetDefault & "\Uploader.exe") Sleep(500) WinClose("Simple Packer") EndSwitch WEnd Func _FindDefault() #region $sFindDefault Local $sDefault = "" $sDefault = FileSelectFolder("Choose a drive.", @ScriptDir) ;"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" If @error = 1 Then ; User cancel or X close error check MsgBox(48, "Cancelled", "Cancelled By User", 4) $sDefault = "" EndIf If DriveSpaceTotal($sDefault) = 0 Then ; Drive contains no files error check MsgBox(48, "Source Error", "There Is No Data On That Drive", 4) $sDefault = "" EndIf Local $sDefaultEnd = StringRight($sDefault, 1) If $sDefaultEnd = "" Then $sDefault = "" ElseIf $sDefaultEnd = "\" Then StringTrimRight($sDefault, 1);make sure backslash is NOT on the end EndIf ;~ ConsoleWrite("Default = " & $sDefault & @CRLF) ;######## Checking ######## Return $sDefault #endregion $sFindDefault EndFunc ;==>_FindDefault Its quite simple like the above the problem im having is the second GUi is started from the first but seems to inherit the @scriptDir characteristics from the first GUi Then when it starts moving files around and doing stuff it fails and creates files and folders where the first GUI is located, im guessing because the original @ScriptDir is still in memory so it uses that. Is there a way to make the second GUI use its own position of @ScriptDir not use the in memory one? If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted May 30, 2013 Share Posted May 30, 2013 You have the root directory of FileSelectFolderset set to @ScriptDir, is that what you want. You might also want to re-evaluate_FindDefault() as you're using StringTrimRight but not assigning it to anything. Could you prove a more stripped down example minus the file install and file move. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted May 30, 2013 Author Share Posted May 30, 2013 Yes this file bases where to send the file from @scriptdir So does it not trim the off then if its not named?, it seems to work fine Or is it bad coding to do it that way? The only time it goes bad is after the file install because the file it installs seems to inherit the original @scriptdir folder position instead of the new one that it does for itself. If you close the file thats copied and run it again without the first gui it works perfectly, its only when the two follow each other it misdirects @scriptdir If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted May 30, 2013 Share Posted May 30, 2013 No, see this line... StringTrimRight($sDefault, 1);make sure backslash is NOT on the end you're trimming it but not re-assigning it back to $sDefault. The reason it works is because by default the backslash isn't appended in the function FileSelectFolder. I'm not able to re-produce your problem. Could you perhaps whittle it down to a simpler example? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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