
Necromorph
Active Members-
Posts
171 -
Joined
-
Last visited
Everything posted by Necromorph
-
Send Win+Shift+Left or Right arrow
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
ShellExecute("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MSI\MSI GamingApp\MSI GamingApp") WinWaitActive("MSI Gaming App") Send("#+{LEFT}") Well, I don't know why, but if I compile the script with this code, and then run the .exe as an admin, it works. No flipping idea why, but it works. lol, thanks for the help. -
Send Win+Shift+Left or Right arrow
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
ShellExecute("Calc.exe") WinWaitActive("Calculator") Send("#+{LEFT}") So, it must be something with the application, because this works fine. Thanks again. -
Send Win+Shift+Left or Right arrow
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
I tried that one too. I'm glad to see im not just missing something obvious. thanks for the help, im going to keep working at it. Thanks. -
Send Win+Shift+Left or Right arrow
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
I attempted this first, but it did not work, I will try again, thanks. -
ShellExecute("C:\Program Files (x86)\MSI\MSI GamingApp\MSIGamingApp.exe") Sleep(3000) WinActivate("MSI Gaming App") Send("{LWINDOWN}{SHIFTDOWN}{LEFT}", 1) Send("{LWINUP}{SHIFTUP}", 1) Sorry if this has been asked already, I did search a bit, and didn't find anything helpful. Basically I wanted to open an application, then send it to my secondary monitor with the WindowsKey + Shift + Left arrow, but it just doesn't work, I hope maybe I am just missing something easy. I haven't used AutoIT it a while, but I thought it would be perfect for this type of task. Thanks for any help.
-
well, im not sure the best way to do this, as a service or a shortcut, but for testing, i just need to make it work first, so i tired this #include<File.au3> HotKeySet("^+t", "_NewTextFile") Func _NewTextFile() _FileCreate(@WorkingDir & "\New Text File.txt") EndFunc While 1 Sleep(100) WEnd and i tried putting a msgbox in the "while" statement, but the while statement stays @ScriptDir, im sure im just misusing the @WorkingDir but, as i said, any help would be appreciated.
-
basically, here i need a way to get the current directory that is ACTIVE, i want to create a function/service/shortcut that is similar to the "CTRL+SHIFT+N" that exists in window 7 that makes a new folder, i want to make a new text document, when you "CTRL+SHIFT+T" i cannot get the @WorkingDir to work. any help would be appreciated.
-
FileOpenDialog() to get a directory
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
I have to apologize. I can't belive that i missed that, its perfect. thank you. -
I am making a backup utility, and i want to be able select a "source" directory, is there a way to to do it with the FileOpenDialog() function? $var = FileOpenDialog("title", StringLeft(@SystemDir, 3), '') GUICtrlSetData($hCtrl, $var) when i use this, i have to select a file, or multi select files, i would rather just select a folder.
-
Mousemove method not working in RDP session
Necromorph replied to sachin3079's topic in AutoIt General Help and Support
Try useing the autoit info window and using the WinActivate() function first. -
thanks for the help, and sorry i went so long before i seen it, here is my finished code. for it work right, you need a folder in the @ScriptDir called "needed assemblies" and build your "Constants" or "templates" there. for outlook a signature builds three files, an .htm, .rtf, .txt. so i put what i wanted for everyones there, and just move it to @appdata & "\Microsoft\Signatures\*.*" and my script builds the rest. Here it is. #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=mail_edit.ico #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Run_Tidy=y #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include<AD.au3> #include<File.au3> #include<GUIConstantsEx.au3> #include<GuiRichEdit.au3> ;// Query Active Directory to get the current user's object properties and sets variables _AD_Open() If @error <> 0 Then Exit EndIf $adObj_company = _AD_GetObjectProperties(@UserName, 'company') If $adObj_company[0][0] = 0 Then Exit Else $adObj_company = $adObj_company[1][1] EndIf $adObj_displayName = _AD_GetObjectProperties(@UserName, 'displayName') If $adObj_displayName[0][0] <> 0 Then $adObj_displayName = $adObj_displayName[1][1] $adObj_mail = _AD_GetObjectProperties(@UserName, 'mail') If $adObj_mail[0][0] <> 0 Then $adObj_mail = $adObj_mail[1][1] $adObj_mobile = _AD_GetObjectProperties(@UserName, 'mobile') If $adObj_mobile[0][0] <> 0 Then $adObj_mobile = $adObj_mobile[1][1] $adObj_telephoneNumber = _AD_GetObjectProperties(@UserName, 'telephoneNumber') If $adObj_telephoneNumber[0][0] <> 0 Then $adObj_telephoneNumber = $adObj_telephoneNumber[1][1] $adObj_title = _AD_GetObjectProperties(@UserName, 'title') If $adObj_title[0][0] <> 0 Then $adObj_title = $adObj_title[1][1] _AD_Close() ;// Move signature template files from needed assemblies folder to signatures folder, based on return value of $adObj_company FileCopy(@ScriptDir & '\Needed Assemblies\' & $adObj_company & '\*.*', @AppDataDir & '\Microsoft\Signatures\', 1) ;// Complete '*.txt' file based on fields retuned from active directory $txtObj_file = @AppDataDir & '\Microsoft\Signatures\' & $adObj_company & '_email_signature.txt' _FileWriteToLine($txtObj_file, 2, '') If $adObj_displayName > '' Then _FileWriteToLine($txtObj_file, 2, $adObj_displayName) If $adObj_mobile > '' Then _FileWriteToLine($txtObj_file, 3, $adObj_mobile & " mobile") If $adObj_telephoneNumber > '' Then _FileWriteToLine($txtObj_file, 3, $adObj_telephoneNumber & " direct") If $adObj_mail > '' Then _FileWriteToLine($txtObj_file, 3, $adObj_mail) If $adObj_title > '' Then _FileWriteToLine($txtObj_file, 3, $adObj_title) ;// Complete '*.htm' file based on fields returned from active directory $htmObj_file = @AppDataDir & '\Microsoft\Signatures\' & $adObj_company & '_email_signature.htm' If $adObj_displayName > '' Then _FileWriteToLine($htmObj_file, 2, '<BR/>' & '<strong>' & $adObj_displayName & '</strong>' & '<BR/>') If $adObj_mobile > '' Then _FileWriteToLine($htmObj_file, 3, $adObj_mobile & " mobile" & '<BR/>') If $adObj_telephoneNumber > '' Then _FileWriteToLine($htmObj_file, 3, $adObj_telephoneNumber & " direct" & '<BR/>') If $adObj_mail > '' Then _FileWriteToLine($htmObj_file, 3, '<a href="mailto:' & $adObj_mail & '">' & $adObj_mail & '</a>' & '<BR/>') If $adObj_title > '' Then _FileWriteToLine($htmObj_file, 3, $adObj_title & '<BR/>') ;// Complete '*.rtf' file based on fields returned from active directory $rtfObj_file = @AppDataDir & '\Microsoft\Signatures\' & $adObj_company & '_email_signature.rtf' $frm_main = GUICreate('', 0, 0) $ctrl_edit = _GUICtrlRichEdit_Create($frm_main, '', 0, 0) _GUICtrlRichEdit_StreamFromFile($ctrl_edit, $rtfObj_file) _GUICtrlRichEdit_GotoCharPos($ctrl_edit, 0) _GUICtrlRichEdit_SetCharAttributes($ctrl_edit, '+bo') If $adObj_displayName > '' Then _GUICtrlRichEdit_InsertText($ctrl_edit, $adObj_displayName & @LF) If $adObj_title > '' Then _GUICtrlRichEdit_InsertText($ctrl_edit, $adObj_title & @LF) If $adObj_mail > '' Then _GUICtrlRichEdit_InsertText($ctrl_edit, $adObj_mail & @LF) If $adObj_mobile > '' Then _GUICtrlRichEdit_InsertText($ctrl_edit, $adObj_mobile & " mobile" & @LF) If $adObj_telephoneNumber > '' Then _GUICtrlRichEdit_InsertText($ctrl_edit, $adObj_telephoneNumber & " direct" & @LF) $xPos = _GUICtrlRichEdit_FindTextInRange($ctrl_edit, $adObj_mail) _GUICtrlRichEdit_SetSel($ctrl_edit, $xPos[0], $xPos[1]) _GUICtrlRichEdit_SetCharAttributes($ctrl_edit, "+un") _GUICtrlRichEdit_SetCharAttributes($ctrl_edit, "+li") _GUICtrlRichEdit_SetCharColor($ctrl_edit, "16711680") _GUICtrlRichEdit_GotoCharPos($ctrl_edit, 0) _GUICtrlRichEdit_StreamToFile($ctrl_edit, $rtfObj_file) GUIDelete($frm_main) ;// Create registry key(s) for default send/reply signature, if not exits $regObj_outlookVersion = StringRight(RegRead("HKCR\Outlook.Application\CurVer", ""), 2) & '.0' RegRead("HKCU\Software\Microsoft\Office\" & $regObj_outlookVersion & "\Common\MailSettings", "NewSignature") If @error = -1 Then RegWrite("HKCU\Software\Microsoft\Office\" & $regObj_outlookVersion & "\Common\MailSettings", "NewSignature", "REG_SZ", $adObj_company & "_email_signature") EndIf RegRead("HKCU\Software\Microsoft\Office\" & $regObj_outlookVersion & "\Common\MailSettings", "ReplySignature") If @error = -1 Then RegWrite("HKCU\Software\Microsoft\Office\" & $regObj_outlookVersion & "\Common\MailSettings", "ReplySignature", "REG_SZ", $adObj_company & "_email_signature") EndIf Exit may be it will work for otheres as well. P.S. the files need to be named what ever value is returned from $adObj_company = _AD_GetObjectProperties(). that is why if this returns '' or NULL, it will exit. enjoy.
-
_GUICtrlRichEdit_SetAttributes()
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
if you create an RTF doc and open it in word, and type "ThisIsAnEmail@ADomain.com" then hit enter, it will make it a link. and you don't need the "Mailto:" infront of it. if i use the above sample, it will say "mailto:ThisIsAnEmail@ADomain.com". im try to do this without opening the document, and sending the 'keys' followed by an Send('{ENTER}') or something and with no 'mailto:'. but maybe that is what i will have to do. -
_GUICtrlRichEdit_SetAttributes()
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
this does work, but if try to remove the "mailto:" part, it wrecks it. im telling you, this is impossable. ahah, but i will keep trying. thanks again -
_GUICtrlRichEdit_SetAttributes()
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
Good work, it works with a URL, but the main issue was to use it with an email address, and this doesn't work. But thanks a lot, though you have been most helpfull, i will still try to make this work. -
_GUICtrlRichEdit_SetAttributes()
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
Thanks for the help, it does work in your script, the problem is that im using this technique to actuall edit an exsiting .rtf file. so if you add the _GUICtrlRichEdit_StreamToFile($hRichEdit, $sRTF) [after you use the button to change to link] and push it to a file, it still doesn't retain the "+li" attribute, but if you use "+bo" for bold, that works. im starting to think this isn't possiable #include <GuiConstants.au3> #include <GuiRichEdit.au3> $sRTF = @ScriptDir & "\test.rtf" $sLink = "www.autoitscript.com" $sText = "This is line one." & @CRLF & _ "This is line two." & @CRLF & _ "Line three is the link: <insert link here>" & @CRLF & _ "This is line four." & @CRLF & _ "This is line five." & @CRLF $hGUI = GUICreate('Test1.rtf', 400, 400) $hRichEdit = _GUICtrlRichEdit_Create($hGUI, $sText, 10, 10, 380, 340) $idButton = GUICtrlCreateButton("Create Link", 150, 360, 100, 30) GuiSetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_StreamToFile($hRichEdit, $sRTF) _GUICtrlRichEdit_Destroy($hRichEdit) Exit Case $idButton $aPos = _GUICtrlRichEdit_FindTextInRange($hRichEdit, "<insert link here>") _GUICtrlRichEdit_SetSel($hRichEdit, $aPos[0], $aPos[1]) _GUICtrlRichEdit_ReplaceText($hRichEdit, $sLink) $aPos = _GUICtrlRichEdit_FindTextInRange($hRichEdit, $sLink) _GUICtrlRichEdit_SetSel($hRichEdit, $aPos[0], $aPos[1]) _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "+li") EndSwitch WEnd but thanks again. -
Ok, i just started using this these rich edit controls because of my last post about editing a rich text doc. there is a lot variables that are undified, but i think you get the point.(i get them from Acitive Directory Query) $obj_rtf = @AppDataDir & '\Microsoft\Signatures\' & $adObj_company & '_email_signature.rtf' $frm_main = GUICreate('', 0, 0) $ctrl_Edit = _GUICtrlRichEdit_Create($frm_main, '', 0, 0) _GUICtrlRichEdit_StreamFromFile($ctrl_Edit, $obj_rtf) _GUICtrlRichEdit_GotoCharPos($ctrl_Edit, 0) _GUICtrlRichEdit_SetCharAttributes($ctrl_Edit, '+bo') If $adObj_displayName > '' Then _GUICtrlRichEdit_InsertText($ctrl_Edit, $adObj_displayName & @LF) If $adObj_title > '' Then _GUICtrlRichEdit_InsertText($ctrl_Edit, $adObj_title & @LF) If $adObj_mail > '' Then _GUICtrlRichEdit_InsertText($ctrl_Edit, $adObj_mail & @LF) If $adObj_mobile > '' Then _GUICtrlRichEdit_InsertText($ctrl_Edit, $adObj_mobile & " mobile" & @LF) If $adObj_telephoneNumber > '' Then _GUICtrlRichEdit_InsertText($ctrl_Edit, $adObj_telephoneNumber & " direct" & @LF) _GUICtrlRichEdit_StreamToFile($ctrl_Edit, $obj_rtf) GUIDelete($frm_main) Now, the $adObj_mail, i want to be a link, but I cant get the _GUICtrlRichEdit_SetAttribute($ctrl_Edit, '+li') to work. if i open the document and go to the end of that line, and hit "enter" it makes it a link, i have tried removing the @LF at the end of the line, and making it a new one, but that doesnt help, i m just trying to figure out if this is even possiable. thanks a lot.
-
Edit a rich text document
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
This maybe a differnt post, but ill start here, how do i make the _GUICtrlRichEdit_SetAttribute() work for email address, the '+li' doesnt seem to be working. and i know that rtf supports this. any ideas? _GUICtrlRichEdit_GoToCharPos($hCtrl, 0) _GUICtrlRichEdit_SetAttribute($hCtrl, '+li') ;==>this doesnt seem to work _GUICtrlRichEdit_InsertText($hCtrl, 'user@domain.com' & @LF) if you open the RTF afterwards, and hit 'Enter' after the line, it will make it a "hyperlink", but i don't want to open the doc. send and {ENTER} and close it. there must be a better way. -
Edit a rich text document
Necromorph replied to Necromorph's topic in AutoIt General Help and Support
Thank you very much for you help, i modded it a lot, but the concept is the same. i lost the While statement, and never show the GUI, so it Just makes it. but thank you all the same. when my code is fully finished, i will post it. thanks. -
I keep trying to make my project easier, by eliminating this hurdle, but there just is no way around it. i need to edit a rich text document. i tried to make the entire document in autoit, by using FileWriteLine() and coding in rtf. but, insterting a graphic was near impossiable. now i made an rtf 'template' with the graphic in it. but i need to edit the first few lines, with changing data. and of corse, i cant do this with FileWriteLine(), or _FileWriteToLine(), and i can't get any of the Word.au3 UDF's to work. Im just wondering the simplist solution to adding 2 to 6 lines of text to the top of an already existing rich text document. thanks.
-
Script based on IP Address
Necromorph replied to Elephant007's topic in AutoIt General Help and Support
im not sure i follow you but maybe this: If @IPAddress1 Then ;==> your code here Elseif @IPAddress2 Then ;==> your alternate code here Else ;==> this is assuming your that ip1 and ip2 failed, so it is 0.0.0.0 ;==> your code for 0.0.0.0 EndIf -
ok, i have found out how to format the .rtf doc, but how can i put a picture into it, i can't seem to find any code on that.
-
Im working on an automated email signatrue exe, and i need to format an .rtf document. i have done some search, and havn't found a good solution how to create this document, as far as text size, font, colors, hyper links, and graphics. im just wondering if there is any UDF's for this, or what is recommended practice to format .rtf docs. thanks in advanced.
-
Okay, it is sort of lengthy, but this works: #include<AD.au3> ;// Query Active Directory to get the current user's object properties and sets variables _AD_Open() $config_file = @ScriptDir & "\Company.Config.ini" $userName = @UserName $adObj_company = _AD_GetObjectProperties($userName, "company") If $adObj_company[0][0] = 0 Then $adObj_company = '' Else $adObj_company = $adObj_company[1][1] EndIf $adObj_department = _AD_GetObjectProperties($userName, "department") If $adObj_department[0][0] = 0 Then $adObj_department = '' Else $adObj_department = $adObj_department[1][1] EndIf $adObj_displayName = _AD_GetObjectProperties($userName, "displayName") If $adObj_displayName[0][0] = 0 Then $adObj_displayName = '' Else $adObj_displayName = $adObj_displayName[1][1] EndIf $adObj_mail = _AD_GetObjectProperties($userName, "mail") If $adObj_mail[0][0] = 0 Then $adObj_mail = '' Else $adObj_mail = $adObj_mail[1][1] EndIf $adObj_mobile = _AD_GetObjectProperties($userName, "mobile") If $adObj_mobile[0][0] = 0 Then $adObj_mobile = '' Else $adObj_mobile = $adObj_mobile[1][1] EndIf $adObj_telephoneNumber = _AD_GetObjectProperties($userName, "telephoneNumber") If $adObj_telephoneNumber[0][0] = 0 Then $adObj_telephoneNumber = '' Else $adObj_telephoneNumber = $adObj_telephoneNumber[1][1] EndIf $adObj_title = _AD_GetObjectProperties($userName, "title") If $adObj_title[0][0] = 0 Then $adObj_title = '' Else $adObj_title = $adObj_title[1][1] EndIf _AD_Close() ;// Format to single variable for output If $adObj_displayName <> '' Then $adObj_constants = $adObj_displayName If $adObj_title <> '' Then $adObj_constants = $adObj_constants & @LF & $adObj_title If $adObj_mail <> '' Then $adObj_constants = $adObj_constants & @LF & $adObj_mail If $adObj_telephoneNumber <> '' Then $adObj_constants = $adObj_constants & @LF & $adObj_telephoneNumber & " direct" If $adObj_mobile <> '' Then $adObj_constants = $adObj_constants & @LF & $adObj_mobile & " mobile" ;// Output MsgBox(0, '',$adObj_constants) i used the $userName = @UserName so you can change that value and try it with other users ie $userName = 'jdoe' im open to suggestions for better ways to do this. thanks.
-
Yes, i probably wasn't very clear, the "displayName" field, will always work, because, you are a user of AD, but try this field "telephoneNumber". but make sure that that field is blank in AD. and the way i wrote the IF statement, it will still work because if the array, is blank then $var = '', that is my problem. when i format all the fields together $adObj_formated = $adObj_dispalyName & @LF & $adObj_company & @LF & $adObj_telephoneNumber MsgBox(0, '' $adObj_formated) if the $adObj_company is holding the value of '' because it was blank in AD, then the message box will have a blank line between the two othere fields, so im trying to find a way to say if the the $var = '' then skip it in the formating. im think this will have to be a function that each $var passes through, and if it is blank the delete the variable or something. **I think i have found a way, i will post it soon.
-
okay, this is what im doing, im use the Active directory UDF's to get information from Active Directory to buil email signatures customized for the user. but i need a way that if a field is blank, sort of "$var = NULL" so skip it. Due to the fact that there is not error code returned by the _AD_GetObjectProperties(), i have to look at every field seperatly #include<AD.au3> $adObj_displayName = _AD_GetObjectProperties(@UserName, "displayName") If $adObj_displayName[0][0] = 0 Then $adObj_displayName = '' Else $adObj_displayName = $adObj_displayName[1][1] EndIf MsgBox(0, "Display Name", $adObj_displayName) and i have to do a seperate _AD_GetObjectProperties(@UserName, [$AD_Property]) for each field, because if i did all fields i want at once: _AD_GetObjectPropertied(@UserName, "displayName, company, department, mail") and say "mail" was blank, it messes my array index up, or i would do it like this $adObj = _AD_GetObjectPropertied(@UserName, "displayName, company, department, mail") $adObj_displayName = $adObj[1][1] $adObj_company = $adObj[2][1] [/ _ so anyway, when im formating it, i want it all on seperate lines, but if a field in AD is blank, i don't want it to just be a blank line. so i need some way to format all the $var's together, but if $var = '' Then skip. thanks for any help.