Jump to content

Modifying Notepad


Ace08
 Share

Recommended Posts

hi guys another thing i have this code

$OpenPad = "Notepad.exe " & $RepPath
Run($OpenPad)
WinActivate($RepFile & " - Notepad", "")
WinMove($RepFile & " - Notepad", "", 300, 0, 450, 740,1)

i was able to open the file with notepad

but it keeps poping behind any opened applications(in this case behind notepad++ since im just using a text editor to create this) also i can't resize the notepad using winmove, any comments?

Note:

$RepPath = "c:\Autoit\Test\RepFile.Rep"

$RepFile = "RepFile.Rep"

got this one, i just added WinWait ($RepFile, "")before winactivate ;)

Edited by Ace08

Work smarter not harder.My First Posted Script: DataBase

Link to comment
Share on other sites

I have tried like this and winmove works ! Posted Image

$RepPath = "[color=#1C2837][font=arial, verdana, tahoma, sans-serif][size=2]c:\Autoit\Test\RepFile.Rep[/size][/font][/color]"
$RepFile = "RepFile.Rep"

$OpenPad = "Notepad.exe " & $RepPath
Run($OpenPad)
WinWait ($RepFile, "")
WinActivate($RepFile & " - Notepad", "")
WinMove($RepFile & " - Notepad", "", 300, 0, 450, 740,1)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

I have tried like this and winmove works ! Posted Image

$RepPath = "[color=#1C2837][font=arial, verdana, tahoma, sans-serif][size=2]c:\Autoit\Test\RepFile.Rep[/size][/font][/color]"
$RepFile = "RepFile.Rep"

$OpenPad = "Notepad.exe " & $RepPath
Run($OpenPad)
WinWait ($RepFile, "")
WinActivate($RepFile & " - Notepad", "")
WinMove($RepFile & " - Notepad", "", 300, 0, 450, 740,1)

Link to comment
Share on other sites

This may give you some clues in respect to managing the Notebook

;// Open Notepad at Correct Size and Position
Func _AutoNotepadExe($nPFile, $nPDir, $iLeft, $iTop, $iWidth, $iHeight, $nPTimer)
 ;//Close all running instances of  Notepad
 If ProcessExists($sNotePadExe) Then
  $list = ProcessList($sNotePadExe)
  $s = $list[0][0]
  For $i = 1 To $list[0][0]
   ProcessClose($list[$i][1])
  Next
 EndIf
 ;//Reset Notepad X Y Width and Height settings in Registry [Document Size]
 RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Notepad", "iWindowPosX", "REG_DWORD", $iLeft)
 RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Notepad", "iWindowPosY", "REG_DWORD", $iTop)
 RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Notepad", "iWindowPosDX", "REG_DWORD", $iWidth)
 RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Notepad", "iWindowPosDY", "REG_DWORD", $iHeight)
 ;//Open the Document with the Notepad Text Editor
 ShellExecute($nPFile, "", $nPDir, "Edit")
 ;//Set the Unattended Exit Timer
 $MenuStartCycle = TimerInit()
 While 1
  ;//Process Ceases to Exist [closed by User] Exit
  If Not ProcessExists($sNotePadExe) Then ExitLoop
  ;//Calculate Timer Difference
  $MenuEndCycle = TimerDiff($MenuStartCycle)
  ;//Process and Unattended Exit [nn Minutes]
  If $MenuEndCycle >= $nPTimer * $sTextDurationX Then
   ProcessClose($sNotePadExe)
   ExitLoop
  EndIf
 WEnd
 ;//;//Reset Notepad X Y Width and Height settings in Registry [Default when sEmailSMS Started]
 RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Notepad", "iWindowPosX", "REG_DWORD", $iPosXLeft)
 RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Notepad", "iWindowPosY", "REG_DWORD", $iPosYTop)
 RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Notepad", "iWindowPosDX", "REG_DWORD", $iPosDXWidth)
 RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Notepad", "iWindowPosDY", "REG_DWORD", $iPosDYHeight)
EndFunc   ;==>_AutoNotepadExe
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...