Page 1 of 1

ie.Navigate("%clipboard%") not working, how to fix?

Posted: 26 May 2017, 11:25
by Cuadrix
I have a code which upon start lets you select a text file to read. After selecting the text the script reads the text file line by line, and each time saves the current line to clipboard. My problem is that when I put %clipboard% or the variable name %LinkURL%, it doesn't navigate to the link stored in clipboard. Nothing happens, but when I write any other text without %% then it navigates. Any help would be appreciated. Here's my code:

Code: Select all

#SingleInstance force
#notrayicon

Start:
SetWorkingDir %A_ScriptDir% 
FileSelectFile, file,,, Select your Link text file, Data File (*.txt)
FileRead, fileData, %file%
If ErrorLevel = 1 
{   Msgbox, 5,No file to work with..?, You must choose a file to read! ; If no file was chosen, show message box offering a retry or cancel option.
   IfMsgBox Retry
          Goto Start 
   else
          MsgBox,,Bye!,OK, see you soon! ;
   ExitApp
}   
; Init lineIndex to 1
lineIndex := 1

KeyWait, F3
F3::
    Loop, Parse, fileData, `n
    {
        ; A_Index holds the current loop-itteration
        if (A_Index == lineIndex) {
            clipboard = %A_LoopField%

LinkURL = %clipboard%

;ComObjError(false)

App2IE(URL)
{
	For ie in ComObjCreate( "Shell.Application" ).Windows
		If InStr(ie.FullName, "iexplore.exe" ) && InStr(ie.LocationURL, URL)
			Return ie
}
ie := App2IE(URL)
ie.Visible := True
y = 8
loop, 2
{
	ie.Navigate("%LinkURL%")
		y++
}
break
        }
    }
return

~Esc::ExitApp

Re: ie.Navigate("%clipboard%") not working, how to fix?

Posted: 26 May 2017, 11:34
by kon
ie.Navigate(var)

This is an expression.

Re: ie.Navigate("%clipboard%") not working, how to fix?

Posted: 26 May 2017, 11:50
by Cuadrix
I tried it without quotation marks but it still didn't work

Re: ie.Navigate("%clipboard%") not working, how to fix?

Posted: 26 May 2017, 11:58
by Cuadrix
Hey, never mind. I fixed it.