Sign in to follow this  
Followers 0
styles3000

Finding The End Of The Directory When Its A Variable

4 posts in this topic

#1 ·  Posted (edited)

Hello Again,

I've been attempting to access a folder whose name use to be called 'christmas greeting'. Since then, (as u can see below), the folder is named what ever the $Firstline variable is. My problem is what should I place in the place of where were ever christmas greetings use to be in order to access the directory? For example.....

$sDir_Title_Insert = 'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\christmas greetings\'

I've tried .....

$sDir_Title_Insert = 'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\$FirstLine\'

and

$sDir_Title_Insert = 'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\&$FirstLine&\'

But gives me errors. Please, no profanity when you reply. If you can't respond like civil code masters, don't reply.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Include <Array.au3>
#include <file.au3>
#include <EditConstants.au3>
Global $split, $FirstLine


$Form1_1 = GUICreate("Form1", 609, 414, 186, 127)
$Button1 = GUICtrlCreateButton("Get Popular Keyword ", 32, 40, 241, 25)
$Button2 = GUICtrlCreateButton("Website Creation", 32, 136, 241, 33)
$Button3 = GUICtrlCreateButton("Generate Subtopic Keywords", 440, 40, 139, 33, 0)
$Button4 = GUICtrlCreateButton("Generate Websites", 32, 272, 243, 49)
$List1 = GUICtrlCreateEdit(""&@CRLF&"", 280, 72, 129, 357) ; added "act"&@CRLF&"aig" for testing
$Button5 = GUICtrlCreateButton("Import Keywords", 296, 40, 105, 33)
$List2 = GUICtrlCreateEdit("", 440, 72, 137, 266)
GUICtrlSetData(-1, "")
$Button6 = GUICtrlCreateButton("Import Keywords 2", 456, 344, 105, 25, 0)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _Button1_Pressed()
        Case $Button5
            _GetKeywords() ;-----------------------------------------------o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0
            Sleep(3000)
            _PopulateKeyWords()
        Case $Button3
            ;_Button3_Pressed()
            _Button3_Pressed_NEW()
        Case $Button2
            $ResultsOfRead = GUICtrlRead($List2)
            $FirstLine = StringMid($ResultsOfRead,1,StringInStr($ResultsOfRead,@CRLF))
            ClipPut($FirstLine)
            _Button2_Pressed()
        Case $Button6 ;this i did add
            _Button6_Pressed()
        Case $Button4
            $ResultsOfRead = GUICtrlRead($List2)
            $FirstLine = StringMid($ResultsOfRead,1,StringInStr($ResultsOfRead,@CRLF))
            ClipPut($FirstLine)
            _Button4_Pressed()
    EndSwitch
WEnd

$sTotalFiles = _GetFileCount("D:\Documents and Settings\Taevon Jones\Desktop\Extracted Keywords\")
;MsgBox(0,'Total Files',$sTotalFiles)
sleep(5000)


$ResultsOfRead = GUICtrlRead($List2)
$FirstLine = StringMid($ResultsOfRead,1,StringInStr($ResultsOfRead,@CRLF))
;$Firstline = 'christmas greetings'

DirCreate('D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline)
FileCopy('D:\Objects To Burn\Adsense\websites\HOME-MASTER-PHP2.htm', _
'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline&'\index.htm',8)
sleep(5000)
For $i = 1 To $sTotalFiles
   FileCopy('D:\Objects To Burn\Adsense\websites\PAGE-MASTER-PHP2.htm', _
          'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline& '\index' & $i & '.htm',8)
        Next


;This is where AutoIT extracts and inserts the text from the files extracted from
$sDir_Title_Extract = "D:\Documents and Settings\Taevon Jones\Desktop\Extracted Keywords\"
$sFile_Title_Extract = '0001.txt'
$sDir_Title_Insert = 'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\christmas greetings\'
$sFile_Title_Insert = 'index1.htm'


$sTitle_Ins = _GetTitle( $sDir_Title_Extract & $sFile_Title_Extract ) ;Get the String to be inserted

$sTitle_Rep = _GetTitle( $sDir_Title_Insert & $sFile_Title_Insert ) ;Get the string to be replaced

$retval = _ReplaceStringInFile($sDir_Title_Insert & $sFile_Title_Insert,$sTitle_Rep,$sTitle_Ins,0,1) ;replace the title string
if $retval = -1 then msgbox(0, "ERROR", "The pattern could not be replaced in file: " & $sDir_Title_Insert & $sFile_Title_Insert & " Error: " & @error) ;Error checking

;----------------- CONTENT -------------------------
$sContent_Ins = _Get_Content( $sDir_Title_Extract & $sFile_Title_Extract ) ;Get the String to be inserted
$retval = _ReplaceStringInFile($sDir_Title_Insert & $sFile_Title_Insert,'#ARTICLE_CONTENT1#',$sContent_Ins,0,1) ;replace the title string
if $retval = -1 then msgbox(0, "ERROR", "The pattern could not be replaced in file: " & $sDir_Title_Insert & $sFile_Title_Insert & " Error: " & @error) ;Error checking


;------------------ AUTHOR ----------------------------
$sAuthor_Ins = _Get_Author( $sDir_Title_Extract & $sFile_Title_Extract ) ;Get the String to be inserted
$retval = _ReplaceStringInFile($sDir_Title_Insert & $sFile_Title_Insert,'#authorname#',$sAuthor_Ins,0,1) ;replace the title string
if $retval = -1 then msgbox(0, "ERROR", "The pattern could not be replaced in file: " & $sDir_Title_Insert & $sFile_Title_Insert & " Error: " & @error) ;Error checking
Edited by styles3000

Share this post


Link to post
Share on other sites



try

'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\' & $Firstline
; or, if the destination of the the path likes paths with spaces quoted, try ...
'"D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\' & $Firstline & '"'

... and do yourself a favour: always put at least 1 space before and after "&"

whim

Share this post


Link to post
Share on other sites

try

'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\' & $Firstline
; or, if the destination of the the path likes paths with spaces quoted, try ...
'"D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\' & $Firstline & '"'

... and do yourself a favour: always put at least 1 space before and after "&"

whim

Thanks CodeMaster Whim,

It cleared, but after a few trial runs, I recognized that the folder isn't even being created. What could be the problem?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks CodeMaster Whim,

It cleared, but after a few trial runs, I recognized that the folder isn't even being created. What could be the problem?

In my previous scripts, I tried this and it worked....

$Firstline = 'christmas greetings'
DirCreate('D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline)

But thats just a string.(obviously). I know the secret is within the ...

$Firstline = ' '

I tried $Firstline = $Firstline

but that didn't work. What could I place there?

Edited by styles3000

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0