kev51773 Posted December 20, 2006 Posted December 20, 2006 Okay I have a problem with a script that I won't post here as its 804 lines long so far. I have a function that recursively find all files ending .res, it works fine, however It finds the full path. I need to trim the path like in the following example Script resides at = C:\Documents and Settings\username\Desktop\samplefolder FullPath1 = C:\Documents and Settings\username\Desktop\samplefolder\data\projectname\setup\samplefile.res FullPath2 = C:\Documents and Settings\username\Desktop\samplefolder\data\projectname\setup\test\samplefile2.res FullPath3 = C:\Documents and Settings\username\Desktop\samplefolder\data\projectname\setup\test\test\samplefile3.res The results I want are as follows Result 1 = samplefile.res Result 2 = test\samplefile.res Result 3 = test\test\samplefile.res Basically I need to find a path relative to (@ScriptDir & "\data\projectname\setup\") Ive tried doing this using stringinstr or stringsplit and displaying the result is a msgbox for debugging but for some reason the script just hangs with the msgbox shown in the taskbar but not displayed on screen? Any ideas? I could really do with finishing this script today or tommorow before I leave for xmas.
martin Posted December 20, 2006 Posted December 20, 2006 Okay I have a problem with a script that I won't post here as its 804 lines long so far.I have a function that recursively find all files ending .res, it works fine, however It finds the full path. I need to trim the path like in the following exampleScript resides at = C:\Documents and Settings\username\Desktop\samplefolderFullPath1 = C:\Documents and Settings\username\Desktop\samplefolder\data\projectname\setup\samplefile.resFullPath2 = C:\Documents and Settings\username\Desktop\samplefolder\data\projectname\setup\test\samplefile2.resFullPath3 = C:\Documents and Settings\username\Desktop\samplefolder\data\projectname\setup\test\test\samplefile3.resThe results I want are as followsResult 1 = samplefile.resResult 2 = test\samplefile.resResult 3 = test\test\samplefile.resBasically I need to find a path relative to (@ScriptDir & "\data\projectname\setup\")Ive tried doing this using stringinstr or stringsplit and displaying the result is a msgbox for debugging but for some reason the script just hangs with the msgbox shown in the taskbar but not displayed on screen?Any ideas? I could really do with finishing this script today or tommorow before I leave for xmas.It should be quite simple. StringinStr should work so you must have done something wrong.$RelativePath = StringRight(FullPath,StringLen(FullPath) -StringinStr(FullPath,@ScriptDir & "\data\projectname\setup\") - stringlen(@ScriptDir & "\data\projectname\setup\")) or If the paths alway contain @ScriptDir & "\data\projectname\setup\" then you could say$RelativePath = StringReplace(FullPath,@ScriptDir & "\data\projectname\setup\","")But you need to be sure thatStringinStr(FullPath,@ScriptDir & "\data\projectname\setup\") > 0 Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
ChrisL Posted December 20, 2006 Posted December 20, 2006 StringReplace ($fullpath1,@scriptdir,"") [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
kev51773 Posted December 20, 2006 Author Posted December 20, 2006 Thanks guys, It seems I was going about it correctly in the first place. I was just encountering a bug in msgbox that I thought pointed to a problem elsewhere. As soon as I switched to saving the data to an array rather than displaying it in a msgbox, the problem disappeared.
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